git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbfx@1091549 283d02a7-25f6-0310-bc7c-ecb5cbfe19dav3.5.13-sru
@ -0,0 +1,274 @@
|
||||
PROJECT(kbfx)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.2 FATAL_ERROR)
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmakemodules)
|
||||
SET(CMAKE_COLOR_MAKEFILE ON CACHE STRING "Enable/Disable color output during build." FORCE)
|
||||
#SET(CMAKE_VERBOSE_MAKEFILE OFF CACHE STRING "Enable/Disable cmake debug output during build." FORCE)
|
||||
|
||||
# Optimization flags
|
||||
# SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")
|
||||
# SET(CMAKE_C_FLAGS_DISTRIBUTION "-O3")
|
||||
|
||||
# Global variable CMAKE_BUILD_TYPE
|
||||
# None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used)
|
||||
# Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG)
|
||||
# Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)
|
||||
# RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
# MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo
|
||||
CACHE
|
||||
STRING "Specify build type: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
ENDIF (NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
OPTION(USE_STRIGI "Enable use of Strigi search support (disabled)" OFF)
|
||||
OPTION(USE_MENUDRAKE "Use 'menudrake' instead of 'kmenuedit' in Mandriva (auto)" ON)
|
||||
OPTION(USE_KDE4 "Compile for KDE4 (disabled)" OFF)
|
||||
|
||||
SET(BIN_SEARCH_PATHES
|
||||
$ENV{HOME}/bin
|
||||
$ENV{HOME}/usr/bin
|
||||
$ENV{KDEDIR}/bin
|
||||
${CMAKE_INSTALL_PREFIX}/bin
|
||||
/opt/kde/bin
|
||||
/opt/kde3/bin
|
||||
/opt/kde4/bin
|
||||
/usr/kde/3.5/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
/opt/bin
|
||||
)
|
||||
SET(INCLUDE_SEARCH_PATHES
|
||||
$ENV{HOME}/include
|
||||
$ENV{HOME}/usr/include
|
||||
$ENV{KDEDIR}/include
|
||||
/opt/kde/include
|
||||
/opt/kde3/include
|
||||
/opt/kde4/include
|
||||
/usr/kde/3.5/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/include
|
||||
${CMAKE_SYSTEM_INCLUDE_PATH}
|
||||
)
|
||||
SET(LIB_SEARCH_PATHES
|
||||
$ENV{HOME}/lib
|
||||
$ENV{HOME}/usr/lib
|
||||
$ENV{KDEDIR}/lib
|
||||
/opt/kde/lib
|
||||
/opt/kde3/lib
|
||||
/opt/kde4/lib
|
||||
/usr/kde/3.5/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/lib
|
||||
)
|
||||
|
||||
# Setting versions
|
||||
|
||||
# For versions that are stable set to 1, else to 0
|
||||
SET(APPLICATION_STABLE 1)
|
||||
|
||||
SET(LIB_MAJOR 4)
|
||||
SET(LIB_MINOR 9)
|
||||
SET(LIB_RELEASE 3)
|
||||
SET(LIB_SUB_RELEASE 1)
|
||||
SET(APPLICATION_INTERNAL_VERSION "20070516")
|
||||
SET(APPLICATION_DATE "2007-05-16")
|
||||
|
||||
SET(APPLICATION_NAME "${PROJECT_NAME}")
|
||||
SET(APPLICATION_MAIN_VERSION "0.${LIB_MAJOR}.${LIB_MINOR}.${LIB_RELEASE}")
|
||||
|
||||
IF (APPLICATION_STABLE)
|
||||
SET(APPLICATION_STABLE_RELEASE ".${LIB_SUB_RELEASE}")
|
||||
SET(APPLICATION_VERSION "${APPLICATION_MAIN_VERSION}.${LIB_SUB_RELEASE}")
|
||||
SET(GENTOO_VERSION "${APPLICATION_MAIN_VERSION}.${LIB_SUB_RELEASE}")
|
||||
ELSE (APPLICATION_APPLICATION_STABLE "")
|
||||
SET(STABLE_RELEASE)
|
||||
SET(APPLICATION_VERSION "${APPLICATION_MAIN_VERSION}-${LIB_SUB_RELEASE}")
|
||||
SET(GENTOO_VERSION "${APPLICATION_MAIN_VERSION}_pre${LIB_SUB_RELEASE}")
|
||||
ENDIF (APPLICATION_STABLE)
|
||||
|
||||
SET(VERSION ${APPLICATION_VERSION})
|
||||
|
||||
SET(STRIGI_VERSION "0.3.11")
|
||||
SET(GENTOO_KEYWORDS "x86 ~ppc ~amd64")
|
||||
|
||||
# Prepare docbook part
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/en/index.docbook.in ${CMAKE_BINARY_DIR}/doc/en/index.docbook @ONLY)
|
||||
|
||||
IF (USE_STRIGI)
|
||||
FIND_PACKAGE(Strigi REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${STRIGI_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Strigi support is: ON!")
|
||||
ELSE (USE_STRIGI)
|
||||
MESSAGE(STATUS "Strigi support is: OFF!")
|
||||
ENDIF (USE_STRIGI)
|
||||
|
||||
|
||||
FIND_PROGRAM(HAVE_MANDRAKE menudrake)
|
||||
IF (HAVE_MANDRAKE AND USE_MENUDRAKE)
|
||||
SET(MANDRAKE "1")
|
||||
MESSAGE(STATUS "Will use 'menudrake' instead of 'kmenuedit'!")
|
||||
ELSE (HAVE_MANDRAKE AND USE_MENUDRAKE)
|
||||
SET(MANDRAKE "")
|
||||
MESSAGE(STATUS "Will use 'kmenuedit'!")
|
||||
ENDIF (HAVE_MANDRAKE AND USE_MENUDRAKE)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
MESSAGE(STATUS "Building for KDE3")
|
||||
INCLUDE(TestCXXAcceptsFlag)
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} -DTESTING_RC=\"\\\"\${CMAKE_SOURCE_DIR}/configdialog/kbfxconfigappui.rc\\\"\"")
|
||||
|
||||
CHECK_CXX_ACCEPTS_FLAG("-fexceptions" CXX_EXCEPTION)
|
||||
CHECK_CXX_ACCEPTS_FLAG("-fstack-protector" CXX_PROTECTOR)
|
||||
|
||||
FIND_PACKAGE(KDE3 REQUIRED)
|
||||
|
||||
INCLUDE(FindKdeLibs)
|
||||
INCLUDE(MacroEnsureVersion)
|
||||
|
||||
# Dummy macros for compatibility
|
||||
MACRO(KDE4_AUTOMOC _dummy)
|
||||
ENDMACRO(KDE4_AUTOMOC)
|
||||
|
||||
MACRO(KDE4_ADD_LIBRARY _dummy _dummy1 _dummy2)
|
||||
ENDMACRO(KDE4_ADD_LIBRARY)
|
||||
|
||||
MACRO(KDE4_INSTALL_LIBTOOL_FILE _dummy _dummy1)
|
||||
ENDMACRO(KDE4_INSTALL_LIBTOOL_FILE)
|
||||
|
||||
MACRO(KDE4_ADD_UI3_FILES _dummy _dummy1)
|
||||
ENDMACRO(KDE4_ADD_UI3_FILES)
|
||||
|
||||
MACRO(KDE4_ADD_DCOP_SKELS _dummy _dummy1)
|
||||
ENDMACRO(KDE4_ADD_DCOP_SKELS)
|
||||
|
||||
MACRO(KDE4_ADD_EXECUTABLE _dummy _dummy1)
|
||||
ENDMACRO(KDE4_ADD_EXECUTABLE)
|
||||
|
||||
MACRO(KDE4_INSTALL_ICONS _dummy)
|
||||
ENDMACRO(KDE4_INSTALL_ICONS)
|
||||
ELSE (NOT USE_KDE4)
|
||||
MESSAGE(STATUS "Building for KDE4")
|
||||
FIND_PACKAGE(KDE4 REQUIRED)
|
||||
ADD_DEFINITIONS(${KDE4_DEFINITIONS} ${QT_DEFINITIONS})
|
||||
SET(INCLUDE_SEARCH_PATHES
|
||||
${INCLUDE_SEARCH_PATHES}
|
||||
${KDE4_INCLUDES}
|
||||
)
|
||||
SET(LIB_SEARCH_PATHES
|
||||
${LIB_SEARCH_PATHES}
|
||||
${KDE4_LIB_DIR}
|
||||
)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}/kbfxlib/data
|
||||
${CMAKE_BINARY_DIR}/kbfxlib/common
|
||||
${CMAKE_BINARY_DIR}/src
|
||||
${CMAKE_BINARY_DIR}/configdialog
|
||||
${CMAKE_BINARY_DIR}/plugins/common
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/kbfxlib/data
|
||||
${CMAKE_SOURCE_DIR}/kbfxlib/common
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/configdialog
|
||||
${CMAKE_SOURCE_DIR}/plugins/common
|
||||
${KDE3_INCLUDE_DIR}/kbfx
|
||||
${KDE3_INCLUDE_DIR}/kbfx/plugins
|
||||
${INCLUDE_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
IF (CXX_EXCEPTION)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
|
||||
ENDIF (CXX_EXCEPTION)
|
||||
IF (CXX_PROTECTOR)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
|
||||
ENDIF (CXX_PROTECTOR)
|
||||
|
||||
ADD_DEFINITIONS(${KDE3_DEFINITIONS} ${QT_DEFINITIONS})
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
||||
|
||||
IF(KDE3_KDECONFIG_EXECUTABLE)
|
||||
EXECUTE_PROCESS(COMMAND ${KDE3_KDECONFIG_EXECUTABLE} "--version" OUTPUT_VARIABLE output)
|
||||
STRING(REGEX MATCH "KDE: [0-9]+\\.[0-9]+\\.[0-9]+" KDEVERSION "${output}")
|
||||
STRING(REGEX REPLACE "^KDE: " "" KDEVERSION "${KDEVERSION}")
|
||||
ENDIF(KDE3_KDECONFIG_EXECUTABLE)
|
||||
SET(KDE_MIN_VERSION "3.5.0")
|
||||
MACRO_ENSURE_VERSION(${KDE_MIN_VERSION} ${KDEVERSION} VERSION_OK)
|
||||
IF(NOT VERSION_OK)
|
||||
MESSAGE(FATAL_ERROR "You need at least KDE Version of 3.5.0 in order to compile KBFX.\n Please upgrade your KDE or install the development files of KDE.")
|
||||
ENDIF(NOT VERSION_OK)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
SET(KBFX_LIB_INSTALL_DIR ${LIB_INSTALL_DIR})
|
||||
|
||||
ADD_SUBDIRECTORY(kbfxlib/data)
|
||||
ADD_SUBDIRECTORY(kbfxlib/common)
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(configdialog)
|
||||
ADD_SUBDIRECTORY(skin/vector)
|
||||
ADD_SUBDIRECTORY(skin/raster/default)
|
||||
ADD_SUBDIRECTORY(skin/raster/2panels)
|
||||
ADD_SUBDIRECTORY(images)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
ADD_SUBDIRECTORY(doc/en)
|
||||
ADD_SUBDIRECTORY(doc/common)
|
||||
ADD_SUBDIRECTORY(po)
|
||||
ADD_SUBDIRECTORY(plugins/common)
|
||||
ADD_SUBDIRECTORY(plugins/applications)
|
||||
ADD_SUBDIRECTORY(plugins/settings)
|
||||
ADD_SUBDIRECTORY(plugins/plasmoids)
|
||||
ADD_SUBDIRECTORY(plugins/recentstuff)
|
||||
IF (USE_STRIGI)
|
||||
ADD_SUBDIRECTORY(plugins/strigi)
|
||||
ENDIF (USE_STRIGI)
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/kbfx.spec.in ${CMAKE_BINARY_DIR}/kbfx.spec @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/kbfx.ebuild.in ${CMAKE_BINARY_DIR}/kbfx-${GENTOO_VERSION}.ebuild @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/strigi.ebuild.in ${CMAKE_BINARY_DIR}/strigi-${STRIGI_VERSION}.ebuild @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/kbfx-svn.ebuild.in ${CMAKE_BINARY_DIR}/kbfx-9999.ebuild @ONLY)
|
||||
|
||||
SET(DIST_INCLUDE "kbfx-9999.ebuild kbfx.spec kbfx-${GENTOO_VERSION}.ebuild strigi-${STRIGI_VERSION}.ebuild")
|
||||
SET(DIST_EXCLUDE "Helperstuff")
|
||||
CONFIGURE_FILE(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/makedist.sh.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/makedist.sh"
|
||||
IMMEDIATE
|
||||
@ONLY)
|
||||
ADD_CUSTOM_TARGET(dist
|
||||
"${CMAKE_BINARY_DIR}/makedist.sh"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
CONFIGURE_FILE(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
ADD_CUSTOM_TARGET(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
|
||||
FILE(GLOB _POFILES po/*.po)
|
||||
FOREACH(_p ${_POFILES})
|
||||
SET(POFILES "${_p} ${POFILES}")
|
||||
ENDFOREACH(_p)
|
||||
|
||||
SET(MESSAGES_DIR ${CMAKE_SOURCE_DIR})
|
||||
CONFIGURE_FILE(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/package_messages.sh.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/package_messages.sh"
|
||||
IMMEDIATE
|
||||
@ONLY)
|
||||
ADD_CUSTOM_TARGET(package-messages
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/package_messages.sh")
|
||||
|
@ -0,0 +1,246 @@
|
||||
#! /bin/sh
|
||||
|
||||
CMAKE_OPT_PREFIX_KDE3="-DCMAKE_INSTALL_PREFIX:PATH=`kde-config --prefix 2>/dev/null` "
|
||||
CMAKE_OPT_PREFIX_KDE4="-DCMAKE_INSTALL_PREFIX:PATH=`kde4-config --prefix 2>/dev/null` "
|
||||
CMAKE_OPT_PREFIX=""
|
||||
MAKE_VERBOSE=""
|
||||
USE_STRIGI_SEARCH=""
|
||||
MENUDRAKE=""
|
||||
KDE4=""
|
||||
ACTION="install"
|
||||
NOCHECK=0
|
||||
build_state="touch kbfx_build"
|
||||
command_line_args=$@
|
||||
eval "which kbfxconfigapp > /dev/null 2>&1" && kbfx_installed="1" || kbfx_installed="0"
|
||||
|
||||
color_ok="\\033[1;32m"
|
||||
color_error="\\033[1;31m"
|
||||
color_normal="\\033[0;39m"
|
||||
color_warn="\\033[1;33m"
|
||||
|
||||
|
||||
prog_action(){
|
||||
echo
|
||||
echo -e "$color_ok $@ $color_normal"
|
||||
}
|
||||
|
||||
prog_err(){
|
||||
echo
|
||||
echo -e "$color_error ERROR doing $@ $color_normal\n"
|
||||
}
|
||||
|
||||
confirm() {
|
||||
printf "$color_warn %s (Y)es/(N)o? [%s]$color_normal " "$1" "$2"
|
||||
unset user_input
|
||||
answer="$2"
|
||||
read user_input
|
||||
if [ "$user_input" = "y" -o "$user_input" = "Y" -o "$user_input" = "YES" -o "$user_input" = "Yes" -o "$user_input" = "yes" ]; then
|
||||
answer="Y"
|
||||
fi
|
||||
if [ "$user_input" = "n" -o "$user_input" = "N" -o "" = "NO" -o "$user_input" = "No" -o "$user_input" = "no" ]; then
|
||||
answer="N"
|
||||
fi
|
||||
}
|
||||
|
||||
parse_command_line() {
|
||||
if [ "$#" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
while [ "$1" != "${1##-}" ]; do
|
||||
case $1 in
|
||||
--verbose|-v)
|
||||
MAKE_VERBOSE="VERBOSE=1"
|
||||
shift 1
|
||||
;;
|
||||
--prefix|-p)
|
||||
if [ -n "$2" -a "$2" = "${2##-}" ]; then
|
||||
t=0
|
||||
stop=0
|
||||
s=""
|
||||
for p in $@
|
||||
do
|
||||
t=$[t+1]
|
||||
if [ $t -gt 1 -a "$p" = "${p##-}" -a $stop -eq 0 ]; then
|
||||
s="$s$p "
|
||||
fi
|
||||
if [ $t -gt 1 -a "$p" != "${p##-}" ]; then
|
||||
stop=$[t-1]
|
||||
fi
|
||||
done
|
||||
if [ $stop -eq 0 ]; then
|
||||
stop=$[t-1]
|
||||
fi
|
||||
if [ -n "$s" ]; then
|
||||
s=${s%%[ ]}
|
||||
CMAKE_OPT_PREFIX="-DCMAKE_INSTALL_PREFIX:PATH='$s' "
|
||||
fi
|
||||
shift $stop
|
||||
else
|
||||
shift 1
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
--strigi|-s)
|
||||
USE_STRIGI_SEARCH="-DUSE_STRIGI:BOOL=TRUE"
|
||||
shift 1
|
||||
;;
|
||||
--menudrake-off|-m)
|
||||
MENUDRAKE="-DUSE_MENUDRAKE:BOOL=FALSE"
|
||||
shift 1
|
||||
;;
|
||||
--kde4|-k)
|
||||
KDE4="-DUSE_KDE4:BOOL=TRUE"
|
||||
shift 1
|
||||
;;
|
||||
--uninstall|-u)
|
||||
ACTION="uninstall"
|
||||
shift 1
|
||||
;;
|
||||
--nocheck|-n)
|
||||
NOCHECK=1
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
if [ "$#" -ge 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
show_usage(){
|
||||
echo
|
||||
echo -e "$color_warn Usage: \n\t build.sh \t [(-v|--verbose) Be verbose when compiling (default: no)] \n\t\t\t [(-u|--uninstall) Uninstall KBFX (default: no)] \n\t\t\t [(-p|--prefix) Install prefix (default: KDE prefix)] \n\t\t\t [(-s|--strigi) Compile strigi search plugin (default: no)] \n\t\t\t [(-m|-menudrake-off) Don't use menudrake in Mandriva (default: auto)] \n\t\t\t [(-k|--kde4) Compile for KDE4 (default: no)] \n\t\t\t [(-n|--nocheck) Do not check for old KBFX versions (default: check)] $color_normal"
|
||||
echo
|
||||
}
|
||||
|
||||
parse_command_line $command_line_args
|
||||
if [ "$?" -eq 1 ]; then
|
||||
prog_err "build.sh"
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
show_usage
|
||||
|
||||
if [ "$ACTION" = "install" ]
|
||||
then {
|
||||
if [ $kbfx_installed -eq 1 -a $NOCHECK -eq 0 ] ; then
|
||||
echo
|
||||
echo -e "$color_error \n\t You have KBFX installed in your \$PATH!\n\t In order to compile the new version you HAVE TO REMOVE the old KBFX first!\n $color_normal"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d build ] ; then
|
||||
echo
|
||||
echo -e "$color_warn Directory 'build' exists! Using it...$color_normal"
|
||||
echo -e "$color_error If 'build.sh' fails, try removing the directory 'build' and run 'build.sh' again! $color_normal"
|
||||
else
|
||||
mkdir build
|
||||
fi
|
||||
cd build
|
||||
|
||||
if [ "$CMAKE_OPT_PREFIX" = "" ]
|
||||
then {
|
||||
if [ "$KDE4" = "" ]
|
||||
then {
|
||||
CMAKE_OPT_PREFIX=$CMAKE_OPT_PREFIX_KDE3
|
||||
}
|
||||
else {
|
||||
CMAKE_OPT_PREFIX=$CMAKE_OPT_PREFIX_KDE4
|
||||
}
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
CMAKE_OPT="$CMAKE_OPT_PREFIX $KDE4 $MENUDRAKE $USE_STRIGI_SEARCH"
|
||||
|
||||
prog_action "Doing CMake configure..."
|
||||
echo $CMAKE_OPT
|
||||
eval "cmake ../ $CMAKE_OPT"
|
||||
if [ $? -ne 0 ]; then
|
||||
prog_err "CMake configure..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prog_action "Doing make..."
|
||||
make $MAKE_VERBOSE
|
||||
if [ $? -ne 0 ]; then
|
||||
prog_err "make..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval $build_state
|
||||
prog_action "Success building KBFX...\n"
|
||||
|
||||
confirm "Do you want to install KBFX?" "Y"
|
||||
if [ "$answer" = "Y" ]
|
||||
then
|
||||
sucommand="make install"
|
||||
after_su="touch kbfx_install_user"
|
||||
if [ `whoami` != 'root' ]
|
||||
then {
|
||||
confirm "To install KBFX as 'root', answer 'Yes'. To install as '`whoami`', answer 'No'" "N"
|
||||
if [ "$answer" = "Y" ]
|
||||
then {
|
||||
sucommand="su root -c 'make install'"
|
||||
after_su="touch kbfx_install_root"
|
||||
}
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
prog_action "Doing 'make install'..."
|
||||
eval $sucommand
|
||||
if [ $? -ne 0 ]; then
|
||||
prog_err "make install..."
|
||||
exit 1
|
||||
fi
|
||||
eval $after_su
|
||||
echo
|
||||
echo -e "$color_warn NOTE: If you have used a custom prefix for your install (-p or --prefix option for script), \n you should add '$s' to your \$KDEDIRS environment variable\n and '$s/lib' to your \$LD_LIBRARY_PATH environment variable!\n $color_normal"
|
||||
fi
|
||||
}
|
||||
else {
|
||||
if [ -d build ]
|
||||
then
|
||||
cd build
|
||||
else
|
||||
echo
|
||||
echo -e "$color_error \n\t Directory 'build' DOES NOT exist!\n\t You HAVE NOT used 'build.sh' script for installing KBFX! \n\t Uninstall CAN NOT continue!\n $color_normal"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f kbfx_install_user ]
|
||||
then
|
||||
sucommand="make uninstall"
|
||||
after_su="rm -f kbfx_install_user"
|
||||
elif [ -f kbfx_install_root ]
|
||||
then
|
||||
sucommand="su root -c 'make uninstall'"
|
||||
after_su="rm -f kbfx_install_root"
|
||||
elif [ -f kbfx_build ]
|
||||
then
|
||||
echo
|
||||
echo -e "$color_error \n\t KBFX IS NOT installed! \n\t Uninstall CAN NOT continue!\n $color_normal"
|
||||
exit 1
|
||||
else
|
||||
echo
|
||||
echo -e "$color_error \n\t You HAVE NOT used 'build.sh' script for installing KBFX! \n\t Uninstall CAN NOT continue!\n $color_normal"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prog_action "Uninstalling..."
|
||||
eval $sucommand
|
||||
if [ $? -ne 0 ]; then
|
||||
prog_err "uninstall..."
|
||||
exit 1
|
||||
fi
|
||||
eval $after_su
|
||||
|
||||
}
|
||||
fi
|
||||
|
||||
prog_action "All actions ended successfully...\n"
|
@ -0,0 +1,22 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -0,0 +1,21 @@
|
||||
# - Check whether the CXX compiler supports a given flag.
|
||||
# CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE)
|
||||
#
|
||||
# FLAG - the compiler flag
|
||||
# VARIABLE - variable to store the result
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
|
||||
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
|
||||
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
|
||||
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
||||
ENDMACRO (CHECK_CXX_COMPILER_FLAG)
|
||||
|
@ -0,0 +1,49 @@
|
||||
|
||||
# Copyright (c) 2006, Peter Kuemmel, <syntheticpp@yahoo.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
if (WIN32)
|
||||
|
||||
# check if GNUWIN32_DIR is already set
|
||||
# (e.g. by command line argument or the calling script)
|
||||
if(NOT GNUWIN32_DIR)
|
||||
# check for enviroment variable
|
||||
file(TO_CMAKE_PATH "$ENV{GNUWIN32_DIR}" GNUWIN32_DIR)
|
||||
if(NOT GNUWIN32_DIR)
|
||||
# search in the default program install folder
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
|
||||
find_file(GNUWIN32_DIR_tmp gnuwin32 win32libs
|
||||
PATHS
|
||||
"${_progFiles}"
|
||||
"C:/" "D:/" "E:/" "F:/" "G:/"
|
||||
)
|
||||
set(GNUWIN32_DIR ${GNUWIN32_DIR_tmp})
|
||||
endif(NOT GNUWIN32_DIR)
|
||||
endif(NOT GNUWIN32_DIR)
|
||||
|
||||
if (GNUWIN32_DIR)
|
||||
set(GNUWIN32_INCLUDE_DIR ${GNUWIN32_DIR}/include)
|
||||
set(GNUWIN32_LIBRARY_DIR ${GNUWIN32_DIR}/lib)
|
||||
set(GNUWIN32_BINARY_DIR ${GNUWIN32_DIR}/bin)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GNUWIN32_INCLUDE_DIR})
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GNUWIN32_LIBRARY_DIR})
|
||||
set(GNUWIN32_FOUND TRUE)
|
||||
else (GNUWIN32_DIR)
|
||||
set(GNUWIN32_FOUND)
|
||||
endif (GNUWIN32_DIR)
|
||||
|
||||
if (GNUWIN32_FOUND)
|
||||
if (NOT GNUWIN32_FIND_QUIETLY)
|
||||
message(STATUS "Found GNUWIN32: ${GNUWIN32_DIR}")
|
||||
endif (NOT GNUWIN32_FIND_QUIETLY)
|
||||
else (GNUWIN32_FOUND)
|
||||
if (GNUWIN32_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find GNUWIN32")
|
||||
endif (GNUWIN32_FIND_REQUIRED)
|
||||
endif (GNUWIN32_FOUND)
|
||||
|
||||
endif (WIN32)
|
||||
|
@ -0,0 +1,32 @@
|
||||
# - Try to find the KBFX package -
|
||||
# If found the following will be defined
|
||||
#
|
||||
# KBFX_FOUND - KBFX package found on the system
|
||||
# KBFX_INCLUDE_DIR - Directory of the KBFX package include files
|
||||
# KBFX_LIBRARY - Where libkbfxplasma.so resides
|
||||
#
|
||||
|
||||
FIND_PATH(KBFX_INCLUDE_DIR kbfx/kbfxconfig.h
|
||||
PATHS
|
||||
${INCLUDE_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(KBFX_LIBRARY NAMES kbfxplasma
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
IF(KBFX_INCLUDE_DIR AND KBFX_LIBRARY)
|
||||
SET(KBFX_FOUND TRUE)
|
||||
ENDIF(KBFX_INCLUDE_DIR AND KBFX_LIBRARY)
|
||||
|
||||
IF(KBFX_FOUND)
|
||||
IF(NOT KBFX_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found KBFX package: ${KBFX_LIBRARY}")
|
||||
ENDIF(NOT KBFX_FIND_QUIETLY)
|
||||
ELSE(KBFX_FOUND)
|
||||
IF(KBFX_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find KBFX package! Please download and install KBFX from http://www.kbfx.org")
|
||||
ENDIF(KBFX_FIND_REQUIRED)
|
||||
ENDIF(KBFX_FOUND)
|
||||
|
@ -0,0 +1,40 @@
|
||||
# Find KDE4 and provide all necessary variables and macros to compile software for it.
|
||||
# It looks for KDE 4 in the following directories in the given order:
|
||||
# - CMAKE_INSTALL_PREFIX
|
||||
# - KDEDIR
|
||||
# - /opt/kde4
|
||||
# - /opt/kde
|
||||
#
|
||||
# Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more information.
|
||||
# They are installed with the KDE 4 libraries in $KDEDIR/share/apps/cmake/modules/.
|
||||
#
|
||||
# Author: Alexander Neundorf <neundorf@kde.org>
|
||||
# Modified by PhobosK <phobosk@mail.kbfx.org>
|
||||
|
||||
# For KDE4 kde-config has been renamed to kde4-config
|
||||
FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
|
||||
PATHS
|
||||
${BIN_SEARCH_PATHES}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
IF (NOT KDE4_KDECONFIG_EXECUTABLE)
|
||||
FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config )
|
||||
ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE)
|
||||
|
||||
IF (KDE4_KDECONFIG_EXECUTABLE)
|
||||
IF (KDE4_FIND_QUIETLY)
|
||||
SET(_quiet QUIET)
|
||||
ENDIF (KDE4_FIND_QUIETLY)
|
||||
|
||||
IF (KDE4_FIND_REQUIRED)
|
||||
SET(_req REQUIRED)
|
||||
ENDIF (KDE4_FIND_REQUIRED)
|
||||
|
||||
# use FindKDE4Internal.cmake to do the rest
|
||||
FIND_PACKAGE(KDE4Internal ${_req} ${_quiet})
|
||||
ELSE (KDE4_KDECONFIG_EXECUTABLE)
|
||||
IF (KDE4_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config")
|
||||
ENDIF (KDE4_FIND_REQUIRED)
|
||||
ENDIF (KDE4_KDECONFIG_EXECUTABLE)
|
||||
|
@ -0,0 +1,839 @@
|
||||
# - Find the KDE4 include and library dirs, KDE preprocessors and define a some macros
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# KDE4_FOUND - set to TRUE if everything required for building KDE software has been found
|
||||
#
|
||||
# KDE4_DEFINITIONS - compiler definitions required for compiling KDE software
|
||||
# KDE4_INCLUDE_DIR - the KDE 4 include directory
|
||||
# KDE4_INCLUDES - all include directories required for KDE, i.e.
|
||||
# KDE4_INCLUDE_DIR, but also the Qt4 include directories
|
||||
# and other platform specific include directories
|
||||
# KDE4_LIB_DIR - the directory where the KDE libraries are installed,
|
||||
# intended to be used with LINK_DIRECTORIES()
|
||||
#
|
||||
# The following variables are defined for the various tools required to
|
||||
# compile KDE software:
|
||||
#
|
||||
# KDE4_KCFGC_EXECUTABLE - the kconfig_compiler executable
|
||||
# KDE4_MEINPROC_EXECUTABLE - the meinproc executable
|
||||
# KDE4_MAKEKDEWIDGETS_EXECUTABLE - the makekdewidgets executable
|
||||
#
|
||||
# The following variables point to the location of the KDE libraries,
|
||||
# but shouldn't be used directly:
|
||||
#
|
||||
# KDE4_KDECORE_LIBRARY - the kdecore library
|
||||
# KDE4_KDEUI_LIBRARY - the kdeui library
|
||||
# KDE4_KIO_LIBRARY - the kio library
|
||||
# KDE4_KPARTS_LIBRARY - the kparts library
|
||||
# KDE4_KUTILS_LIBRARY - the kutils library
|
||||
# KDE4_KDE3SUPPORT_LIBRARY - the kde3support library
|
||||
# KDE4_KXMLCORE_LIBRARY - the kxmlcore library
|
||||
# KDE4_KHTML_LIBRARY - the khtml library
|
||||
# KDE4_KJS_LIBRARY - the kjs library
|
||||
# KDE4_KNEWSTUFF_LIBRARY - the knewstuff library
|
||||
# KDE4_KDEPRINT_LIBRARY - the kdeprint library
|
||||
# KDE4_KSPELL2_LIBRARY - the kspell2 library
|
||||
# KDE4_KDNSSD_LIBRARY - the kdnssd library
|
||||
# KDE4_PHONONCORE_LIBRARY - the phononcore library
|
||||
# KDE4_PHONONUI_LIBRARY - the phononui library
|
||||
# KDE4_KAUDIODEVICELIST_LIBRARY - the kaudiodevicelist library
|
||||
# KDE4_KDEFX_LIBRARY - the kdefx library
|
||||
# KDE4_THREADWEAVER_LIBRARY- the threadweaver library
|
||||
# KDE4_SOLID_LIBRARY - the solid library
|
||||
# KDE4_SOLIDIFACES_LIBRARY - the solidiface library
|
||||
# KDE4_KNOTIFYCONFIG_LIBRARY- the knotifyconfig library
|
||||
# KDE4_KROSSCORE_LIBRARY- the krosscore library
|
||||
# KDE4_KTEXTEDITOR_LIBRARY - the ktexteditor library
|
||||
# KDE4_KWALLETCLIENT_LIBRARY - the kwalletclient library
|
||||
#
|
||||
# Compared to the variables above, the following variables
|
||||
# also contain all of the depending libraries, so the variables below
|
||||
# should be used instead of the ones above:
|
||||
#
|
||||
# KDE4_KDECORE_LIBS - the kdecore library and all depending libraries
|
||||
# KDE4_KDEUI_LIBS - the kdeui library and all depending libraries
|
||||
# KDE4_KIO_LIBS - the kio library and all depending libraries
|
||||
# KDE4_KPARTS_LIBS - the kparts library and all depending libraries
|
||||
# KDE4_KUTILS_LIBS - the kutils library and all depending libraries
|
||||
# KDE4_KDE3SUPPORT_LIBS - the kde3support library and all depending libraries
|
||||
# KDE4_KXMLCORE_LIBS - the kxmlcore library and all depending libraries
|
||||
# KDE4_KHTML_LIBS - the khtml library and all depending libraries
|
||||
# KDE4_KJS_LIBS - the kjs library and all depending libraries
|
||||
# KDE4_KNEWSTUFF_LIBS - the knewstuff library and all depending libraries
|
||||
# KDE4_KDEPRINT_LIBS - the kdeprint library and all depending libraries
|
||||
# KDE4_KSPELL2_LIBS - the kspell2 library and all depending libraries
|
||||
# KDE4_KDNSSD_LIBS - the kdnssd library and all depending libraries
|
||||
# KDE4_KDESU_LIBS - the kdesu library and all depending libraries
|
||||
# KDE4_PHONONCORE_LIBS - the phononcore library and all depending librairies
|
||||
# KDE4_PHONONUI_LIBRARIES - the phononui library and all depending librairies
|
||||
# KDE4_KDEFX_LIBS - the kdefx library and all depending librairies
|
||||
# KDE4_THREADWEAVER_LIBRARIES- the threadweaver library and all depending libraries
|
||||
# KDE4_SOLID_LIBS - the solid library and all depending libraries
|
||||
# KDE4_SOLIDIFACES_LIBS - the solid iface library and all depending libraries
|
||||
# KDE4_KNOTIFYCONFIG_LIBS - the knotify config library and all depending libraries
|
||||
# KDE4_KROSSCORE_LIBS - the kross core library and all depending libraries
|
||||
# KDE4_KTEXTEDITOR_LIBS - the ktexteditor library and all depending libraries
|
||||
# KDE4_KWALLETCLIENT_LIBS - the kwallet client library and all depending libraries
|
||||
#
|
||||
# This module defines a bunch of variables used as locations
|
||||
# for install directories. They are all interpreted relative
|
||||
# to CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
# BIN_INSTALL_DIR - the directory where executables be installed (default is prefix/bin)
|
||||
# SBIN_INSTALL_DIR - the directory where system executables will be installed (default is prefix/sbin)
|
||||
# LIB_INSTALL_DIR - the directory where libraries will be installed (default is prefix/lib)
|
||||
# CONFIG_INSTALL_DIR - the config file install dir
|
||||
# DATA_INSTALL_DIR - the parent directory where applications can install their data
|
||||
# HTML_INSTALL_DIR - the HTML install dir for documentation
|
||||
# ICON_INSTALL_DIR - the icon install dir (default prefix/share/icons/)
|
||||
# INFO_INSTALL_DIR - the kde info install dir (default prefix/info)
|
||||
# KCFG_INSTALL_DIR - the install dir for kconfig files
|
||||
# LOCALE_INSTALL_DIR - the install dir for translations
|
||||
# MAN_INSTALL_DIR - the kde man page install dir (default prefix/man/)
|
||||
# MIME_INSTALL_DIR - the install dir for the mimetype desktop files
|
||||
# PLUGIN_INSTALL_DIR - the subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4)
|
||||
# SERVICES_INSTALL_DIR - the install dir for service (desktop, protocol, ...) files
|
||||
# SERVICETYPES_INSTALL_DIR - the install dir for servicestypes desktop files
|
||||
# SOUND_INSTALL_DIR - the install dir for sound files
|
||||
# TEMPLATES_INSTALL_DIR - the install dir for templates (Create new file...)
|
||||
# WALLPAPER_INSTALL_DIR - the install dir for wallpapers
|
||||
# KCONF_UPDATE_INSTALL_DIR - the kconf_update install dir
|
||||
# XDG_APPS_DIR - the XDG apps dir
|
||||
# XDG_DIRECTORY_DIR - the XDG directory
|
||||
# DBUS_INTERFACES_DIR - the directory where dbus interfaces be installed (default is prefix/share/dbus-1/interfaces
|
||||
#
|
||||
# The following variables are provided, but are seem to be unused:
|
||||
# LIBS_HTML_INSTALL_DIR /share/doc/HTML CACHE STRING "Is this still used ?")
|
||||
# APPLNK_INSTALL_DIR /share/applnk CACHE STRING "Is this still used ?")
|
||||
#
|
||||
# The following user adjustable options are provided:
|
||||
#
|
||||
# KDE4_ENABLE_FINAL - enable KDE-style enable-final all-in-one-compilation
|
||||
# KDE4_BUILD_TESTS - enable this to build the testcases
|
||||
# KDE4_ENABLE_FPIE - enable it to use gcc Position Independent Executables feature
|
||||
#
|
||||
# It also adds the following macros (from KDE4Macros.cmake)
|
||||
# KDE4_ADD_UI_FILES (SRCS_VAR file1.ui ... fileN.ui)
|
||||
# Use this to add Qt designer ui files to your application/library.
|
||||
#
|
||||
# KDE4_ADD_UI3_FILES (SRCS_VAR file1.ui ... fileN.ui)
|
||||
# Use this to add Qt designer ui files from Qt version 3 to your application/library.
|
||||
#
|
||||
# KDE4_ADD_KCFG_FILES (SRCS_VAR [GENERATE_MOC] file1.kcfgc ... fileN.kcfgc)
|
||||
# Use this to add KDE config compiler files to your application/library.
|
||||
# Use optional GENERATE_MOC to generate moc if you use signals in your kcfg files.
|
||||
#
|
||||
# KDE4_ADD_WIDGET_FILES (SRCS_VAR file1.widgets ... fileN.widgets)
|
||||
# Use this to add widget description files for the makekdewidgets code generator
|
||||
# for Qt Designer plugins.
|
||||
#
|
||||
# KDE4_AUTOMOC(file1 ... fileN)
|
||||
# Call this if you want to have automatic moc file handling.
|
||||
# This means if you include "foo.moc" in the source file foo.cpp
|
||||
# a moc file for the header foo.h will be created automatically.
|
||||
# You can set the property SKIP_AUTOMAKE using SET_SOURCE_FILES_PROPERTIES()
|
||||
# to exclude some files in the list from being processed.
|
||||
# If you don't want automoc, you can also use QT4_WRAP_CPP() or QT4_GENERATE_MOC()
|
||||
# from FindQt4.cmake to have the moc files generated. This will be faster
|
||||
# but require more manual work.
|
||||
#
|
||||
# KDE4_INSTALL_LIBTOOL_FILE ( subdir target )
|
||||
# This will create and install a simple libtool file for the
|
||||
# given target. This might be required for other software.
|
||||
# The libtool file will be install in subdir, relative to CMAKE_INSTALL_PREFIX .
|
||||
#
|
||||
# KDE4_CREATE_FINAL_FILES (filename_CXX filename_C file1 ... fileN)
|
||||
# This macro is intended mainly for internal uses.
|
||||
# It is used for enable-final. It will generate two source files,
|
||||
# one for the C files and one for the C++ files.
|
||||
# These files will have the names given in filename_CXX and filename_C.
|
||||
#
|
||||
# KDE4_ADD_PLUGIN ( name [WITH_PREFIX] file1 ... fileN )
|
||||
# Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
|
||||
# It supports KDE4_ENABLE_FINAL.
|
||||
# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.
|
||||
# It creates and installs an appropriate libtool la-file.
|
||||
#
|
||||
# KDE4_ADD_KDEINIT_EXECUTABLE (name [NOGUI] [RUN_UNINSTALLED] file1 ... fileN)
|
||||
# Create a KDE application in the form of a module loadable via kdeinit.
|
||||
# A library named kdeinit_<name> will be created and a small executable which links to it.
|
||||
# It supports KDE4_ENABLE_FINAL
|
||||
# If the executable has to be run from the buildtree (e.g. unit tests and code generators
|
||||
# used later on when compiling), set the option RUN_UNINSTALLED.
|
||||
# If the executable doesn't have a GUI, use the option NOGUI. By default on OS X
|
||||
# application bundles are created, with the NOGUI option no bundles but simple executables
|
||||
# are created. Currently it doesn't have any effect on other platforms.
|
||||
#
|
||||
# KDE4_ADD_EXECUTABLE (name [NOGUI] [RUN_UNINSTALLED] file1 ... fileN)
|
||||
# Equivalent to ADD_EXECUTABLE(), but additionally adds support for KDE4_ENABLE_FINAL.
|
||||
# If you don't need support for KDE4_ENABLE_FINAL, you can just use the
|
||||
# normal ADD_EXECUTABLE().
|
||||
# If the executable has to be run from the buildtree (e.g. unit tests and code generators
|
||||
# used later on when compiling), set the option RUN_UNINSTALLED.
|
||||
# If the executable doesn't have a GUI, use the option NOGUI. By default on OS X
|
||||
# application bundles are created, with the NOGUI option no bundles but simple executables
|
||||
# are created. Currently it doesn't have any effect on other platforms.
|
||||
#
|
||||
# KDE4_ADD_LIBRARY (name [STATIC | SHARED | MODULE ] file1 ... fileN)
|
||||
# Equivalent to ADD_LIBRARY(), but additionally it supports KDE4_ENABLE_FINAL
|
||||
# and under Windows it adds a -DMAKE_<name>_LIB definition to the compilation.
|
||||
#
|
||||
# KDE4_INSTALL_ICONS( path theme)
|
||||
# Installs all png and svgz files in the current directory to the icon
|
||||
# directoy given in path, in the subdirectory for the given icon theme.
|
||||
#
|
||||
# KDE4_CREATE_HANDBOOK( docbookfile )
|
||||
# Create the handbook from the docbookfile (using meinproc)
|
||||
#
|
||||
# KDE4_INSTALL_HANDBOOK()
|
||||
# Install the handbook documentation
|
||||
#
|
||||
# KDE4_CREATE_HTML_HANDBOOK( docbookfile )
|
||||
# Create HTML version of the handbook from the docbookfile (using meinproc)
|
||||
#
|
||||
# _KDE4_PLATFORM_INCLUDE_DIRS is used only internally
|
||||
# _KDE4_PLATFORM_DEFINITIONS is used only internally
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2006, Alexander Neundorf <neundorf@kde.org>
|
||||
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
# Modified by PhobosK <phobosk@mail.kbfx.org>
|
||||
|
||||
|
||||
INCLUDE (MacroEnsureVersion)
|
||||
|
||||
cmake_minimum_required(VERSION 2.4.3 FATAL_ERROR)
|
||||
|
||||
set(QT_MIN_VERSION "4.2.0")
|
||||
#this line includes FindQt4.cmake, which searches the Qt library and headers
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
if (NOT QT_DBUSXML2CPP_EXECUTABLE)
|
||||
message(FATAL_ERROR "Qt4 qdbusxml2cpp was not found. Make sure it has been built and installed by Qt")
|
||||
endif (NOT QT_DBUSXML2CPP_EXECUTABLE)
|
||||
|
||||
|
||||
# Perl is required for building KDE software,
|
||||
find_package(Perl REQUIRED)
|
||||
|
||||
# remove once we require cmake >= 2.4.4, then the REQUIRED flag is honored by FindPerl.cmake, Alex
|
||||
if(NOT PERL_FOUND)
|
||||
message(FATAL_ERROR "Perl was not found. Make sure it has installed on your system")
|
||||
endif(NOT PERL_FOUND)
|
||||
|
||||
include (MacroLibrary)
|
||||
include (CheckCXXCompilerFlag)
|
||||
|
||||
#add some KDE specific stuff
|
||||
|
||||
# the following are directories where stuff will be installed to
|
||||
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
|
||||
|
||||
|
||||
# this macro implements some very special logic how to deal with the cache
|
||||
# by default the various install locations inherit their value from theit "parent" variable
|
||||
# so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will
|
||||
# calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX
|
||||
# this would work completely without using the cache.
|
||||
# but if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into
|
||||
# the cache, otherwise it will be forgotten on the next cmake run.
|
||||
# Once a variable is in the cache, it doesn't depend on its "parent" variables
|
||||
# anymore and you can only change it by editing it directly.
|
||||
# this macro helps in this regard, because as long as you don't set one of the
|
||||
# variables explicitely to some location, it will always calculate its value from its
|
||||
# parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect.
|
||||
# But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location
|
||||
# this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX.
|
||||
macro(_SET_FANCY _var _value _comment)
|
||||
if (NOT DEFINED ${_var})
|
||||
set(${_var} ${_value})
|
||||
else (NOT DEFINED ${_var})
|
||||
set(${_var} "${${_var}}" CACHE PATH "${_comment}")
|
||||
endif (NOT DEFINED ${_var})
|
||||
endmacro(_SET_FANCY)
|
||||
|
||||
|
||||
_set_fancy(SHARE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/share "Base directory for files which go to share/")
|
||||
_set_fancy(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} "Base directory for executables and libraries")
|
||||
|
||||
_set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)")
|
||||
_set_fancy(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)")
|
||||
_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})")
|
||||
|
||||
_set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde4/libexec)")
|
||||
_set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)")
|
||||
|
||||
_set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix")
|
||||
_set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir")
|
||||
_set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data")
|
||||
_set_fancy(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" "The HTML install dir for documentation")
|
||||
_set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)")
|
||||
_set_fancy(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files")
|
||||
_set_fancy(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations")
|
||||
_set_fancy(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files")
|
||||
_set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files")
|
||||
_set_fancy(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files")
|
||||
_set_fancy(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files")
|
||||
_set_fancy(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)")
|
||||
_set_fancy(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers")
|
||||
_set_fancy(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir")
|
||||
# this one shouldn't be used anymore
|
||||
_set_fancy(APPLNK_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "Is this still used ?")
|
||||
_set_fancy(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files")
|
||||
|
||||
_set_fancy(XDG_APPS_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" "The XDG apps dir")
|
||||
_set_fancy(XDG_DIRECTORY_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory")
|
||||
|
||||
_set_fancy(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The kde sysconfig install dir (default /etc)")
|
||||
_set_fancy(MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/man" "The kde man install dir (default ${CMAKE_INSTALL_PREFIX}/man/)")
|
||||
_set_fancy(INFO_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/info" "The kde info install dir (default ${CMAKE_INSTALL_PREFIX}/info)")
|
||||
_set_fancy(DBUS_INTERFACES_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)")
|
||||
# _set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is /lib)")
|
||||
# _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/modules" "The subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4)")
|
||||
|
||||
|
||||
#################################
|
||||
|
||||
|
||||
# get the directory of the current file, used later on in the file
|
||||
get_filename_component( kde_cmake_module_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
# the following are directories where stuff will be installed to
|
||||
|
||||
|
||||
option(KDE4_ENABLE_FINAL "Enable final all-in-one compilation")
|
||||
option(KDE4_BUILD_TESTS "Build the tests")
|
||||
|
||||
if( KDE4_ENABLE_FINAL)
|
||||
add_definitions(-DKDE_USE_FINAL)
|
||||
endif(KDE4_ENABLE_FINAL)
|
||||
|
||||
#Position-Independent-Executable is a feature of Binutils, Libc, and GCC that creates an executable
|
||||
#which is something between a shared library and a normal executable.
|
||||
#Programs compiled with these features appear as ?shared object? with the file command.
|
||||
#info from "http://www.linuxfromscratch.org/hlfs/view/unstable/glibc/chapter02/pie.html"
|
||||
option(KDE4_ENABLE_FPIE "Enable platform supports PIE linking")
|
||||
|
||||
#now try to find some kde stuff
|
||||
|
||||
#are we trying to compile kdelibs ?
|
||||
#then enter bootstrap mode
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
|
||||
message(STATUS "Building kdelibs...")
|
||||
|
||||
set(KDE4_INCLUDE_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(KDE4_KDECORE_LIBS ${QT_QTCORE_LIBRARY} kdecore)
|
||||
set(KDE4_KDEUI_LIBS ${KDE4_KDECORE_LIBS} kdeui)
|
||||
set(KDE4_KIO_LIBS ${KDE4_KDEUI_LIBS} kio)
|
||||
set(KDE4_KPARTS_LIBS ${KDE4_KIO_LIBS} kparts)
|
||||
set(KDE4_KUTILS_LIBS ${KDE4_KIO_LIBS} kutils)
|
||||
set(KDE4_KDEFX_LIBS ${KDE4_KDEFX_LIBS} kdefx)
|
||||
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin )
|
||||
|
||||
if (WIN32)
|
||||
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH} )
|
||||
# CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC
|
||||
set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
|
||||
set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc )
|
||||
set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets )
|
||||
else (WIN32)
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib )
|
||||
set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler.shell )
|
||||
set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc.shell )
|
||||
set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets.shell )
|
||||
endif (WIN32)
|
||||
|
||||
set(KDE4_LIB_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
|
||||
|
||||
# when building kdelibs, make the kcfg rules depend on the binaries...
|
||||
set( _KDE4_KCONFIG_COMPILER_DEP kconfig_compiler)
|
||||
set( _KDE4_MAKEKDEWIDGETS_DEP makekdewidgets)
|
||||
set( _KDE4_MEINPROC_EXECUTABLE_DEP meinproc)
|
||||
|
||||
set(KDE4_INSTALLED_VERSION_OK TRUE)
|
||||
|
||||
else(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
|
||||
# ... but NOT otherwise
|
||||
set( _KDE4_KCONFIG_COMPILER_DEP)
|
||||
set( _KDE4_MAKEKDEWIDGETS_DEP)
|
||||
set( _KDE4_MEINPROC_EXECUTABLE_DEP)
|
||||
|
||||
# Check the version of kde. KDE4_KDECONFIG_EXECUTABLE was set by FindKDE4
|
||||
exec_program(${KDE4_KDECONFIG_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE kdeconfig_output )
|
||||
|
||||
string(REGEX MATCH "KDE: [0-9]+\\.[0-9]+\\.[0-9]+" KDEVERSION "${kdeconfig_output}")
|
||||
if (KDEVERSION)
|
||||
|
||||
string(REGEX REPLACE "^KDE: " "" KDEVERSION "${KDEVERSION}")
|
||||
|
||||
# we need at least this version:
|
||||
if (NOT KDE_MIN_VERSION)
|
||||
set(KDE_MIN_VERSION "3.9.0")
|
||||
endif (NOT KDE_MIN_VERSION)
|
||||
|
||||
#message(STATUS "KDE_MIN_VERSION=${KDE_MIN_VERSION} found ${KDEVERSION}")
|
||||
|
||||
macro_ensure_version( ${KDE_MIN_VERSION} ${KDEVERSION} KDE4_INSTALLED_VERSION_OK )
|
||||
|
||||
else (KDEVERSION)
|
||||
message(FATAL_ERROR "Couldn't parse KDE version string from the kde4-config output:\n${kdeconfig_output}")
|
||||
endif (KDEVERSION)
|
||||
|
||||
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib )
|
||||
|
||||
# this file contains all dependencies of all libraries of kdelibs, Alex
|
||||
include(${kde_cmake_module_dir}/KDELibsDependencies.cmake)
|
||||
|
||||
find_library(KDE4_KDECORE_LIBRARY NAMES kdecore PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDECORE_LIBS ${kdecore_LIB_DEPENDS} ${KDE4_KDECORE_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KDEFX_LIBRARY NAMES kdefx PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDEFX_LIBS ${kdefx_LIB_DEPENDS} ${KDE4_KDEFX_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KDEUI_LIBRARY NAMES kdeui PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDEUI_LIBS ${kdeui_LIB_DEPENDS} ${KDE4_KDEUI_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KIO_LIBRARY NAMES kio PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KIO_LIBS ${kio_LIB_DEPENDS} ${KDE4_KIO_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KPARTS_LIBRARY NAMES kparts PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KPARTS_LIBS ${kparts_LIB_DEPENDS} ${KDE4_KPARTS_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KUTILS_LIBRARY NAMES kutils PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KUTILS_LIBS ${kutils_LIB_DEPENDS} ${KDE4_KUTILS_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KDE3SUPPORT_LIBRARY NAMES kde3support PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDE3SUPPORT_LIBS ${kde3support_LIB_DEPENDS} ${KDE4_KDE3SUPPORT_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KHTML_LIBRARY NAMES khtml PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KHTML_LIBS ${khtml_LIB_DEPENDS} ${KDE4_KHTML_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KJS_LIBRARY NAMES kjs PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KJS_LIBS ${kjs_LIB_DEPENDS} ${KDE4_KJS_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KNEWSTUFF_LIBRARY NAMES knewstuff PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KNEWSTUFF_LIBS ${knewstuff_LIB_DEPENDS} ${KDE4_KNEWSTUFF_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KDEPRINT_LIBRARY NAMES kdeprint PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDEPRINT_LIBS ${kdeprint_LIB_DEPENDS} ${KDE4_KDEPRINT_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KSPELL2_LIBRARY NAMES kspell2 PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KSPELL2_LIBS ${kspell2_LIB_DEPENDS} ${KDE4_KSPELL2_LIBRARY} )
|
||||
|
||||
if (UNIX)
|
||||
find_library(KDE4_KDESU_LIBRARY NAMES kdesu PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDESU_LIBS ${kdesu_LIB_DEPENDS} ${KDE4_KDESU_LIBRARY} )
|
||||
endif (UNIX)
|
||||
|
||||
find_library(KDE4_KDNSSD_LIBRARY NAMES kdnssd PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KDNSSD_LIBS ${kdnssd_LIB_DEPENDS} ${KDE4_KDNSSD_LIBRARY} )
|
||||
|
||||
# now the KDE library directory, kxmlcore is new with KDE4
|
||||
find_library(KDE4_KXMLCORE_LIBRARY NAMES kxmlcore PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_KXMLCORE_LIBRARIES ${kxmlcore_LIB_DEPENDS} ${KDE4_KXMLCORE_LIBRARY} )
|
||||
|
||||
find_library(KDE4_PHONONCORE_LIBRARY NAMES phononcore PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_PHONONCORE_LIBS ${phononcore_LIB_DEPENDS} ${KDE4_PHONONCORE_LIBRARY} )
|
||||
|
||||
find_library(KDE4_PHONONUI_LIBRARY NAMES phononui PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_PHONONUI_LIBS ${phononui_LIB_DEPENDS} ${KDE4_PHONONUI_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KAUDIODEVICELIST_LIBRARY NAMES kaudiodevicelist PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH )
|
||||
set(KDE4_KAUDIODEVICELIST_LIBS ${kaudiodevicelist_LIB_DEPENDS} ${KDE4_KAUDIODEVICELIST_LIBRARY} )
|
||||
|
||||
find_library(KDE4_SOLID_LIBRARY NAMES solid PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_SOLID_LIBS ${solid_LIB_DEPENDS} ${KDE4_SOLID_LIBRARY} )
|
||||
|
||||
find_library(KDE4_SOLIDIFACES_LIBRARY NAMES solidifaces PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_SOLIDIFACES_LIBS ${solidifaces_LIB_DEPENDS} ${KDE4_SOLIDIFACES_LIBRARY} )
|
||||
|
||||
find_library(KDE4_THREADWEAVER_LIBRARY NAMES threadweaver PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_THREADWEAVER_LIBRARIES ${threadweaver_LIB_DEPENDS} ${KDE4_THREADWEAVER_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KNOTIFYCONFIG_LIBRARY NAMES knotifyconfig PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_KNOTIFYCONFIG_LIBS ${knotifyconfig_LIB_DEPENDS} ${KDE4_KNOTIFYCONFIG_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KROSSCORE_LIBRARY NAMES krosscore PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_KROSSCORE_LIBS ${krosscore_LIB_DEPENDS} ${KDE4_KROSSCORE_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KTEXTEDITOR_LIBRARY NAMES ktexteditor PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_KTEXTEDITOR_LIBS ${ktexteditor_LIB_DEPENDS} ${KDE4_KTEXTEDITOR_LIBRARY} )
|
||||
|
||||
find_library(KDE4_KWALLETCLIENT_LIBRARY NAMES kwalletclient PATHS ${KDE4_LIB_INSTALL_DIR} )
|
||||
set(KDE4_KWALLETCLIENT_LIBS ${kwalletclient_LIB_DEPENDS} ${KDE4_KWALLETCLIENT_LIBRARY} )
|
||||
|
||||
get_filename_component(KDE4_LIB_DIR ${KDE4_KDECORE_LIBRARY} PATH )
|
||||
|
||||
|
||||
# at first the KDE include direcory
|
||||
# kpassworddialog.h is new with KDE4
|
||||
find_path(KDE4_INCLUDE_DIR kpassworddialog.h
|
||||
${KDE4_INCLUDE_INSTALL_DIR}
|
||||
$ENV{KDEDIR}/include
|
||||
/opt/kde/include
|
||||
/opt/kde4/include
|
||||
/usr/local/include
|
||||
/usr/include/
|
||||
/usr/include/kde
|
||||
/usr/local/include/kde
|
||||
)
|
||||
|
||||
find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS
|
||||
${KDE4_BIN_INSTALL_DIR}
|
||||
$ENV{KDEDIR}/bin
|
||||
/opt/kde/bin
|
||||
/opt/kde4/bin
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler )
|
||||
|
||||
find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc PATHS
|
||||
${KDE4_BIN_INSTALL_DIR}
|
||||
$ENV{KDEDIR}/bin
|
||||
/opt/kde/bin
|
||||
/opt/kde4/bin
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc )
|
||||
|
||||
find_program(KDE4_MAKEKDEWIDGETS_EXECUTABLE NAME makekdewidgets PATHS
|
||||
${KDE4_BIN_INSTALL_DIR}
|
||||
$ENV{KDEDIR}/bin
|
||||
/opt/kde/bin
|
||||
/opt/kde4/bin
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_program(KDE4_MAKEKDEWIDGETS_EXECUTABLE NAME makekdewidgets )
|
||||
|
||||
endif(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
|
||||
|
||||
##################### and now the platform specific stuff ############################
|
||||
|
||||
# Set a default build type for single-configuration
|
||||
# CMake generators if no build type is set.
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
|
||||
if(CYGWIN)
|
||||
message(FATAL_ERROR "Support for Cygwin NOT yet implemented, please edit FindKDE4.cmake to enable it")
|
||||
endif(CYGWIN)
|
||||
|
||||
find_package(KDEWIN32 REQUIRED)
|
||||
|
||||
# is GnuWin32 required or does e.g. Visual Studio provide an own implementation?
|
||||
#find_package(GNUWIN32 REQUIRED)
|
||||
find_package(GNUWIN32)
|
||||
|
||||
set( _KDE4_PLATFORM_INCLUDE_DIRS ${KDEWIN32_INCLUDES} ${GNUWIN32_INCLUDE_DIR})
|
||||
|
||||
# if we are compiling kdelibs, add KDEWIN32_LIBRARIES explicitely,
|
||||
# otherwise they come from KDELibsDependencies.cmake, Alex
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
set( KDE4_KDECORE_LIBS ${KDE4_KDECORE_LIBS} ${KDEWIN32_LIBRARIES} )
|
||||
endif(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
|
||||
# windows, mingw
|
||||
if(MINGW)
|
||||
#hmmm, something special to do here ?
|
||||
endif(MINGW)
|
||||
|
||||
# windows, microsoft compiler
|
||||
if(MSVC)
|
||||
set( _KDE4_PLATFORM_DEFINITIONS -DKDE_FULL_TEMPLATE_EXPORT_INSTANTIATION -DWIN32_LEAN_AND_MEAN -DUNICODE )
|
||||
# C4250: 'class1' : inherits 'class2::member' via dominance
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4250" )
|
||||
# C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4251" )
|
||||
if(CMAKE_COMPILER_2005)
|
||||
# to avoid a lot of deprecated warnings
|
||||
add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE )
|
||||
# 'identifier' : no suitable definition provided for explicit template instantiation request
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4661" )
|
||||
endif(CMAKE_COMPILER_2005)
|
||||
endif(MSVC)
|
||||
|
||||
|
||||
# for visual studio IDE set the path correctly for custom commands
|
||||
# maybe under windows bat-files should be generated for running apps during the build
|
||||
if(MSVC_IDE)
|
||||
get_filename_component(PERL_LOCATION "${PERL_EXECUTABLE}" PATH)
|
||||
file(TO_NATIVE_PATH "${PERL_LOCATION}" PERL_PATH_WINDOWS)
|
||||
file(TO_NATIVE_PATH "${QT_BINARY_DIR}" QT_BIN_DIR_WINDOWS)
|
||||
set(CMAKE_MSVCIDE_RUN_PATH "${PERL_PATH_WINDOWS}\;${QT_BIN_DIR_WINDOWS}"
|
||||
CACHE STATIC "MSVC IDE Run path" FORCE)
|
||||
endif(MSVC_IDE)
|
||||
|
||||
endif (WIN32)
|
||||
|
||||
|
||||
# also use /usr/local by default under UNIX, including Mac OS X
|
||||
if (UNIX)
|
||||
option(KDE4_USE_ALWAYS_FULL_RPATH "If set to TRUE, also libs and plugins will be linked with the full RPATH, which will usually make them work better, but make install will take longer." OFF)
|
||||
|
||||
link_directories(/usr/local/lib)
|
||||
set( _KDE4_PLATFORM_INCLUDE_DIRS /usr/local/include )
|
||||
|
||||
# the rest is RPATH handling
|
||||
# here the defaults are set
|
||||
# which are partly overwritten in kde4_handle_rpath_for_library()
|
||||
# and kde4_handle_rpath_for_executable(), both located in KDE4Macros.cmake, Alex
|
||||
if (APPLE)
|
||||
set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
|
||||
else (APPLE)
|
||||
# add our LIB_INSTALL_DIR to the RPATH and use the RPATH figured out by cmake when compiling
|
||||
set(CMAKE_INSTALL_RPATH ${LIB_INSTALL_DIR} )
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif (APPLE)
|
||||
endif (UNIX)
|
||||
|
||||
|
||||
# UNIX, except OS X
|
||||
if (UNIX AND NOT APPLE)
|
||||
# Done by FindQt4.cmake already
|
||||
#find_package(X11 REQUIRED)
|
||||
# UNIX has already set _KDE4_PLATFORM_INCLUDE_DIRS, so append
|
||||
set(_KDE4_PLATFORM_INCLUDE_DIRS ${_KDE4_PLATFORM_INCLUDE_DIRS} ${X11_INCLUDE_DIR} )
|
||||
endif (UNIX AND NOT APPLE)
|
||||
|
||||
|
||||
# This will need to be modified later to support either Qt/X11 or Qt/Mac builds
|
||||
if (APPLE)
|
||||
|
||||
set ( _KDE4_PLATFORM_DEFINITIONS -D__APPLE_KDE__ )
|
||||
|
||||
# we need to set MACOSX_DEPLOYMENT_TARGET to (I believe) at least 10.2 or maybe 10.3 to allow
|
||||
# -undefined dynamic_lookup; in the future we should do this programmatically
|
||||
# hmm... why doesn't this work?
|
||||
set (ENV{MACOSX_DEPLOYMENT_TARGET} 10.3)
|
||||
|
||||
# "-undefined dynamic_lookup" means we don't care about missing symbols at link-time by default
|
||||
# this is bad, but unavoidable until there is the equivalent of libtool -no-undefined implemented
|
||||
# or perhaps it already is, and I just don't know where to look ;)
|
||||
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-single_module -multiply_defined suppress ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set (CMAKE_MODULE_LINKER_FLAGS "-multiply_defined suppress ${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
#set(CMAKE_SHARED_LINKER_FLAGS "-single_module -undefined dynamic_lookup -multiply_defined suppress")
|
||||
#set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup -multiply_defined suppress")
|
||||
|
||||
# we profile...
|
||||
if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile)
|
||||
|
||||
# removed -Os, was there a special reason for using -Os instead of -O2 ?, Alex
|
||||
# optimization flags are set below for the various build types
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common")
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE)
|
||||
set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
# we profile...
|
||||
if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
if (CMAKE_C_COMPILER MATCHES "icc")
|
||||
set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE)
|
||||
set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
endif (CMAKE_C_COMPILER MATCHES "icc")
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
set ( _KDE4_PLATFORM_DEFINITIONS -D_GNU_SOURCE )
|
||||
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lc")
|
||||
set ( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lc")
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
|
||||
# compiler specific stuff, maybe this should be done differently, Alex
|
||||
|
||||
if (MSVC)
|
||||
set (KDE4_ENABLE_EXCEPTIONS -EHsc)
|
||||
endif(MSVC)
|
||||
|
||||
if (MINGW)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
|
||||
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols")
|
||||
endif (MINGW)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (KDE4_ENABLE_EXCEPTIONS -fexceptions)
|
||||
# Select flags.
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
|
||||
set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
|
||||
set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
|
||||
set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
|
||||
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common")
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
|
||||
|
||||
check_cxx_compiler_flag(-fPIE HAVE_FPIE_SUPPORT)
|
||||
if(KDE4_ENABLE_FPIE)
|
||||
if(HAVE_FPIE_SUPPORT)
|
||||
set (KDE4_CXX_FPIE_FLAGS "-fPIE")
|
||||
set (KDE4_PIE_LDFLAGS "-pie")
|
||||
else(HAVE_FPIE_SUPPORT)
|
||||
MESSAGE(STATUS "Your compiler doesn't support PIE flag")
|
||||
endif(HAVE_FPIE_SUPPORT)
|
||||
endif(KDE4_ENABLE_FPIE)
|
||||
# visibility support
|
||||
check_cxx_compiler_flag(-fvisibility=hidden __KDE_HAVE_GCC_VISIBILITY)
|
||||
|
||||
# get the gcc version
|
||||
exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
|
||||
|
||||
string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
|
||||
# gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
|
||||
if (NOT _gcc_version)
|
||||
string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
|
||||
endif (NOT _gcc_version)
|
||||
|
||||
macro_ensure_version("4.1.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_1)
|
||||
|
||||
set(_GCC_COMPILED_WITH_BAD_ALLOCATOR FALSE)
|
||||
if (GCC_IS_NEWER_THAN_4_1)
|
||||
exec_program(${CMAKE_C_COMPILER} ARGS -v OUTPUT_VARIABLE _gcc_alloc_info)
|
||||
string(REGEX MATCH "(--enable-libstdcxx-allocator=mt)" _GCC_COMPILED_WITH_BAD_ALLOCATOR "${_gcc_alloc_info}")
|
||||
endif (GCC_IS_NEWER_THAN_4_1)
|
||||
|
||||
if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||||
else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
|
||||
set (__KDE_HAVE_GCC_VISIBILITY 0)
|
||||
endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
|
||||
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if (CMAKE_C_COMPILER MATCHES "icc")
|
||||
set (KDE4_ENABLE_EXCEPTIONS -fexceptions)
|
||||
# Select flags.
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign")
|
||||
set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign")
|
||||
set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi -Wpointer-arith -fno-common")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -Wpointer-arith -fno-exceptions -fno-common")
|
||||
|
||||
# visibility support
|
||||
set(__KDE_HAVE_ICC_VISIBILITY)
|
||||
# check_cxx_compiler_flag(-fvisibility=hidden __KDE_HAVE_ICC_VISIBILITY)
|
||||
# if (__KDE_HAVE_ICC_VISIBILITY)
|
||||
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
# endif (__KDE_HAVE_ICC_VISIBILITY)
|
||||
|
||||
endif (CMAKE_C_COMPILER MATCHES "icc")
|
||||
|
||||
# we prefer to use a different postfix for debug libs only on Windows
|
||||
# does not work atm
|
||||
if (WIN32)
|
||||
SET(CMAKE_DEBUG_POSTFIX "")
|
||||
endif (WIN32)
|
||||
|
||||
########### end of platform specific stuff ##########################
|
||||
|
||||
|
||||
# KDE4Macros.cmake contains all the KDE specific macros
|
||||
#include(${kde_cmake_module_dir}/KDE4Macros.cmake)
|
||||
include(KDE4Macros)
|
||||
|
||||
|
||||
# decide whether KDE4 has been found
|
||||
set(KDE4_FOUND FALSE)
|
||||
if (KDE4_INCLUDE_DIR AND KDE4_LIB_DIR AND KDE4_KCFGC_EXECUTABLE AND KDE4_INSTALLED_VERSION_OK)
|
||||
set(KDE4_FOUND TRUE)
|
||||
endif (KDE4_INCLUDE_DIR AND KDE4_LIB_DIR AND KDE4_KCFGC_EXECUTABLE AND KDE4_INSTALLED_VERSION_OK)
|
||||
|
||||
|
||||
macro (KDE4_PRINT_RESULTS)
|
||||
|
||||
# inside kdelibs the include dir and lib dir are internal, not "found"
|
||||
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
if(KDE4_INCLUDE_DIR)
|
||||
message(STATUS "Found KDE4 include dir: ${KDE4_INCLUDE_DIR}")
|
||||
else(KDE4_INCLUDE_DIR)
|
||||
message(STATUS "Didn't find KDE4 headers")
|
||||
endif(KDE4_INCLUDE_DIR)
|
||||
|
||||
if(KDE4_LIB_DIR)
|
||||
message(STATUS "Found KDE4 library dir: ${KDE4_LIB_DIR}")
|
||||
else(KDE4_LIB_DIR)
|
||||
message(STATUS "Didn't find KDE4 core library")
|
||||
endif(KDE4_LIB_DIR)
|
||||
endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h)
|
||||
|
||||
if(KDE4_KCFGC_EXECUTABLE)
|
||||
message(STATUS "Found KDE4 kconfig_compiler preprocessor: ${KDE4_KCFGC_EXECUTABLE}")
|
||||
else(KDE4_KCFGC_EXECUTABLE)
|
||||
message(STATUS "Didn't find the KDE4 kconfig_compiler preprocessor")
|
||||
endif(KDE4_KCFGC_EXECUTABLE)
|
||||
endmacro (KDE4_PRINT_RESULTS)
|
||||
|
||||
|
||||
if (KDE4Internal_FIND_REQUIRED AND NOT KDE4_FOUND)
|
||||
#bail out if something wasn't found
|
||||
kde4_print_results()
|
||||
if (NOT KDE4_INSTALLED_VERSION_OK)
|
||||
message(FATAL_ERROR "ERROR: the installed kdelibs version ${KDEVERSION} is too old, at least version ${KDE_MIN_VERSION} is required")
|
||||
else (NOT KDE4_INSTALLED_VERSION_OK)
|
||||
message(FATAL_ERROR "ERROR: could NOT find everything required for compiling KDE 4 programs")
|
||||
endif (NOT KDE4_INSTALLED_VERSION_OK)
|
||||
endif (KDE4Internal_FIND_REQUIRED AND NOT KDE4_FOUND)
|
||||
|
||||
|
||||
if (NOT KDE4Internal_FIND_QUIETLY)
|
||||
kde4_print_results()
|
||||
endif (NOT KDE4Internal_FIND_QUIETLY)
|
||||
|
||||
#add the found Qt and KDE include directories to the current include path
|
||||
#the ${KDE4_INCLUDE_DIR}/KDE directory is for forwarding includes, eg. #include <KMainWindow>
|
||||
set(KDE4_INCLUDES ${QT_INCLUDES} ${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}/KDE ${_KDE4_PLATFORM_INCLUDE_DIRS} )
|
||||
|
||||
set(KDE4_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS} -DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS )
|
||||
|
||||
if (NOT _kde4_uninstall_rule_created)
|
||||
set(_kde4_uninstall_rule_created TRUE)
|
||||
|
||||
configure_file("${kde_cmake_module_dir}/kde4_cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY)
|
||||
|
||||
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
|
||||
endif (NOT _kde4_uninstall_rule_created)
|
@ -0,0 +1,89 @@
|
||||
# - Try to find the KDEWIN32 library
|
||||
# Once done this will define
|
||||
#
|
||||
# KDEWIN32_FOUND - system has KDEWIN32
|
||||
# KDEWIN32_INCLUDES - the KDEWIN32 include directories
|
||||
# KDEWIN32_LIBRARIES - The libraries needed to use KDEWIN32
|
||||
#
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
if (WIN32)
|
||||
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
|
||||
|
||||
if(NOT QT4_FOUND)
|
||||
find_package(Qt4 REQUIRED)
|
||||
endif(NOT QT4_FOUND)
|
||||
|
||||
find_path(KDEWIN32_INCLUDE_DIR winposix_export.h
|
||||
${_program_FILES_DIR}/kdewin32/include ${CMAKE_INSTALL_PREFIX}/include
|
||||
)
|
||||
|
||||
|
||||
# at first find the kdewin32 library, this has to be compiled and installed before kdelibs/
|
||||
# search for kdewin32 in the default install directory for applications (default of (n)make install)
|
||||
|
||||
set(KDEWIN32_LIBRARY_PATH ${_program_FILES_DIR}/kdewin32/lib)
|
||||
find_library(KDEWIN32_LIBRARY_RELEASE NAMES kdewin32
|
||||
PATHS
|
||||
${KDEWIN32_LIBRARY_PATH} ${CMAKE_INSTALL_PREFIX}/lib
|
||||
)
|
||||
|
||||
# msvc makes a difference between debug and release
|
||||
if(MSVC)
|
||||
find_library(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d
|
||||
PATHS
|
||||
${_program_FILES_DIR}/kdewin32/lib ${CMAKE_INSTALL_PREFIX}/lib
|
||||
)
|
||||
if(MSVC_IDE)
|
||||
# the ide needs the debug and release version
|
||||
if( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE)
|
||||
message(FATAL_ERROR "\nCould NOT find the debug AND release version of the KDEWIN32 library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n")
|
||||
endif( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE)
|
||||
SET(KDEWIN32_LIBRARY optimized ${KDEWIN32_LIBRARY_RELEASE} debug ${KDEWIN32_LIBRARY_DEBUG})
|
||||
else(MSVC_IDE)
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
|
||||
if(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
|
||||
set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_DEBUG})
|
||||
else(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
|
||||
set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE})
|
||||
endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
|
||||
endif(MSVC_IDE)
|
||||
else(MSVC)
|
||||
set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE})
|
||||
endif(MSVC)
|
||||
|
||||
# kdelibs/win/ has to be built before the rest of kdelibs/
|
||||
# eventually it will be moved out from kdelibs/
|
||||
if (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR)
|
||||
set(KDEWIN32_FOUND TRUE)
|
||||
# add needed system libs
|
||||
set(KDEWIN32_LIBRARIES ${KDEWIN32_LIBRARY} user32 shell32 ws2_32)
|
||||
|
||||
if (MINGW)
|
||||
#mingw compiler
|
||||
set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/mingw ${QT_INCLUDES})
|
||||
else (MINGW)
|
||||
# msvc compiler
|
||||
# add the MS SDK include directory if available
|
||||
file(TO_CMAKE_PATH "$ENV{MSSDK}" MSSDK_DIR)
|
||||
set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/msvc ${QT_INCLUDES} ${MSSDK_DIR})
|
||||
endif (MINGW)
|
||||
|
||||
endif (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR)
|
||||
|
||||
if (KDEWIN32_FOUND)
|
||||
if (NOT KDEWIN32_FIND_QUIETLY)
|
||||
message(STATUS "Found KDEWIN32: ${KDEWIN32_LIBRARY}")
|
||||
endif (NOT KDEWIN32_FIND_QUIETLY)
|
||||
else (KDEWIN32_FOUND)
|
||||
if (KDEWIN32_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find KDEWIN32 library\nPlease build and install kdelibs/win/ first")
|
||||
endif (KDEWIN32_FIND_REQUIRED)
|
||||
endif (KDEWIN32_FOUND)
|
||||
|
||||
endif (WIN32)
|
@ -0,0 +1,316 @@
|
||||
#INCLUDE(FindQt3)
|
||||
#INCLUDE(FindQt)
|
||||
#INCLUDE(FindKDE3)
|
||||
INCLUDE(kdesvnMacros)
|
||||
INCLUDE(KDE3Macros)
|
||||
|
||||
FILE(GLOB GLOB_PATHS_INCLUDE /usr/lib*/qt-3*/include/)
|
||||
FIND_PROGRAM(PKG_CONFIG NAMES pkg-config)
|
||||
EXECUTE_PROCESS(COMMAND ${PKG_CONFIG} "--variable=prefix" "qt-mt"
|
||||
OUTPUT_VARIABLE _qt_mt_path
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
SET(QT_MT_PATH ${_qt_mt_path} CACHE STRING "QT Path" FORCE)
|
||||
FIND_PATH(QT_INCLUDE_DIR_PLUS qt.h
|
||||
${GLOB_PATHS_INCLUDE}
|
||||
${QT_MT_PATH}/include)
|
||||
IF (NOT QT_INCLUDE_DIR)
|
||||
SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR_PLUS})
|
||||
ENDIF (NOT QT_INCLUDE_DIR)
|
||||
|
||||
FIND_PROGRAM(CMAKE_UNAME uname ${BIN_SEARCH_PATHES})
|
||||
IF(CMAKE_UNAME)
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_UNAME} "-m"
|
||||
OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
IF("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "64")
|
||||
SET(LIB_SUFFIX "64" CACHE STRING "Define suffix of directory name (32/64)" FORCE)
|
||||
ELSE("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "64")
|
||||
SET(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" FORCE)
|
||||
ENDIF("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "64")
|
||||
ENDIF(CMAKE_UNAME)
|
||||
|
||||
SET(INCLUDE_SEARCH_PATHES
|
||||
${INCLUDE_SEARCH_PATHES}
|
||||
${KDE3_INCLUDE_DIRS})
|
||||
|
||||
SET(LIB_SEARCH_PATHES
|
||||
${LIB_SEARCH_PATHES}
|
||||
${KDE3_LIB_DIR})
|
||||
|
||||
IF (LIB_SUFFIX)
|
||||
SET(LIB_SEARCH_PATHES
|
||||
$ENV{KDEDIR}/lib${LIB_SUFFIX}
|
||||
$ENV{HOME}/lib${LIB_SUFFIX}
|
||||
$ENV{HOME}/usr/lib${LIB_SUFFIX}
|
||||
/opt/lib${LIB_SUFFIX}
|
||||
/opt/kde/lib${LIB_SUFFIX}
|
||||
/opt/kde3/lib${LIB_SUFFIX}
|
||||
/usr/lib${LIB_SUFFIX}
|
||||
/usr/kde/3.5/lib${LIB_SUFFIX}
|
||||
/usr/local/lib${LIB_SUFFIX}
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
ENDIF (LIB_SUFFIX)
|
||||
|
||||
|
||||
|
||||
FIND_LIBRARY(M_LIBRARY NAMES m
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(KDE3_UI_LIBRARY NAMES kdeui
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(KDE3_PART_LIBRARY NAMES kparts
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(KDE3_KIO_LIBRARY NAMES kio
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(KDE3_KHTML_LIBRARY NAMES khtml
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(KDE3_DCOP_LIBRARY NAMES DCOP
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_PROGRAM(KDE3_KDECONFIG_EXECUTABLE NAME kde-config
|
||||
PATHS ${BIN_SEARCH_PATHES})
|
||||
|
||||
FIND_PROGRAM(MSGFMT
|
||||
NAMES gmsgfmt msgfmt
|
||||
PATHS ${BIN_SEARCH_PATHES})
|
||||
|
||||
|
||||
FIND_PROGRAM(STRIP
|
||||
NAMES strip
|
||||
PATHS ${BIN_SEARCH_PATHES})
|
||||
|
||||
FIND_PROGRAM(KDE3_MEINPROC_EXECUTABLE NAME meinproc
|
||||
PATHS ${BIN_SEARCH_PATHES})
|
||||
|
||||
IF(KDE3_MEINPROC_EXECUTABLE)
|
||||
MESSAGE(STATUS "Found meinproc: ${KDE3_MEINPROC_EXECUTABLE}")
|
||||
ELSE(KDE3_MEINPROC_EXECUTABLE)
|
||||
MESSAGE(FATAL_ERROR "Could NOT find meinproc program!")
|
||||
ENDIF(KDE3_MEINPROC_EXECUTABLE)
|
||||
|
||||
IF(MSGFMT)
|
||||
EXECUTE_PROCESS(COMMAND ${MSGFMT} "--version"
|
||||
OUTPUT_VARIABLE _msgout
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
STRING(REGEX MATCH "GNU[\t ]gettext" _isgnu "${_msgout}")
|
||||
IF (NOT _isgnu)
|
||||
MESSAGE(STATUS "No gnu msgfmt found!")
|
||||
SET(MSGFMT ":" CACHE STRING "Msgfmt program")
|
||||
ELSE(NOT _isgnu)
|
||||
MESSAGE(STATUS "Found gnu msgfmt: ${MSGFMT}")
|
||||
ENDIF (NOT _isgnu)
|
||||
ELSE(MSGFMT)
|
||||
SET(MSGFMT ":" CACHE STRING "Msgfmt program")
|
||||
MESSAGE( FATAL_ERROR "Could NOT find msgfmt program")
|
||||
ENDIF(MSGFMT)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${KDE3_KDECONFIG_EXECUTABLE} "--prefix"
|
||||
COMMAND xargs "echo" "-n"
|
||||
OUTPUT_VARIABLE _kde_prefix_path
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
SET(KDE_HTML_COMMON_PATH ${_kde_prefix_path}/share/doc/HTML/en/common CACHE STRING "KDE HTML common Path" FORCE)
|
||||
|
||||
# 'cause my own defines were not good I take them from kde4 trunk
|
||||
#add some KDE specific stuff
|
||||
SET(SHARE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "Base directory for files which go to share/" FORCE)
|
||||
SET(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Base directory for executables and libraries" FORCE)
|
||||
#
|
||||
## the following are directories where stuff will be installed to
|
||||
SET(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The kde bin install dir (default prefix/bin)" FORCE)
|
||||
SET(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" CACHE PATH "The kde sbin install dir (default prefix/sbin)" FORCE)
|
||||
SET(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
|
||||
SET(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib/kde3/libexec)" FORCE)
|
||||
SET(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" FORCE)
|
||||
SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE)
|
||||
SET(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" CACHE PATH "The config file install dir" FORCE)
|
||||
SET(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" CACHE PATH "The parent directory where applications can install their data" FORCE)
|
||||
SET(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" CACHE PATH "The HTML install dir for documentation" FORCE)
|
||||
SET(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" CACHE PATH "The icon install dir (default prefix/share/icons/)" FORCE)
|
||||
SET(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" CACHE PATH "The install dir for kconfig files" FORCE)
|
||||
SET(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" CACHE PATH "The install dir for translations" FORCE)
|
||||
SET(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" CACHE PATH "The install dir for the mimetype desktop files" FORCE)
|
||||
SET(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" CACHE PATH "The install dir for service (desktop, protocol, ...) files" FORCE)
|
||||
SET(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" CACHE PATH "The install dir for servicestypes desktop files" FORCE)
|
||||
SET(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" CACHE PATH "The install dir for sound files" FORCE)
|
||||
SET(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" CACHE PATH "The install dir for templates (Create new file...)" FORCE)
|
||||
SET(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" CACHE PATH "The install dir for wallpapers" FORCE)
|
||||
SET(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" CACHE PATH "The kconf_update install dir" FORCE)
|
||||
# this one shouldn't be used anymore
|
||||
SET(APPLNK_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" CACHE PATH "Is this still used ?" FORCE)
|
||||
SET(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" CACHE PATH "The install dir for autostart files" FORCE)
|
||||
SET(XDG_APPS_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" CACHE PATH "The XDG apps dir" FORCE)
|
||||
SET(XDG_DIRECTORY_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" CACHE PATH "The XDG directory" FORCE)
|
||||
SET(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "The kde sysconfig install dir (default/etc)" FORCE)
|
||||
SET(MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" CACHE PATH "The kde man install dir (default prefix/share/man/)" FORCE)
|
||||
SET(INFO_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/info" CACHE PATH "The kde info install dir (default prefix/info)" FORCE)
|
||||
|
||||
# linker flags - must get checked
|
||||
SET(LINK_NO_UNDEFINED "")
|
||||
SET(lundef "-Wl,--no-undefined")
|
||||
KDESVN_CHECK_LINK_FLAG(${lundef} _NO_UNDEFINED)
|
||||
IF (_NO_UNDEFINED)
|
||||
SET(LINK_NO_UNDEFINED "${lundef}")
|
||||
ENDIF (_NO_UNDEFINED)
|
||||
|
||||
SET(lundef "-Wl,--allow-shlib-undefined")
|
||||
KDESVN_CHECK_LINK_FLAG(${lundef} _ALLOW_SHLIB)
|
||||
IF (_ALLOW_SHLIB)
|
||||
SET(LINK_NO_UNDEFINED "${LINK_NO_UNDEFINED} ${lundef}")
|
||||
ENDIF (_ALLOW_SHLIB)
|
||||
|
||||
|
||||
# own macros
|
||||
MACRO(KDESVN_INSTALL_ICONS _theme)
|
||||
|
||||
FILE(GLOB _icons *.png)
|
||||
FILE(GLOB _svg *svgz)
|
||||
SET(_icons ${_icons} ${_svg})
|
||||
FOREACH(_current_ICON ${_icons} )
|
||||
GET_FILENAME_COMPONENT(_ctype ${_current_ICON} EXT)
|
||||
|
||||
IF (${_ctype} STREQUAL ".png")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
|
||||
SET(_sizestring "${_size}x${_size}")
|
||||
ENDIF (${_ctype} STREQUAL ".png")
|
||||
|
||||
IF (${_ctype} STREQUAL ".svgz")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}")
|
||||
SET(_sizestring "scalable")
|
||||
ENDIF (${_ctype} STREQUAL ".svgz")
|
||||
|
||||
SET(_icon_GROUP "actions")
|
||||
|
||||
IF(${_group} STREQUAL "mime")
|
||||
SET(_icon_GROUP "mimetypes")
|
||||
ENDIF(${_group} STREQUAL "mime")
|
||||
|
||||
IF(${_group} STREQUAL "filesys")
|
||||
SET(_icon_GROUP "filesystems")
|
||||
ENDIF(${_group} STREQUAL "filesys")
|
||||
|
||||
IF(${_group} STREQUAL "device")
|
||||
SET(_icon_GROUP "devices")
|
||||
ENDIF(${_group} STREQUAL "device")
|
||||
|
||||
IF(${_group} STREQUAL "app")
|
||||
SET(_icon_GROUP "apps")
|
||||
ENDIF(${_group} STREQUAL "app")
|
||||
|
||||
IF(${_group} STREQUAL "action")
|
||||
SET(_icon_GROUP "actions")
|
||||
ENDIF(${_group} STREQUAL "action")
|
||||
|
||||
#message(STATUS "icon: ${_current_ICON} size: ${_sizestring} group: ${_group} name: ${_name}" )
|
||||
SET(_ICON_INSTALL_DIR ${ICON_INSTALL_DIR}/${_theme}/${_sizestring}/${_icon_GROUP})
|
||||
|
||||
INSTALL(FILES ${_current_ICON} DESTINATION ${_ICON_INSTALL_DIR} RENAME ${_name})
|
||||
|
||||
ENDFOREACH (_current_ICON)
|
||||
ENDMACRO(KDESVN_INSTALL_ICONS)
|
||||
|
||||
MACRO(ADD_POFILES packagename)
|
||||
SET(_gmofiles)
|
||||
FILE(GLOB _pofiles *.po)
|
||||
|
||||
FOREACH(_current_po ${_pofiles})
|
||||
GET_FILENAME_COMPONENT(_name ${_current_po} NAME_WE)
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)(\\.po)" "\\1" _lang "${_current_po}")
|
||||
SET(_gmofile "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gmo")
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_gmofile}
|
||||
COMMAND ${MSGFMT}
|
||||
ARGS "-o" "${_gmofile}" "${_current_po}"
|
||||
DEPENDS ${_current_po}
|
||||
)
|
||||
SET(_gmofiles ${_gmofiles} ${_gmofile})
|
||||
INSTALL(FILES ${_gmofile}
|
||||
DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES
|
||||
RENAME ${packagename}.mo)
|
||||
ENDFOREACH(_current_po ${_pofiles})
|
||||
|
||||
ADD_CUSTOM_TARGET(translations ALL
|
||||
DEPENDS ${_gmofiles})
|
||||
|
||||
ENDMACRO(ADD_POFILES)
|
||||
|
||||
|
||||
# KDE3_CREATE_HANDBOOK( docbookfile )
|
||||
# Create the handbook from the docbookfile (using meinproc)
|
||||
MACRO (KDE3_CREATE_HANDBOOK _docbook )
|
||||
GET_FILENAME_COMPONENT(_tmp_src_FILE ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
|
||||
GET_FILENAME_COMPONENT(_tmp_bin_FILE ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
|
||||
|
||||
IF(EXISTS ${_tmp_src_FILE}/${_docbook})
|
||||
get_filename_component(_input ${_tmp_src_FILE}/${_docbook} ABSOLUTE)
|
||||
ENDIF(EXISTS ${_tmp_src_FILE}/${_docbook})
|
||||
IF(EXISTS ${_tmp_bin_FILE}/${_docbook})
|
||||
get_filename_component(_input ${_tmp_bin_FILE}/${_docbook} ABSOLUTE)
|
||||
ENDIF(EXISTS ${_tmp_bin_FILE}/${_docbook})
|
||||
|
||||
SET(_doc ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_doc}
|
||||
COMMAND ${KDE3_MEINPROC_EXECUTABLE} --check --cache ${_doc} ${_input}
|
||||
DEPENDS ${_input} ${KDE3_MEINPROC_EXECUTABLE}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(handbook ALL DEPENDS ${_doc})
|
||||
ENDMACRO (KDE3_CREATE_HANDBOOK)
|
||||
|
||||
|
||||
# KDE3_INSTALL_HANDBOOK()
|
||||
# Install the handbook documentation
|
||||
MACRO (KDE3_INSTALL_HANDBOOK _appname )
|
||||
GET_FILENAME_COMPONENT(_tmp_src_FILE ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
|
||||
GET_FILENAME_COMPONENT(_tmp_bin_FILE ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
|
||||
GET_FILENAME_COMPONENT(_basename ${_tmp_src_FILE} NAME_WE)
|
||||
SET( dirname ${_basename}/${_appname})
|
||||
|
||||
FILE(GLOB _books_bin ${_tmp_bin_FILE}/*.docbook)
|
||||
FILE(GLOB _images_bin ${_tmp_bin_FILE}/*.png)
|
||||
FILE(GLOB _books_src ${_tmp_src_FILE}/*.docbook)
|
||||
FILE(GLOB _images_src ${_tmp_src_FILE}/*.png)
|
||||
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 ${_books_src} ${_books_bin} ${_images_src} ${_images_bin}
|
||||
DESTINATION ${HTML_INSTALL_DIR}/${dirname} )
|
||||
|
||||
INSTALL( CODE "EXECUTE_PROCESS ( COMMAND /bin/ln -s \"${KDE_HTML_COMMON_PATH}\" \"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\" ERROR_QUIET )" )
|
||||
INSTALL( CODE "MESSAGE(STATUS \"Installing $ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\")" )
|
||||
INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"IF(EXISTS \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\")\\n\")" )
|
||||
INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"MESSAGE(STATUS \\\"Uninstalling \\\\\\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\\\\\"\\\")\\n\")" )
|
||||
INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"ENDIF(EXISTS \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\")\\n\")" )
|
||||
INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"FILE(REMOVE \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\")\\n\")" )
|
||||
|
||||
# Specific for KBFX code - remove for other installs
|
||||
FILE(GLOB _docbook_PNGFILES ${CMAKE_SOURCE_DIR}/skin/raster/default/*.png)
|
||||
FOREACH(_p ${_docbook_PNGFILES})
|
||||
GET_FILENAME_COMPONENT(_png_name ${_p} NAME)
|
||||
INSTALL( CODE "EXECUTE_PROCESS ( COMMAND /bin/ln -s \"${DATA_INSTALL_DIR}/kbfx/skins/default/${_png_name}\" \"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}\" ERROR_QUIET )" )
|
||||
INSTALL( CODE "MESSAGE(STATUS \"Installing $ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/${_png_name}\")" )
|
||||
INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"MESSAGE(STATUS \\\"Uninstalling \\\\\\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/${_png_name}\\\\\\\"\\\")\\n\")" )
|
||||
INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"FILE(REMOVE \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/${_png_name}\\\")\\n\")" )
|
||||
ENDFOREACH(_p)
|
||||
# End of specific for KBFX code
|
||||
ENDMACRO (KDE3_INSTALL_HANDBOOK )
|
||||
|
@ -0,0 +1,47 @@
|
||||
# - Try to find Strigi
|
||||
# Once done this will define
|
||||
#
|
||||
# STRIGI_FOUND - system has Strigi
|
||||
# STRIGI_INCLUDE_DIR - the Strigi include directory
|
||||
# STRIGIHTMLGUI_LIBRARY - Link these to use Strigi html gui
|
||||
# STRIGICLIENT_LIBRARY - Link to use the Strigi C++ client
|
||||
#
|
||||
|
||||
FIND_PATH(STRIGI_INCLUDE_DIR strigihtmlgui.h
|
||||
PATHS
|
||||
$ENV{HOME}/include/strigi
|
||||
$ENV{HOME}/usr/include/strigi
|
||||
$ENV{KDEDIR}/include/strigi
|
||||
/opt/kde/include/strigi
|
||||
/opt/kde3/include/strigi
|
||||
/opt/kde4/include/strigi
|
||||
/usr/kde/3.5/include/strigi
|
||||
/usr/include/strigi
|
||||
/usr/local/include/strigi
|
||||
/opt/include/strigi
|
||||
${INCLUDE_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(STRIGIHTMLGUI_LIBRARY NAMES strigihtmlgui
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
FIND_LIBRARY(STRIGICLIENT_LIBRARY NAMES searchclient
|
||||
PATHS
|
||||
${LIB_SEARCH_PATHES}
|
||||
)
|
||||
|
||||
IF(STRIGI_INCLUDE_DIR AND STRIGIHTMLGUI_LIBRARY AND STRIGICLIENT_LIBRARY)
|
||||
SET(STRIGI_FOUND TRUE)
|
||||
ENDIF(STRIGI_INCLUDE_DIR AND STRIGIHTMLGUI_LIBRARY AND STRIGICLIENT_LIBRARY)
|
||||
|
||||
IF(STRIGI_FOUND)
|
||||
IF(NOT Strigi_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Strigi: ${STRIGIHTMLGUI_LIBRARY}")
|
||||
ENDIF(NOT Strigi_FIND_QUIETLY)
|
||||
ELSE(STRIGI_FOUND)
|
||||
IF(Strigi_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Strigi! Please download and install Strigi from http://strigi.sf.net")
|
||||
ENDIF(Strigi_FIND_REQUIRED)
|
||||
ENDIF(STRIGI_FOUND)
|
||||
|
@ -0,0 +1,352 @@
|
||||
# - Find X11 installation
|
||||
# Try to find X11 on UNIX systems. The following values are defined
|
||||
# X11_FOUND - True if X11 is available
|
||||
# X11_INCLUDE_DIR - include directories to use X11
|
||||
# X11_LIBRARIES - link against these to use X11
|
||||
|
||||
# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
||||
# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
||||
|
||||
if (UNIX)
|
||||
set(X11_FOUND 0)
|
||||
|
||||
set(X11_INC_SEARCH_PATH
|
||||
/usr/X11R6/include
|
||||
/usr/local/include
|
||||
/usr/include/X11
|
||||
/usr/openwin/include
|
||||
/usr/openwin/share/include
|
||||
/opt/graphics/OpenGL/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
set(X11_LIB_SEARCH_PATH
|
||||
/usr/X11R6/lib
|
||||
/usr/local/lib
|
||||
/usr/openwin/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH})
|
||||
|
||||
# Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH
|
||||
# variable (which doesn't need to match the include file name).
|
||||
|
||||
# Solaris lacks XKBrules.h, so we should skip kxkbd there.
|
||||
FIND_PATH(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
|
||||
FIND_PATH(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH})
|
||||
|
||||
|
||||
FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
|
||||
# Find additional X libraries. Keep list sorted by library name.
|
||||
FIND_LIBRARY(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xss_LIB Xss ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH)
|
||||
|
||||
if (X11_X11_INCLUDE_PATH)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
|
||||
endif (X11_X11_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xlib_INCLUDE_PATH)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH})
|
||||
endif (X11_Xlib_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xutil_INCLUDE_PATH)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH})
|
||||
endif (X11_Xutil_INCLUDE_PATH)
|
||||
|
||||
if(X11_Xshape_INCLUDE_PATH)
|
||||
set(X11_Xshape_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH})
|
||||
endif(X11_Xshape_INCLUDE_PATH)
|
||||
|
||||
if (X11_X11_LIB)
|
||||
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB})
|
||||
endif (X11_X11_LIB)
|
||||
|
||||
if (X11_Xext_LIB)
|
||||
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB})
|
||||
endif (X11_Xext_LIB)
|
||||
|
||||
if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
|
||||
set(X11_XFT_FOUND TRUE)
|
||||
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xft_LIB})
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH})
|
||||
endif(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
|
||||
|
||||
if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
|
||||
set(X11_XV_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH})
|
||||
endif(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xau_LIB)
|
||||
set(X11_Xau_FOUND TRUE)
|
||||
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xau_LIB})
|
||||
endif (X11_Xau_LIB)
|
||||
|
||||
if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
|
||||
set(X11_Xdmcp_FOUND TRUE)
|
||||
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xdmcp_LIB})
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH})
|
||||
endif (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
|
||||
|
||||
if (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
|
||||
set(X11_Xaccess_FOUND TRUE)
|
||||
set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH})
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH})
|
||||
endif (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
|
||||
set(X11_Xpm_FOUND TRUE)
|
||||
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xpm_LIB})
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH})
|
||||
endif (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
|
||||
|
||||
|
||||
if (X11_Xcomposite_INCLUDE_PATH)
|
||||
set(X11_Xcomposite_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH})
|
||||
endif (X11_Xcomposite_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xdamage_INCLUDE_PATH)
|
||||
set(X11_Xdamage_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH})
|
||||
endif (X11_Xdamage_INCLUDE_PATH)
|
||||
|
||||
if (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
|
||||
set(X11_XTest_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH})
|
||||
endif (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
|
||||
|
||||
if (X11_Xinerama_INCLUDE_PATH)
|
||||
set(X11_Xinerama_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH})
|
||||
endif (X11_Xinerama_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xfixes_INCLUDE_PATH)
|
||||
set(X11_Xfixes_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH})
|
||||
endif (X11_Xfixes_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
|
||||
set(X11_Xrender_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH})
|
||||
endif (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
|
||||
|
||||
if (X11_Xrandr_INCLUDE_PATH)
|
||||
set(X11_Xrandr_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
|
||||
endif (X11_Xrandr_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xxf86misc_INCLUDE_PATH)
|
||||
set(X11_Xxf86misc_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xxf86misc_INCLUDE_PATH})
|
||||
endif (X11_Xxf86misc_INCLUDE_PATH)
|
||||
|
||||
if (X11_xf86vmode_INCLUDE_PATH)
|
||||
set(X11_xf86vmode_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH})
|
||||
endif (X11_xf86vmode_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
|
||||
set(X11_Xcursor_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH})
|
||||
endif (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
|
||||
|
||||
if (X11_Xscreensaver_INCLUDE_PATH)
|
||||
set(X11_Xscreensaver_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH})
|
||||
endif (X11_Xscreensaver_INCLUDE_PATH)
|
||||
|
||||
if (X11_dpms_INCLUDE_PATH)
|
||||
set(X11_dpms_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH})
|
||||
endif (X11_dpms_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
|
||||
set(X11_Xkb_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} )
|
||||
endif (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
|
||||
|
||||
if (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
|
||||
set(X11_Xinput_FOUND TRUE)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH})
|
||||
endif (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
|
||||
|
||||
# Deprecated variable for backwards compatibility with CMake 1.4
|
||||
if (X11_X11_INCLUDE_PATH)
|
||||
if (X11_LIBRARIES)
|
||||
set(X11_FOUND 1)
|
||||
endif (X11_LIBRARIES)
|
||||
endif (X11_X11_INCLUDE_PATH)
|
||||
|
||||
set(X11_LIBRARY_DIR "")
|
||||
if (X11_X11_LIB)
|
||||
GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH)
|
||||
endif (X11_X11_LIB)
|
||||
|
||||
if (X11_FOUND)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckLibraryExists)
|
||||
|
||||
# Translated from an autoconf-generated configure script.
|
||||
# See libs.m4 in autoconf's m4 directory.
|
||||
if ($ENV{ISC} MATCHES "^yes$")
|
||||
set(X11_X_EXTRA_LIBS -lnsl_s -linet)
|
||||
else ($ENV{ISC} MATCHES "^yes$")
|
||||
set(X11_X_EXTRA_LIBS "")
|
||||
|
||||
# See if XOpenDisplay in X11 works by itself.
|
||||
CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO)
|
||||
if (NOT X11_LIB_X11_SOLO)
|
||||
# Find library needed for dnet_ntoa.
|
||||
CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
|
||||
if (X11_LIB_DNET_HAS_DNET_NTOA)
|
||||
set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet)
|
||||
else (X11_LIB_DNET_HAS_DNET_NTOA)
|
||||
CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
||||
if (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
||||
set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub)
|
||||
endif (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
||||
endif (X11_LIB_DNET_HAS_DNET_NTOA)
|
||||
endif (NOT X11_LIB_X11_SOLO)
|
||||
|
||||
# Find library needed for gethostbyname.
|
||||
CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
|
||||
if (NOT CMAKE_HAVE_GETHOSTBYNAME)
|
||||
CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
||||
if (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
||||
set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl)
|
||||
else (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
||||
CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
||||
if (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
||||
set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd)
|
||||
endif (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
||||
endif (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
||||
endif (NOT CMAKE_HAVE_GETHOSTBYNAME)
|
||||
|
||||
# Find library needed for connect.
|
||||
CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT)
|
||||
if (NOT CMAKE_HAVE_CONNECT)
|
||||
CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
|
||||
if (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
||||
set(X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS})
|
||||
endif (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
||||
endif (NOT CMAKE_HAVE_CONNECT)
|
||||
|
||||
# Find library needed for remove.
|
||||
CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE)
|
||||
if (NOT CMAKE_HAVE_REMOVE)
|
||||
CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
|
||||
if (CMAKE_LIB_POSIX_HAS_REMOVE)
|
||||
set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix)
|
||||
endif (CMAKE_LIB_POSIX_HAS_REMOVE)
|
||||
endif (NOT CMAKE_HAVE_REMOVE)
|
||||
|
||||
# Find library needed for shmat.
|
||||
CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT)
|
||||
if (NOT CMAKE_HAVE_SHMAT)
|
||||
CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
|
||||
if (CMAKE_LIB_IPS_HAS_SHMAT)
|
||||
set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc)
|
||||
endif (CMAKE_LIB_IPS_HAS_SHMAT)
|
||||
endif (NOT CMAKE_HAVE_SHMAT)
|
||||
endif ($ENV{ISC} MATCHES "^yes$")
|
||||
|
||||
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
|
||||
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
||||
if (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
||||
set(X11_X_PRE_LIBS -lSM -lICE)
|
||||
endif (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
||||
# Build the final list of libraries.
|
||||
set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
|
||||
endif (X11_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
X11_X11_INCLUDE_PATH
|
||||
X11_X11_LIB
|
||||
X11_Xext_LIB
|
||||
X11_Xau_LIB
|
||||
X11_Xlib_INCLUDE_PATH
|
||||
X11_Xutil_INCLUDE_PATH
|
||||
X11_Xcomposite_INCLUDE_PATH
|
||||
X11_Xcomposite_LIB
|
||||
X11_Xaccess_INCLUDE_PATH
|
||||
X11_Xfixes_LIB
|
||||
X11_Xfixes_INCLUDE_PATH
|
||||
X11_Xrandr_LIB
|
||||
X11_Xrandr_INCLUDE_PATH
|
||||
X11_Xdamage_LIB
|
||||
X11_Xdamage_INCLUDE_PATH
|
||||
X11_Xrender_LIB
|
||||
X11_Xrender_INCLUDE_PATH
|
||||
X11_Xxf86misc_LIB
|
||||
X11_Xxf86misc_INCLUDE_PATH
|
||||
X11_Xinerama_LIB
|
||||
X11_Xinerama_INCLUDE_PATH
|
||||
X11_XTest_LIB
|
||||
X11_XTest_INCLUDE_PATH
|
||||
X11_Xcursor_LIB
|
||||
X11_Xcursor_INCLUDE_PATH
|
||||
X11_dpms_INCLUDE_PATH
|
||||
X11_Xt_LIB
|
||||
X11_Xss_LIB
|
||||
X11_Xdmcp_LIB
|
||||
X11_LIBRARIES
|
||||
X11_Xaccessrules_INCLUDE_PATH
|
||||
X11_Xaccessstr_INCLUDE_PATH
|
||||
X11_Xdmcp_INCLUDE_PATH
|
||||
X11_Xf86misc_INCLUDE_PATH
|
||||
X11_Xkb_INCLUDE_PATH
|
||||
X11_Xkblib_INCLUDE_PATH
|
||||
X11_Xscreensaver_INCLUDE_PATH
|
||||
X11_Xpm_INCLUDE_PATH
|
||||
X11_Xpm_LIB
|
||||
X11_Xinput_LIB
|
||||
X11_Xinput_INCLUDE_PATH
|
||||
X11_Xft_LIB
|
||||
X11_Xft_INCLUDE_PATH
|
||||
X11_Xshape_INCLUDE_PATH
|
||||
X11_Xv_LIB
|
||||
X11_Xv_INCLUDE_PATH
|
||||
)
|
||||
|
||||
endif (UNIX)
|
@ -0,0 +1,392 @@
|
||||
#
|
||||
|
||||
# See FindKDE3.cmake for documentation.
|
||||
#
|
||||
# this file contains the following macros:
|
||||
# KDE3_ADD_DCOP_SKELS
|
||||
# KDE3_ADD_DCOP_STUBS
|
||||
# KDE3_ADD_MOC_FILES
|
||||
# KDE3_ADD_UI_FILES
|
||||
# KDE3_ADD_KCFG_FILES
|
||||
# KDE3_AUTOMOC
|
||||
# KDE3_INSTALL_LIBTOOL_FILE
|
||||
# KDE3_CREATE_FINAL_FILE
|
||||
# KDE3_ADD_KPART
|
||||
# KDE3_ADD_KDEINIT_EXECUTABLE
|
||||
# KDE3_ADD_EXECUTABLE
|
||||
|
||||
#neundorf@kde.org
|
||||
#
|
||||
# Modified by PhobosK <phobosk@mail.kbfx.org>
|
||||
|
||||
INCLUDE(AddFileDependencies)
|
||||
|
||||
#create the kidl and skeletion file for dcop stuff
|
||||
#usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers})
|
||||
MACRO(KDE3_ADD_DCOP_SKELS _sources)
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
|
||||
|
||||
SET(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp)
|
||||
SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)
|
||||
|
||||
IF (NOT HAVE_${_basename}_KIDL_RULE)
|
||||
SET(HAVE_${_basename}_KIDL_RULE ON)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
|
||||
COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
|
||||
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} > ${_kidl}
|
||||
DEPENDS ${_tmp_FILE}
|
||||
)
|
||||
ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
|
||||
|
||||
IF (NOT HAVE_${_basename}_SKEL_RULE)
|
||||
SET(HAVE_${_basename}_SKEL_RULE ON)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_skel}
|
||||
COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
|
||||
ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl}
|
||||
DEPENDS ${_kidl}
|
||||
)
|
||||
|
||||
ENDIF (NOT HAVE_${_basename}_SKEL_RULE)
|
||||
|
||||
SET(${_sources} ${${_sources}} ${_skel})
|
||||
|
||||
ENDFOREACH (_current_FILE)
|
||||
|
||||
ENDMACRO(KDE3_ADD_DCOP_SKELS)
|
||||
|
||||
|
||||
MACRO(KDE3_ADD_DCOP_STUBS _sources)
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
|
||||
GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
|
||||
|
||||
SET(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp)
|
||||
SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)
|
||||
|
||||
IF (NOT HAVE_${_basename}_KIDL_RULE)
|
||||
SET(HAVE_${_basename}_KIDL_RULE ON)
|
||||
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
|
||||
COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
|
||||
ARGS ${tmp_FILE} > ${_kidl}
|
||||
DEPENDS ${tmp_FILE}
|
||||
)
|
||||
|
||||
ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
|
||||
|
||||
|
||||
IF (NOT HAVE_${_basename}_STUB_RULE)
|
||||
SET(HAVE_${_basename}_STUB_RULE ON)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_stub_CPP}
|
||||
COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
|
||||
ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl}
|
||||
DEPENDS ${_kidl}
|
||||
)
|
||||
|
||||
ENDIF (NOT HAVE_${_basename}_STUB_RULE)
|
||||
|
||||
SET(${_sources} ${${_sources}} ${_stub_CPP})
|
||||
|
||||
ENDFOREACH (_current_FILE)
|
||||
|
||||
ENDMACRO(KDE3_ADD_DCOP_STUBS)
|
||||
|
||||
|
||||
MACRO(KDE3_ADD_KCFG_FILES _sources)
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
|
||||
GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
|
||||
|
||||
FILE(READ ${_tmp_FILE} _contents)
|
||||
STRING(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}")
|
||||
|
||||
SET(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
|
||||
SET(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_src_FILE}
|
||||
COMMAND ${KDE3_KCFGC_EXECUTABLE}
|
||||
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE}
|
||||
DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} )
|
||||
|
||||
SET(${_sources} ${${_sources}} ${_src_FILE})
|
||||
|
||||
ENDFOREACH (_current_FILE)
|
||||
|
||||
ENDMACRO(KDE3_ADD_KCFG_FILES)
|
||||
|
||||
|
||||
#create the moc files and add them to the list of sources
|
||||
#usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers})
|
||||
MACRO(KDE3_ADD_MOC_FILES _sources)
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
|
||||
GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
|
||||
SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
|
||||
COMMAND ${QT_MOC_EXECUTABLE}
|
||||
ARGS ${_tmp_FILE} -o ${_moc}
|
||||
DEPENDS ${_tmp_FILE}
|
||||
)
|
||||
|
||||
SET(${_sources} ${${_sources}} ${_moc})
|
||||
|
||||
ENDFOREACH (_current_FILE)
|
||||
ENDMACRO(KDE3_ADD_MOC_FILES)
|
||||
|
||||
|
||||
GET_FILENAME_COMPONENT( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
#create the implementation files from the ui files and add them to the list of sources
|
||||
#usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files})
|
||||
MACRO(KDE3_ADD_UI_FILES _sources )
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
|
||||
GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
|
||||
SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
|
||||
SET(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
|
||||
SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_header}
|
||||
COMMAND ${QT_UIC_EXECUTABLE}
|
||||
ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
|
||||
DEPENDS ${_tmp_FILE}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_src}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS
|
||||
-DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer
|
||||
-DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
|
||||
-DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
|
||||
-DKDE_UIC_CPP_FILE:FILEPATH=${_src}
|
||||
-DKDE_UIC_H_FILE:FILEPATH=${_header}
|
||||
-P ${KDE3_MODULE_DIR}/kde3uic.cmake
|
||||
DEPENDS ${_header}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
|
||||
COMMAND ${QT_MOC_EXECUTABLE}
|
||||
ARGS ${_header} -o ${_moc}
|
||||
DEPENDS ${_header}
|
||||
)
|
||||
|
||||
SET(${_sources} ${${_sources}} ${_src} ${_moc} )
|
||||
|
||||
ENDFOREACH (_current_FILE)
|
||||
ENDMACRO(KDE3_ADD_UI_FILES)
|
||||
|
||||
|
||||
MACRO(KDE3_AUTOMOC)
|
||||
SET(_matching_FILES )
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
|
||||
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
|
||||
# here. this is required to make bouic work correctly:
|
||||
# we need to add generated .cpp files to the sources (to compile them),
|
||||
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
|
||||
# cmake is run for the very first time on them -> however the .cpp files might
|
||||
# exist at a later run. at that time we need to skip them, so that we don't add two
|
||||
# different rules for the same moc file
|
||||
GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
|
||||
|
||||
IF (EXISTS ${_abs_FILE} AND NOT _skip)
|
||||
|
||||
FILE(READ ${_abs_FILE} _contents)
|
||||
|
||||
GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
|
||||
|
||||
STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
|
||||
IF(_match)
|
||||
FOREACH (_current_MOC_INC ${_match})
|
||||
STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
|
||||
|
||||
GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
|
||||
# SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
|
||||
SET(_header ${_abs_PATH}/${_basename}.h)
|
||||
SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
|
||||
COMMAND ${QT_MOC_EXECUTABLE}
|
||||
ARGS ${_header} -o ${_moc}
|
||||
DEPENDS ${_header}
|
||||
)
|
||||
|
||||
ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
|
||||
|
||||
ENDFOREACH (_current_MOC_INC)
|
||||
ENDIF(_match)
|
||||
|
||||
ENDIF (EXISTS ${_abs_FILE} AND NOT _skip)
|
||||
ENDFOREACH (_current_FILE)
|
||||
ENDMACRO(KDE3_AUTOMOC)
|
||||
|
||||
# only used internally by KDE3_INSTALL_ICONS
|
||||
MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME)
|
||||
|
||||
# if the string doesn't match the pattern, the result is the full string, so all three have the same content
|
||||
IF (NOT ${_group} STREQUAL ${_install_NAME} )
|
||||
SET(_icon_GROUP "actions")
|
||||
|
||||
IF (${_group} STREQUAL "mime")
|
||||
SET(_icon_GROUP "mimetypes")
|
||||
ENDIF (${_group} STREQUAL "mime")
|
||||
|
||||
IF (${_group} STREQUAL "filesys")
|
||||
SET(_icon_GROUP "filesystems")
|
||||
ENDIF (${_group} STREQUAL "filesys")
|
||||
|
||||
IF (${_group} STREQUAL "device")
|
||||
SET(_icon_GROUP "devices")
|
||||
ENDIF (${_group} STREQUAL "device")
|
||||
|
||||
IF (${_group} STREQUAL "app")
|
||||
SET(_icon_GROUP "apps")
|
||||
ENDIF (${_group} STREQUAL "app")
|
||||
|
||||
IF (${_group} STREQUAL "action")
|
||||
SET(_icon_GROUP "actions")
|
||||
ENDIF (${_group} STREQUAL "action")
|
||||
|
||||
# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
|
||||
INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} )
|
||||
ENDIF (NOT ${_group} STREQUAL ${_install_NAME} )
|
||||
|
||||
ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE)
|
||||
|
||||
|
||||
MACRO (KDE3_INSTALL_ICONS _theme )
|
||||
SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons")
|
||||
# first the png icons
|
||||
FILE(GLOB _icons *.png)
|
||||
FOREACH (_current_ICON ${_icons} )
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
|
||||
_KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
|
||||
${_defaultpath}/${_theme}/${_size}x${_size}
|
||||
${_group} ${_current_ICON} ${_name})
|
||||
ENDFOREACH (_current_ICON)
|
||||
|
||||
# and now the svg icons
|
||||
FILE(GLOB _icons *.svgz)
|
||||
FOREACH (_current_ICON ${_icons} )
|
||||
STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}")
|
||||
_KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
|
||||
${_defaultpath}/${_theme}/scalable
|
||||
${_group} ${_current_ICON} ${_name})
|
||||
ENDFOREACH (_current_ICON)
|
||||
|
||||
ENDMACRO (KDE3_INSTALL_ICONS)
|
||||
|
||||
MACRO(KDE3_INSTALL_LIBTOOL_FILE _target _place)
|
||||
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
|
||||
|
||||
GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
|
||||
SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)
|
||||
|
||||
FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
|
||||
FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
|
||||
FILE(APPEND ${_laname} "dlname='${_soname}'\n")
|
||||
FILE(APPEND ${_laname} "# Names of this library\n")
|
||||
FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n")
|
||||
FILE(APPEND ${_laname} "# The name of the static archive\n")
|
||||
FILE(APPEND ${_laname} "old_library=''\n")
|
||||
FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
|
||||
FILE(APPEND ${_laname} "dependency_libs=''\n")
|
||||
# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n")
|
||||
FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
|
||||
FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n")
|
||||
FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
|
||||
FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n")
|
||||
FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
|
||||
FILE(APPEND ${_laname} "libdir='${_place}'\n")
|
||||
INSTALL(FILES ${_laname} DESTINATION ${_place})
|
||||
ENDMACRO(KDE3_INSTALL_LIBTOOL_FILE)
|
||||
|
||||
|
||||
MACRO(KDE3_CREATE_FINAL_FILE _filename)
|
||||
FILE(WRITE ${_filename} "//autogenerated file\n")
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
FILE(APPEND ${_filename} "#include \"${_current_FILE}\"\n")
|
||||
ENDFOREACH (_current_FILE)
|
||||
|
||||
ENDMACRO(KDE3_CREATE_FINAL_FILE)
|
||||
|
||||
|
||||
OPTION(KDE3_ENABLE_FINAL "Enable final all-in-one compilation")
|
||||
OPTION(KDE3_BUILD_TESTS "Build the tests")
|
||||
|
||||
|
||||
MACRO(KDE3_ADD_KPART _target_NAME _with_PREFIX)
|
||||
#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty
|
||||
IF (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
||||
SET(_first_SRC)
|
||||
ELSE (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
||||
SET(_first_SRC ${_with_PREFIX})
|
||||
ENDIF (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
||||
|
||||
IF (KDE3_ENABLE_FINAL)
|
||||
KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN})
|
||||
ADD_LIBRARY(${_target_NAME} MODULE ${_target_NAME}_final.cpp)
|
||||
ELSE (KDE3_ENABLE_FINAL)
|
||||
ADD_LIBRARY(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
|
||||
ENDIF (KDE3_ENABLE_FINAL)
|
||||
|
||||
IF(_first_SRC)
|
||||
SET_TARGET_PROPERTIES(${_target_NAME} PROPERTIES PREFIX "")
|
||||
ENDIF(_first_SRC)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME})
|
||||
|
||||
ENDMACRO(KDE3_ADD_KPART)
|
||||
|
||||
|
||||
MACRO(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME )
|
||||
|
||||
IF (KDE3_ENABLE_FINAL)
|
||||
KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
|
||||
ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp)
|
||||
ELSE (KDE3_ENABLE_FINAL)
|
||||
ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${ARGN} )
|
||||
ENDIF (KDE3_ENABLE_FINAL)
|
||||
|
||||
CONFIGURE_FILE(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
|
||||
|
||||
ADD_EXECUTABLE( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp )
|
||||
TARGET_LINK_LIBRARIES( ${_target_NAME} kdeinit_${_target_NAME} )
|
||||
|
||||
ENDMACRO(KDE3_ADD_KDEINIT_EXECUTABLE)
|
||||
|
||||
|
||||
MACRO(KDE3_ADD_EXECUTABLE _target_NAME )
|
||||
|
||||
IF (KDE3_ENABLE_FINAL)
|
||||
KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
|
||||
ADD_EXECUTABLE(${_target_NAME} ${_target_NAME}_final.cpp)
|
||||
ELSE (KDE3_ENABLE_FINAL)
|
||||
ADD_EXECUTABLE(${_target_NAME} ${ARGN} )
|
||||
ENDIF (KDE3_ENABLE_FINAL)
|
||||
|
||||
ENDMACRO(KDE3_ADD_EXECUTABLE)
|
||||
|
||||
|
@ -0,0 +1,854 @@
|
||||
# for documentation look at FindKDE4Internal.cmake
|
||||
#
|
||||
# this file contains the following macros:
|
||||
# KDE4_ADD_UI_FILES
|
||||
# KDE4_ADD_UI3_FILES
|
||||
# KDE4_ADD_KCFG_FILES
|
||||
# KDE4_AUTOMOC
|
||||
# KDE4_INSTALL_LIBTOOL_FILE
|
||||
# KDE4_CREATE_FINAL_FILES
|
||||
# KDE4_ADD_KDEINIT_EXECUTABLE
|
||||
# KDE4_ADD_EXECUTABLE
|
||||
# KDE4_ADD_WIDGET_FILES
|
||||
# KDE4_INSTALL_ICONS
|
||||
# KDE4_REMOVE_OBSOLETE_CMAKE_FILES
|
||||
# KDE4_NO_ENABLE_FINAL
|
||||
# KDE4_CREATE_HANDBOOK
|
||||
# KDE4_CREATE_HTML_HANDBOOK
|
||||
# KDE4_INSTALL_HANDBOOK
|
||||
|
||||
# Copyright (c) 2006, 2007, Alexander Neundorf, <neundorf@kde.org>
|
||||
# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
# Modified by PhobosK <phobosk@mail.kbfx.org>
|
||||
|
||||
macro (KDE4_ADD_KCFG_FILES _sources )
|
||||
if( ${ARGV1} STREQUAL "GENERATE_MOC" )
|
||||
set(_kcfg_generatemoc TRUE)
|
||||
endif( ${ARGV1} STREQUAL "GENERATE_MOC" )
|
||||
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
if(NOT ${_current_FILE} STREQUAL "GENERATE_MOC")
|
||||
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
get_filename_component(_abs_PATH ${_tmp_FILE} PATH)
|
||||
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
||||
|
||||
file(READ ${_tmp_FILE} _contents)
|
||||
string(REGEX REPLACE "^(.*\n)?File=([^\n]+kcfg).*\n.*$" "\\2" _kcfg_FILE "${_contents}")
|
||||
set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
|
||||
set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
|
||||
set(_moc_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
|
||||
|
||||
# the command for creating the source file from the kcfg file
|
||||
add_custom_command(OUTPUT ${_header_FILE} ${_src_FILE}
|
||||
COMMAND ${KDE4_KCFGC_EXECUTABLE}
|
||||
ARGS ${_abs_PATH}/${_kcfg_FILE} ${_tmp_FILE} -d ${CMAKE_CURRENT_BINARY_DIR}
|
||||
MAIN_DEPENDENCY ${_tmp_FILE}
|
||||
DEPENDS ${_abs_PATH}/${_kcfg_FILE} ${_KDE4_KCONFIG_COMPILER_DEP} )
|
||||
|
||||
if(_kcfg_generatemoc)
|
||||
qt4_generate_moc(${_header_FILE} ${_moc_FILE} )
|
||||
set_source_files_properties(${_src_FILE} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
|
||||
list(APPEND ${_sources} ${_moc_FILE})
|
||||
endif(_kcfg_generatemoc)
|
||||
|
||||
# if (KDE4_ENABLE_FINAL)
|
||||
# kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${ARGN})
|
||||
# macro_add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_src_FILE})
|
||||
# endif (KDE4_ENABLE_FINAL)
|
||||
|
||||
list(APPEND ${_sources} ${_src_FILE} ${_header_FILE})
|
||||
endif(NOT ${_current_FILE} STREQUAL "GENERATE_MOC")
|
||||
endforeach (_current_FILE)
|
||||
|
||||
endmacro (KDE4_ADD_KCFG_FILES)
|
||||
|
||||
|
||||
GET_FILENAME_COMPONENT(KDE4_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
#create the implementation files from the ui files and add them to the list of sources
|
||||
#usage: KDE4_ADD_UI_FILES(foo_SRCS ${ui_files})
|
||||
macro (KDE4_ADD_UI_FILES _sources )
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
||||
set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h)
|
||||
|
||||
# we need to run uic and replace some things in the generated file
|
||||
# this is done by executing the cmake script kde4uic.cmake
|
||||
add_custom_command(OUTPUT ${_header}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS
|
||||
-DKDE4_HEADER:BOOL=ON
|
||||
-DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
|
||||
-DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
|
||||
-DKDE_UIC_H_FILE:FILEPATH=${_header}
|
||||
-DKDE_UIC_BASENAME:STRING=${_basename}
|
||||
-P ${KDE4_MODULE_DIR}/kde4uic.cmake
|
||||
MAIN_DEPENDENCY ${_tmp_FILE}
|
||||
)
|
||||
list(APPEND ${_sources} ${_header})
|
||||
endforeach (_current_FILE)
|
||||
endmacro (KDE4_ADD_UI_FILES)
|
||||
|
||||
|
||||
#create the implementation files from the ui files and add them to the list of sources
|
||||
#usage: KDE4_ADD_UI3_FILES(foo_SRCS ${ui_files})
|
||||
macro (KDE4_ADD_UI3_FILES _sources )
|
||||
|
||||
qt4_get_moc_inc_dirs(_moc_INCS)
|
||||
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
||||
set(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
|
||||
set(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
|
||||
set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
|
||||
|
||||
add_custom_command(OUTPUT ${_header}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DKDE3_HEADER:BOOL=ON
|
||||
-DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC3_EXECUTABLE}
|
||||
-DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
|
||||
-DKDE_UIC_H_FILE:FILEPATH=${_header}
|
||||
-DKDE_UIC_BASENAME:STRING=${_basename}
|
||||
-DKDE_UIC_PLUGIN_DIR:FILEPATH="."
|
||||
-P ${KDE4_MODULE_DIR}/kde4uic.cmake
|
||||
MAIN_DEPENDENCY ${_tmp_FILE}
|
||||
)
|
||||
|
||||
# we need to run uic3 and replace some things in the generated file
|
||||
# this is done by executing the cmake script kde4uic.cmake
|
||||
add_custom_command(OUTPUT ${_src}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS
|
||||
-DKDE3_IMPL:BOOL=ON
|
||||
-DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC3_EXECUTABLE}
|
||||
-DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
|
||||
-DKDE_UIC_CPP_FILE:FILEPATH=${_src}
|
||||
-DKDE_UIC_H_FILE:FILEPATH=${_header}
|
||||
-DKDE_UIC_BASENAME:STRING=${_basename}
|
||||
-DKDE_UIC_PLUGIN_DIR:FILEPATH="."
|
||||
-P ${KDE4_MODULE_DIR}/kde4uic.cmake
|
||||
MAIN_DEPENDENCY ${_header}
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${_moc}
|
||||
COMMAND ${QT_MOC_EXECUTABLE}
|
||||
ARGS ${_moc_INCS} ${_header} -o ${_moc}
|
||||
MAIN_DEPENDENCY ${_header}
|
||||
)
|
||||
list(APPEND ${_sources} ${_src} ${_moc} )
|
||||
|
||||
endforeach (_current_FILE)
|
||||
endmacro (KDE4_ADD_UI3_FILES)
|
||||
|
||||
|
||||
macro (KDE4_AUTOMOC)
|
||||
qt4_get_moc_inc_dirs(_moc_INCS)
|
||||
|
||||
# iterate over all files
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
|
||||
# here. this is required to make bouic work correctly:
|
||||
# we need to add generated .cpp files to the sources (to compile them),
|
||||
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
|
||||
# cmake is run for the very first time on them -> however the .cpp files might
|
||||
# exist at a later run. at that time we need to skip them, so that we don't add two
|
||||
# different rules for the same moc file
|
||||
get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC)
|
||||
|
||||
# if the file exists and should not be skipped read it completely into memory
|
||||
# and grep for all include <foo.moc> lines
|
||||
# for each found moc file generate a custom_target and collect
|
||||
# the generated moc files in a list which will be set as a source files property
|
||||
# and later be queried in kde4_add_library/executable/plugin()
|
||||
if (EXISTS ${_abs_FILE} AND NOT _skip)
|
||||
set(_moc_FILES_PROPERTY)
|
||||
|
||||
file(READ ${_abs_FILE} _contents)
|
||||
get_filename_component(_abs_PATH ${_abs_FILE} PATH)
|
||||
|
||||
string(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
|
||||
if (_match)
|
||||
foreach (_current_MOC_INC ${_match})
|
||||
string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
|
||||
get_filename_component(_basename ${_current_MOC} NAME_WE)
|
||||
set(_header ${_abs_PATH}/${_basename}.h)
|
||||
set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
|
||||
|
||||
if (NOT EXISTS ${_abs_PATH}/${_basename}.h)
|
||||
message(FATAL_ERROR "In the file \"${_abs_FILE}\" the moc file \"${_current_MOC}\" is included, but \"${_abs_PATH}/${_basename}.h\" doesn't exist.")
|
||||
endif (NOT EXISTS ${_abs_PATH}/${_basename}.h)
|
||||
|
||||
add_custom_command(OUTPUT ${_moc}
|
||||
COMMAND ${QT_MOC_EXECUTABLE}
|
||||
ARGS ${_moc_INCS} ${_header} -o ${_moc}
|
||||
MAIN_DEPENDENCY ${_header}
|
||||
)
|
||||
|
||||
list(APPEND _moc_FILES_PROPERTY ${_moc})
|
||||
|
||||
# if (KDE4_ENABLE_FINAL)
|
||||
# kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${ARGN})
|
||||
# macro_add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_moc})
|
||||
# else (KDE4_ENABLE_FINAL)
|
||||
# macro_add_file_dependencies(${_abs_FILE} ${_moc})
|
||||
# endif (KDE4_ENABLE_FINAL)
|
||||
|
||||
endforeach (_current_MOC_INC)
|
||||
endif (_match)
|
||||
|
||||
set_source_files_properties(${_abs_FILE} PROPERTIES AUTOMOC_FILES "${_moc_FILES_PROPERTY}")
|
||||
endif (EXISTS ${_abs_FILE} AND NOT _skip)
|
||||
endforeach (_current_FILE)
|
||||
endmacro (KDE4_AUTOMOC)
|
||||
|
||||
|
||||
macro(KDE4_GET_AUTOMOC_FILES _list)
|
||||
set(${_list})
|
||||
foreach (_current_FILE ${ARGN})
|
||||
set(_automoc_FILES_PROPERTY)
|
||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
get_source_file_property(_automoc_FILES_PROPERTY ${_abs_FILE} AUTOMOC_FILES)
|
||||
if (_automoc_FILES_PROPERTY)
|
||||
foreach (_current_MOC_FILE ${_automoc_FILES_PROPERTY})
|
||||
list(APPEND ${_list} ${_current_MOC_FILE})
|
||||
endforeach (_current_MOC_FILE)
|
||||
endif (_automoc_FILES_PROPERTY)
|
||||
endforeach (_current_FILE)
|
||||
endmacro(KDE4_GET_AUTOMOC_FILES)
|
||||
|
||||
macro (KDE4_INSTALL_HANDBOOK )
|
||||
get_filename_component(_tmp_FILE ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
|
||||
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
||||
file(GLOB _books *.docbook)
|
||||
file(GLOB _images *.png)
|
||||
set(relative ${ARGV0})
|
||||
set( dirname ${relative}/${_basename})
|
||||
FILE(MAKE_DIRECTORY ${HTML_INSTALL_DIR}/en/${dirname})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 ${_books} ${_images} DESTINATION ${HTML_INSTALL_DIR}/en/${dirname})
|
||||
# TODO symlinks on non-unix platforms
|
||||
if (UNIX)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT "${HTML_INSTALL_DIR}/en/${dirname}/common"
|
||||
DEPENDS "${HTML_INSTALL_DIR}/en/common"
|
||||
COMMAND /bin/ln
|
||||
ARGS -s "${HTML_INSTALL_DIR}/en/common" "${HTML_INSTALL_DIR}/en/${dirname}/common"
|
||||
COMMENT "Symlink")
|
||||
ADD_CUSTOM_TARGET(CreateSymlinks ALL DEPENDS ${HTML_INSTALL_DIR}/en/${dirname}/common)
|
||||
endif (UNIX)
|
||||
endmacro (KDE4_INSTALL_HANDBOOK )
|
||||
|
||||
macro (KDE4_CREATE_HANDBOOK _docbook)
|
||||
get_filename_component(_input ${_docbook} ABSOLUTE)
|
||||
set(_doc ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2)
|
||||
set(_ssheet ${DATA_INSTALL_DIR}/ksgmltools2/customization/kde-chunk.xsl)
|
||||
add_custom_command(OUTPUT ${_doc}
|
||||
COMMAND ${KDE4_MEINPROC_EXECUTABLE} --check --cache ${_doc} ${_input}
|
||||
DEPENDS ${_input} ${_KDE4_MEINPROC_EXECUTABLE_DEP} ${_ssheet}
|
||||
)
|
||||
add_custom_target(handbook ALL DEPENDS ${_doc})
|
||||
endmacro (KDE4_CREATE_HANDBOOK)
|
||||
|
||||
macro (KDE4_CREATE_HTML_HANDBOOK _docbook)
|
||||
get_filename_component(_input ${_docbook} ABSOLUTE)
|
||||
set(_doc ${CMAKE_CURRENT_SOURCE_DIR}/index.html)
|
||||
set(_ssheet ${DATA_INSTALL_DIR}/ksgmltools2/customization/kde-chunk.xsl)
|
||||
add_custom_command(OUTPUT ${_doc}
|
||||
COMMAND ${KDE4_MEINPROC_EXECUTABLE} --check -o ${_doc} ${_input}
|
||||
DEPENDS ${_input} ${_KDE4_MEINPROC_EXECUTABLE_DEP} ${_ssheet}
|
||||
)
|
||||
add_custom_target(htmlhandbook ALL DEPENDS ${_doc})
|
||||
endmacro (KDE4_CREATE_HTML_HANDBOOK)
|
||||
|
||||
# only used internally by KDE4_INSTALL_ICONS
|
||||
MACRO (_KDE4_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME)
|
||||
|
||||
# if the string doesn't match the pattern, the result is the full string, so all three have the same content
|
||||
IF (NOT ${_group} STREQUAL ${_install_NAME} )
|
||||
SET(_icon_GROUP "actions")
|
||||
|
||||
IF (${_group} STREQUAL "mime")
|
||||
SET(_icon_GROUP "mimetypes")
|
||||
ENDIF (${_group} STREQUAL "mime")
|
||||
|
||||
IF (${_group} STREQUAL "filesys")
|
||||
SET(_icon_GROUP "filesystems")
|
||||
ENDIF (${_group} STREQUAL "filesys")
|
||||
|
||||
IF (${_group} STREQUAL "device")
|
||||
SET(_icon_GROUP "devices")
|
||||
ENDIF (${_group} STREQUAL "device")
|
||||
|
||||
IF (${_group} STREQUAL "app")
|
||||
SET(_icon_GROUP "apps")
|
||||
ENDIF (${_group} STREQUAL "app")
|
||||
|
||||
IF (${_group} STREQUAL "action")
|
||||
SET(_icon_GROUP "actions")
|
||||
ENDIF (${_group} STREQUAL "action")
|
||||
|
||||
# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
|
||||
INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} )
|
||||
ENDIF (NOT ${_group} STREQUAL ${_install_NAME} )
|
||||
|
||||
ENDMACRO (_KDE4_ADD_ICON_INSTALL_RULE)
|
||||
|
||||
|
||||
macro (KDE4_INSTALL_ICONS _defaultpath )
|
||||
|
||||
# first the png icons
|
||||
file(GLOB _icons *.png)
|
||||
foreach (_current_ICON ${_icons} )
|
||||
string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _type "${_current_ICON}")
|
||||
string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _size "${_current_ICON}")
|
||||
string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _group "${_current_ICON}")
|
||||
string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\4" _name "${_current_ICON}")
|
||||
set(_theme_GROUP "nogroup")
|
||||
|
||||
if( ${_type} STREQUAL "ox" )
|
||||
set(_theme_GROUP "oxygen")
|
||||
endif(${_type} STREQUAL "ox" )
|
||||
|
||||
if( ${_type} STREQUAL "cr" )
|
||||
set(_theme_GROUP "crystalsvg")
|
||||
endif(${_type} STREQUAL "cr" )
|
||||
|
||||
if( ${_type} STREQUAL "lo" )
|
||||
set(_theme_GROUP "locolor")
|
||||
endif(${_type} STREQUAL "lo" )
|
||||
|
||||
if( ${_type} STREQUAL "hi" )
|
||||
set(_theme_GROUP "hicolor")
|
||||
endif(${_type} STREQUAL "hi" )
|
||||
|
||||
if( NOT ${_theme_GROUP} STREQUAL "nogroup")
|
||||
_KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
|
||||
${_defaultpath}/${_theme_GROUP}/${_size}x${_size}
|
||||
${_group} ${_current_ICON} ${_name})
|
||||
endif( NOT ${_theme_GROUP} STREQUAL "nogroup")
|
||||
|
||||
endforeach (_current_ICON)
|
||||
|
||||
# mng icons
|
||||
file(GLOB _icons *.mng)
|
||||
foreach (_current_ICON ${_icons} )
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\1" _type "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\2" _size "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\3" _group "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\4" _name "${_current_ICON}")
|
||||
SET(_theme_GROUP "nogroup")
|
||||
|
||||
if( ${_type} STREQUAL "ox" )
|
||||
SET(_theme_GROUP "oxygen")
|
||||
endif(${_type} STREQUAL "ox" )
|
||||
|
||||
if( ${_type} STREQUAL "cr" )
|
||||
SET(_theme_GROUP "crystalsvg")
|
||||
endif(${_type} STREQUAL "cr" )
|
||||
|
||||
if( ${_type} STREQUAL "lo" )
|
||||
set(_theme_GROUP "locolor")
|
||||
endif(${_type} STREQUAL "lo" )
|
||||
|
||||
if( ${_type} STREQUAL "hi" )
|
||||
set(_theme_GROUP "hicolor")
|
||||
endif(${_type} STREQUAL "hi" )
|
||||
|
||||
if( NOT ${_theme_GROUP} STREQUAL "nogroup")
|
||||
_KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
|
||||
${_defaultpath}/${_theme_GROUP}/${_size}x${_size}
|
||||
${_group} ${_current_ICON} ${_name})
|
||||
endif( NOT ${_theme_GROUP} STREQUAL "nogroup")
|
||||
|
||||
endforeach (_current_ICON)
|
||||
|
||||
|
||||
# and now the svg icons
|
||||
file(GLOB _icons *.svgz)
|
||||
foreach (_current_ICON ${_icons} )
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _type "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _group "${_current_ICON}")
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\3" _name "${_current_ICON}")
|
||||
SET(_theme_GROUP "nogroup")
|
||||
|
||||
if(${_type} STREQUAL "ox" )
|
||||
SET(_theme_GROUP "oxygen")
|
||||
endif(${_type} STREQUAL "ox" )
|
||||
|
||||
if(${_type} STREQUAL "cr" )
|
||||
SET(_theme_GROUP "crystalsvg")
|
||||
endif(${_type} STREQUAL "cr" )
|
||||
|
||||
if(${_type} STREQUAL "hi" )
|
||||
SET(_theme_GROUP "hicolor")
|
||||
endif(${_type} STREQUAL "hi" )
|
||||
|
||||
if(${_type} STREQUAL "lo" )
|
||||
SET(_theme_GROUP "locolor")
|
||||
endif(${_type} STREQUAL "lo" )
|
||||
|
||||
if( NOT ${_theme_GROUP} STREQUAL "nogroup")
|
||||
_KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
|
||||
${_defaultpath}/${_theme_GROUP}/scalable
|
||||
${_group} ${_current_ICON} ${_name})
|
||||
endif( NOT ${_theme_GROUP} STREQUAL "nogroup")
|
||||
|
||||
endforeach (_current_ICON)
|
||||
|
||||
endmacro (KDE4_INSTALL_ICONS)
|
||||
|
||||
|
||||
MACRO (KDE4_INSTALL_LIBTOOL_FILE _target _dir)
|
||||
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
|
||||
|
||||
GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
|
||||
set(_laname ${LIBRARY_OUTPUT_PATH}/${_laname}.la)
|
||||
|
||||
FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
|
||||
FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
|
||||
FILE(APPEND ${_laname} "dlname='${_soname}'\n")
|
||||
FILE(APPEND ${_laname} "# Names of this library\n")
|
||||
FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n")
|
||||
FILE(APPEND ${_laname} "# The name of the static archive\n")
|
||||
FILE(APPEND ${_laname} "old_library=''\n")
|
||||
FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
|
||||
FILE(APPEND ${_laname} "dependency_libs=''\n")
|
||||
# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n")
|
||||
FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
|
||||
FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n")
|
||||
FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
|
||||
FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n")
|
||||
FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
|
||||
FILE(APPEND ${_laname} "libdir='${_dir}'\n")
|
||||
|
||||
INSTALL(FILES ${_laname} DESTINATION ${_dir})
|
||||
ENDMACRO (KDE4_INSTALL_LIBTOOL_FILE)
|
||||
|
||||
|
||||
# For all C++ sources a big source file which includes all the files
|
||||
# is created.
|
||||
# This is not done for the C sources, they are just gathered in a separate list
|
||||
# because they are usually not written by KDE and as such not intended to be
|
||||
# compiled all-in-one.
|
||||
macro (KDE4_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
|
||||
set(${_filesExcludedFromFinalFile})
|
||||
file(WRITE ${_filenameCPP} "//autogenerated file\n")
|
||||
foreach (_current_FILE ${ARGN})
|
||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
# don't include any generated files in the final-file
|
||||
# because then cmake will not know the dependencies
|
||||
get_source_file_property(_isGenerated ${_abs_FILE} GENERATED)
|
||||
if (_isGenerated)
|
||||
list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE})
|
||||
else (_isGenerated)
|
||||
# don't include c-files in the final-file, because they usually come
|
||||
# from a 3rd party and as such are not intended to be compiled all-in-one
|
||||
string(REGEX MATCH ".+\\.c$" _isCFile ${_abs_FILE})
|
||||
if (_isCFile)
|
||||
list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE})
|
||||
else (_isCFile)
|
||||
file(APPEND ${_filenameCPP} "#include \"${_abs_FILE}\"\n")
|
||||
endif (_isCFile)
|
||||
endif (_isGenerated)
|
||||
endforeach (_current_FILE)
|
||||
|
||||
endmacro (KDE4_CREATE_FINAL_FILES)
|
||||
|
||||
# This macro sets the RPATH related options for libraries, plugins and kdeinit executables.
|
||||
# It overrides the defaults set in FindKDE4Internal.cmake.
|
||||
# If RPATH is not explicitely disabled, libraries and plugins are built without RPATH, in
|
||||
# the hope that the RPATH which is compiled into the executable is good enough.
|
||||
macro (KDE4_HANDLE_RPATH_FOR_LIBRARY _target_NAME)
|
||||
if (NOT CMAKE_SKIP_RPATH AND NOT KDE4_USE_ALWAYS_FULL_RPATH)
|
||||
set_target_properties(${_target_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH "")
|
||||
endif (NOT CMAKE_SKIP_RPATH AND NOT KDE4_USE_ALWAYS_FULL_RPATH)
|
||||
endmacro (KDE4_HANDLE_RPATH_FOR_LIBRARY)
|
||||
|
||||
# This macro sets the RPATH related options for executables
|
||||
# and creates wrapper shell scripts for the executables.
|
||||
# It overrides the defaults set in FindKDE4Internal.cmake.
|
||||
# For every executable a wrapper script is created, which sets the appropriate
|
||||
# environment variable for the platform (LD_LIBRARY_PATH on most UNIX systems,
|
||||
# DYLD_LIBRARY_PATH on OS X and PATH in Windows) so that it points to the built
|
||||
# but not yet installed versions of the libraries. So if RPATH is disabled, the executables
|
||||
# can be run via these scripts from the build tree and will find the correct libraries.
|
||||
# If RPATH is not disabled, these scripts are also used but only for consistency, because
|
||||
# they don't really influence anything then, because the compiled-in RPATH overrides
|
||||
# the LD_LIBRARY_PATH env. variable.
|
||||
# Executables with the RUN_UNINSTALLED option will be built with the RPATH pointing to the
|
||||
# build dir, so that they can be run safely without being installed, e.g. as code generators
|
||||
# for other stuff during the build. These executables will be relinked during "make install".
|
||||
# All other executables are built with the RPATH with which they will be installed.
|
||||
macro (KDE4_HANDLE_RPATH_FOR_EXECUTABLE _target_NAME _type)
|
||||
if (UNIX)
|
||||
|
||||
# set the RPATH related properties
|
||||
if (NOT CMAKE_SKIP_RPATH)
|
||||
if (${_type} STREQUAL "GUI")
|
||||
set_target_properties(${_target_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
endif (${_type} STREQUAL "GUI")
|
||||
|
||||
if (${_type} STREQUAL "NOGUI")
|
||||
set_target_properties(${_target_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
endif (${_type} STREQUAL "NOGUI")
|
||||
|
||||
if (${_type} STREQUAL "RUN_UNINSTALLED")
|
||||
set_target_properties(${_target_NAME} PROPERTIES SKIP_BUILD_RPATH FALSE BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
endif (${_type} STREQUAL "RUN_UNINSTALLED")
|
||||
endif (NOT CMAKE_SKIP_RPATH)
|
||||
|
||||
if (APPLE)
|
||||
set(_library_path_variable "DYLD_LIBRARY_PATH")
|
||||
else (APPLE)
|
||||
set(_library_path_variable "LD_LIBRARY_PATH")
|
||||
endif (APPLE)
|
||||
|
||||
set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/:${LIB_INSTALL_DIR}:${KDE4_LIB_DIR}:${QT_LIBRARY_DIR}")
|
||||
get_target_property(_executable ${_target_NAME} LOCATION )
|
||||
|
||||
# use add_custom_target() to have the sh-wrapper generated during build time instead of cmake time
|
||||
add_custom_command(TARGET ${_target_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D_filename=${_executable}.shell -D_library_path_variable=${_library_path_variable}
|
||||
-D_ld_library_path="${_ld_library_path}" -D_executable=${_executable}
|
||||
-P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake
|
||||
)
|
||||
|
||||
macro_additional_clean_files(${_executable}.shell)
|
||||
|
||||
# under UNIX, set the property WRAPPER_SCRIPT to the name of the generated shell script
|
||||
# so it can be queried and used later on easily
|
||||
set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT ${_executable}.shell)
|
||||
|
||||
else (UNIX)
|
||||
# under windows, set the property WRAPPER_SCRIPT just to the name of the executable
|
||||
# maybe later this will change to a generated batch file (for setting the PATH so that the Qt libs are found)
|
||||
get_target_property(_executable ${_target_NAME} LOCATION )
|
||||
set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT ${_executable})
|
||||
|
||||
set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}\;${LIB_INSTALL_DIR}\;${KDE4_LIB_DIR}\;${QT_LIBRARY_DIR}")
|
||||
get_target_property(_executable ${_target_NAME} LOCATION )
|
||||
|
||||
# use add_custom_target() to have the batch-file-wrapper generated during build time instead of cmake time
|
||||
add_custom_command(TARGET ${_target_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D_filename="${_executable}.bat"
|
||||
-D_ld_library_path="${_ld_library_path}" -D_executable="${_executable}"
|
||||
-P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake
|
||||
)
|
||||
|
||||
endif (UNIX)
|
||||
endmacro (KDE4_HANDLE_RPATH_FOR_EXECUTABLE)
|
||||
|
||||
|
||||
macro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX)
|
||||
#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise set the prefix empty
|
||||
if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
||||
set(_first_SRC)
|
||||
else (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
||||
set(_first_SRC ${_with_PREFIX})
|
||||
endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
||||
|
||||
kde4_get_automoc_files(_automoc_FILES ${_first_SRC} ${ARGN})
|
||||
|
||||
if (KDE4_ENABLE_FINAL)
|
||||
kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_first_SRC} ${ARGN})
|
||||
add_library(${_target_NAME} MODULE ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES})
|
||||
else (KDE4_ENABLE_FINAL)
|
||||
add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN} ${_automoc_FILES})
|
||||
endif (KDE4_ENABLE_FINAL)
|
||||
|
||||
if (_first_SRC)
|
||||
set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
|
||||
endif (_first_SRC)
|
||||
|
||||
kde4_handle_rpath_for_library(${_target_NAME})
|
||||
|
||||
if (WIN32)
|
||||
# for shared libraries/plugins a -DMAKE_target_LIB is required
|
||||
string(TOUPPER ${_target_NAME} _symbol)
|
||||
set(_symbol "MAKE_${_symbol}_LIB")
|
||||
set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol})
|
||||
endif (WIN32)
|
||||
|
||||
endmacro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX)
|
||||
|
||||
|
||||
# this macro checks is intended to check whether a list of source
|
||||
# files has the "NOGUI" or "RUN_UNINSTALLED" keywords at the beginning
|
||||
# in _output_LIST the list of source files is returned with the "NOGUI"
|
||||
# and "RUN_UNINSTALLED" keywords removed
|
||||
# if "NOGUI" is in the list of files, the _nogui argument is set to
|
||||
# "NOGUI" (which evaluates to TRUE in cmake), otherwise it is set empty
|
||||
# (which evaluates to FALSE in cmake)
|
||||
# if "RUN_UNINSTALLED" is in the list of files, the _uninst argument is set to
|
||||
# "RUN_UNINSTALLED" (which evaluates to TRUE in cmake), otherwise it is set empty
|
||||
# (which evaluates to FALSE in cmake)
|
||||
macro(KDE4_CHECK_EXECUTABLE_PARAMS _output_LIST _nogui _uninst)
|
||||
set(${_nogui})
|
||||
set(${_uninst})
|
||||
set(${_output_LIST} ${ARGN})
|
||||
list(LENGTH ${_output_LIST} count)
|
||||
|
||||
list(GET ${_output_LIST} 0 first_PARAM)
|
||||
|
||||
set(second_PARAM "NOTFOUND")
|
||||
if (${count} GREATER 1)
|
||||
list(GET ${_output_LIST} 1 second_PARAM)
|
||||
endif (${count} GREATER 1)
|
||||
|
||||
set(remove "NOTFOUND")
|
||||
|
||||
if (${first_PARAM} STREQUAL "NOGUI")
|
||||
set(${_nogui} "NOGUI")
|
||||
set(remove 0)
|
||||
endif (${first_PARAM} STREQUAL "NOGUI")
|
||||
|
||||
if (${second_PARAM} STREQUAL "NOGUI")
|
||||
set(${_nogui} "NOGUI")
|
||||
set(remove 0;1)
|
||||
endif (${second_PARAM} STREQUAL "NOGUI")
|
||||
|
||||
if (${first_PARAM} STREQUAL "RUN_UNINSTALLED")
|
||||
set(${_uninst} "RUN_UNINSTALLED")
|
||||
set(remove 0)
|
||||
endif (${first_PARAM} STREQUAL "RUN_UNINSTALLED")
|
||||
|
||||
if (${second_PARAM} STREQUAL "RUN_UNINSTALLED")
|
||||
set(${_uninst} "RUN_UNINSTALLED")
|
||||
set(remove 0;1)
|
||||
endif (${second_PARAM} STREQUAL "RUN_UNINSTALLED")
|
||||
|
||||
if (NOT "${remove}" STREQUAL "NOTFOUND")
|
||||
list(REMOVE_AT ${_output_LIST} ${remove})
|
||||
endif (NOT "${remove}" STREQUAL "NOTFOUND")
|
||||
|
||||
endmacro(KDE4_CHECK_EXECUTABLE_PARAMS)
|
||||
|
||||
|
||||
macro (KDE4_ADD_KDEINIT_EXECUTABLE _target_NAME )
|
||||
|
||||
kde4_check_executable_params(_SRCS _nogui _uninst ${ARGN})
|
||||
|
||||
# if (WIN32)
|
||||
# # under windows, just build a normal executable
|
||||
# KDE4_ADD_EXECUTABLE(${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ${ARGN} )
|
||||
# else (WIN32)
|
||||
# under UNIX, create a shared library and a small executable, which links to this library
|
||||
kde4_get_automoc_files(_automoc_FILES ${_SRCS})
|
||||
|
||||
if (KDE4_ENABLE_FINAL)
|
||||
kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/kdeinit_${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS})
|
||||
add_library(kdeinit_${_target_NAME} SHARED ${CMAKE_CURRENT_BINARY_DIR}/kdeinit_${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES})
|
||||
|
||||
else (KDE4_ENABLE_FINAL)
|
||||
add_library(kdeinit_${_target_NAME} SHARED ${_SRCS} ${_automoc_FILES})
|
||||
endif (KDE4_ENABLE_FINAL)
|
||||
|
||||
kde4_handle_rpath_for_library(kdeinit_${_target_NAME})
|
||||
|
||||
|
||||
configure_file(${KDE4_MODULE_DIR}/kde4init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
|
||||
kde4_add_executable(${_target_NAME} "${_nogui}" "${_uninst}" ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
|
||||
target_link_libraries(${_target_NAME} kdeinit_${_target_NAME})
|
||||
# endif (WIN32)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(${_target_NAME} ${QT_QTMAIN_LIBRARY})
|
||||
endif (WIN32)
|
||||
|
||||
endmacro (KDE4_ADD_KDEINIT_EXECUTABLE)
|
||||
|
||||
macro (KDE4_ADD_EXECUTABLE _target_NAME)
|
||||
|
||||
kde4_check_executable_params( _SRCS _nogui _uninst ${ARGN})
|
||||
|
||||
set(_add_executable_param)
|
||||
set(_type "GUI")
|
||||
|
||||
# determine additional parameters for add_executable()
|
||||
# for GUI apps, create a bundle on OSX
|
||||
if (APPLE)
|
||||
set(_add_executable_param MACOSX_BUNDLE)
|
||||
endif (APPLE)
|
||||
|
||||
# for GUI apps, this disables the additional console under Windows
|
||||
if (WIN32)
|
||||
set(_add_executable_param WIN32)
|
||||
endif (WIN32)
|
||||
|
||||
if (_nogui)
|
||||
set(_type "NOGUI")
|
||||
set(_add_executable_param)
|
||||
endif (_nogui)
|
||||
|
||||
if (_uninst)
|
||||
set(_type "RUN_UNINSTALLED")
|
||||
endif (_uninst)
|
||||
|
||||
kde4_get_automoc_files(_automoc_FILES ${_SRCS})
|
||||
|
||||
if (KDE4_ENABLE_FINAL)
|
||||
kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS})
|
||||
add_executable(${_target_NAME} ${_add_executable_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES})
|
||||
else (KDE4_ENABLE_FINAL)
|
||||
add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS} ${_automoc_FILES})
|
||||
endif (KDE4_ENABLE_FINAL)
|
||||
|
||||
kde4_handle_rpath_for_executable(${_target_NAME} ${_type})
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(${_target_NAME} ${QT_QTMAIN_LIBRARY})
|
||||
endif (WIN32)
|
||||
|
||||
endmacro (KDE4_ADD_EXECUTABLE)
|
||||
|
||||
|
||||
MACRO (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE)
|
||||
#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise set the prefix empty
|
||||
|
||||
set(_first_SRC ${_lib_TYPE})
|
||||
set(_add_lib_param)
|
||||
|
||||
if (${_lib_TYPE} STREQUAL "STATIC")
|
||||
set(_first_SRC)
|
||||
set(_add_lib_param STATIC)
|
||||
endif (${_lib_TYPE} STREQUAL "STATIC")
|
||||
if (${_lib_TYPE} STREQUAL "SHARED")
|
||||
set(_first_SRC)
|
||||
set(_add_lib_param SHARED)
|
||||
endif (${_lib_TYPE} STREQUAL "SHARED")
|
||||
if (${_lib_TYPE} STREQUAL "MODULE")
|
||||
set(_first_SRC)
|
||||
set(_add_lib_param MODULE)
|
||||
endif (${_lib_TYPE} STREQUAL "MODULE")
|
||||
|
||||
kde4_get_automoc_files(_automoc_FILES ${_first_SRC} ${ARGN})
|
||||
|
||||
if (KDE4_ENABLE_FINAL)
|
||||
kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_first_SRC} ${ARGN})
|
||||
add_library(${_target_NAME} ${_add_lib_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES})
|
||||
else (KDE4_ENABLE_FINAL)
|
||||
add_library(${_target_NAME} ${_add_lib_param} ${_first_SRC} ${ARGN} ${_automoc_FILES})
|
||||
endif (KDE4_ENABLE_FINAL)
|
||||
|
||||
kde4_handle_rpath_for_library(${_target_NAME})
|
||||
|
||||
if (WIN32)
|
||||
# for shared libraries a -DMAKE_target_LIB is required
|
||||
string(TOUPPER ${_target_NAME} _symbol)
|
||||
set(_symbol "MAKE_${_symbol}_LIB")
|
||||
set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol})
|
||||
endif (WIN32)
|
||||
|
||||
ENDMACRO (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE)
|
||||
|
||||
|
||||
macro (KDE4_ADD_WIDGET_FILES _sources)
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
get_filename_component(_input ${_current_FILE} ABSOLUTE)
|
||||
get_filename_component(_basename ${_input} NAME_WE)
|
||||
set(_source ${CMAKE_CURRENT_BINARY_DIR}/${_basename}widgets.cpp)
|
||||
set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}widgets.moc)
|
||||
|
||||
# create source file from the .widgets file
|
||||
add_custom_command(OUTPUT ${_source}
|
||||
COMMAND ${KDE4_MAKEKDEWIDGETS_EXECUTABLE}
|
||||
ARGS -o ${_source} ${_input}
|
||||
MAIN_DEPENDENCY ${_input} DEPENDS ${_KDE4_MAKEKDEWIDGETS_DEP})
|
||||
|
||||
# create moc file
|
||||
qt4_generate_moc(${_source} ${_moc} )
|
||||
|
||||
list(APPEND ${_sources} ${_source} ${_moc})
|
||||
|
||||
endforeach (_current_FILE)
|
||||
|
||||
endmacro (KDE4_ADD_WIDGET_FILES)
|
||||
|
||||
MACRO(KDE4_ADD_DCOP_SKELS)
|
||||
MESSAGE(FATAL_ERROR "There is a call to KDE4_ADD_DCOP_SKELS() in the CMakeLists.txt for '${ARGV0}', but DCOP is no longer supported by KDE4.
|
||||
Please remove it and port to DBUS.")
|
||||
ENDMACRO(KDE4_ADD_DCOP_SKELS)
|
||||
|
||||
MACRO(KDE4_ADD_DCOP_STUBS)
|
||||
MESSAGE(FATAL_ERROR "There is a call to KDE4_ADD_DCOP_STUBS() in the CMakeLists.txt for '${ARGV0}', but DCOP is no longer supported by KDE4.
|
||||
Please remove it and port to DBUS.")
|
||||
ENDMACRO(KDE4_ADD_DCOP_STUBS)
|
||||
|
||||
MACRO(KDE4_REMOVE_OBSOLETE_CMAKE_FILES)
|
||||
# the files listed here will be removed by remove_obsoleted_cmake_files.cmake, Alex
|
||||
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake )
|
||||
set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules )
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake "#generated by cmake, dont edit\n\n")
|
||||
foreach ( _current_FILE ${ARGN})
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake "message(STATUS \"Removing ${module_install_dir}/${_current_FILE}\" )\n" )
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake "exec_program( ${CMAKE_COMMAND} ARGS -E remove ${module_install_dir}/${_current_FILE} OUTPUT_VARIABLE _dummy)\n" )
|
||||
endforeach ( _current_FILE)
|
||||
|
||||
ENDMACRO(KDE4_REMOVE_OBSOLETE_CMAKE_FILES)
|
||||
|
||||
MACRO(KDE4_NO_ENABLE_FINAL _project_name)
|
||||
if(KDE4_ENABLE_FINAL)
|
||||
set(KDE4_ENABLE_FINAL OFF)
|
||||
REMOVE_DEFINITIONS(-DKDE_USE_FINAL)
|
||||
MESSAGE(STATUS "You used enable-final argument but \"${_project_name}\" doesn't support it. Try to fix compile it and remove KDE4_NO_ENABLE_FINAL macro. Thanks")
|
||||
|
||||
endif(KDE4_ENABLE_FINAL)
|
||||
ENDMACRO(KDE4_NO_ENABLE_FINAL _project_name)
|
||||
|
||||
|
||||
FIND_PROGRAM(MSGFMT
|
||||
NAMES gmsgfmt msgfmt
|
||||
PATHS ${BIN_SEARCH_PATHES})
|
||||
|
||||
IF(MSGFMT)
|
||||
EXECUTE_PROCESS(COMMAND ${MSGFMT} "--version" "2>&1"
|
||||
OUTPUT_VARIABLE _msgout)
|
||||
STRING(REGEX MATCH "GNU[\t ]gettext" _isgnu "${_msgout}")
|
||||
IF (NOT _isgnu)
|
||||
MESSAGE(STATUS "No gnu msgfmt found!")
|
||||
SET(MSGFMT ":" CACHE STRING "Msgfmt program")
|
||||
ELSE(NOT _isgnu)
|
||||
MESSAGE(STATUS "Found gnu msgfmt: ${MSGFMT}")
|
||||
ENDIF (NOT _isgnu)
|
||||
ELSE(MSGFMT)
|
||||
SET(MSGFMT ":" CACHE STRING "Msgfmt program")
|
||||
MESSAGE( FATAL_ERROR "Could NOT find Msgfmt program")
|
||||
ENDIF(MSGFMT)
|
||||
|
||||
MACRO(ADD_POFILES packagename)
|
||||
SET(_gmofiles)
|
||||
FILE(GLOB _pofiles *.po)
|
||||
|
||||
FOREACH(_current_po ${_pofiles})
|
||||
GET_FILENAME_COMPONENT(_name ${_current_po} NAME_WE)
|
||||
STRING(REGEX REPLACE "^.*/([a-zA-Z]+)(\\.po)" "\\1" _lang "${_current_po}")
|
||||
SET(_gmofile "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gmo")
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${_gmofile}
|
||||
COMMAND ${MSGFMT}
|
||||
ARGS "-o" "${_gmofile}" "${_current_po}"
|
||||
DEPENDS ${_current_po}
|
||||
)
|
||||
SET(_gmofiles ${_gmofiles} ${_gmofile})
|
||||
INSTALL(FILES ${_gmofile}
|
||||
DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES
|
||||
RENAME ${packagename}.mo)
|
||||
ENDFOREACH(_current_po ${_pofiles})
|
||||
|
||||
ADD_CUSTOM_TARGET(translations ALL
|
||||
DEPENDS ${_gmofiles})
|
||||
|
||||
ENDMACRO(ADD_POFILES)
|
@ -0,0 +1,19 @@
|
||||
# - MACRO_ADD_COMPILE_FLAGS(<_target> "flags...")
|
||||
|
||||
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_ADD_COMPILE_FLAGS _target _flg)
|
||||
|
||||
GET_TARGET_PROPERTY(_flags ${_target} COMPILE_FLAGS)
|
||||
if (_flags)
|
||||
set(_flags "${_flags} ${_flg}")
|
||||
else (_flags)
|
||||
set(_flags "${_flg}")
|
||||
endif (_flags)
|
||||
SET_TARGET_PROPERTIES(${_target} PROPERTIES COMPILE_FLAGS "${_flags}")
|
||||
|
||||
ENDMACRO (MACRO_ADD_COMPILE_FLAGS)
|
@ -0,0 +1,20 @@
|
||||
# MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_ADD_FILE_DEPENDENCIES _file)
|
||||
|
||||
GET_SOURCE_FILE_PROPERTY(_deps ${_file} OBJECT_DEPENDS)
|
||||
if (_deps)
|
||||
set(_deps ${_deps} ${ARGN})
|
||||
else (_deps)
|
||||
set(_deps ${ARGN})
|
||||
endif (_deps)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
|
||||
|
||||
ENDMACRO (MACRO_ADD_FILE_DEPENDENCIES)
|
@ -0,0 +1,18 @@
|
||||
# - MACRO_ADD_LINK_FLAGS(<_target> "flags...")
|
||||
|
||||
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO (MACRO_ADD_LINK_FLAGS _target _flg)
|
||||
|
||||
GET_TARGET_PROPERTY(_flags ${_target} LINK_FLAGS)
|
||||
if (_flags)
|
||||
set(_flags "${_flags} ${_flg}")
|
||||
else (_flags)
|
||||
set(_flags "${_flg}")
|
||||
endif (_flags)
|
||||
SET_TARGET_PROPERTIES(${_target} PROPERTIES LINK_FLAGS "${_flags}")
|
||||
|
||||
ENDMACRO (MACRO_ADD_LINK_FLAGS)
|
@ -0,0 +1,21 @@
|
||||
# - MACRO_ADDITIONAL_CLEAN_FILES(files...)
|
||||
# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_ADDITIONAL_CLEAN_FILES)
|
||||
GET_DIRECTORY_PROPERTY(_tmp_DIR_PROPS ADDITIONAL_MAKE_CLEAN_FILES )
|
||||
|
||||
if (_tmp_DIR_PROPS)
|
||||
set(_tmp_DIR_PROPS ${_tmp_DIR_PROPS} ${ARGN})
|
||||
else (_tmp_DIR_PROPS)
|
||||
set(_tmp_DIR_PROPS ${ARGN})
|
||||
endif (_tmp_DIR_PROPS)
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${_tmp_DIR_PROPS}")
|
||||
ENDMACRO (MACRO_ADDITIONAL_CLEAN_FILES)
|
||||
|
@ -0,0 +1,20 @@
|
||||
# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN )
|
||||
# This macro evaluates its first argument
|
||||
# and sets all the given vaiables either to 0 or 1
|
||||
# depending on the value of the first one
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
|
||||
FOREACH (_current_VAR ${ARGN})
|
||||
IF(${FOUND_VAR})
|
||||
SET(${_current_VAR} 1)
|
||||
ELSE(${FOUND_VAR})
|
||||
SET(${_current_VAR} 0)
|
||||
ENDIF(${FOUND_VAR})
|
||||
ENDFOREACH(_current_VAR)
|
||||
ENDMACRO(MACRO_BOOL_TO_01)
|
@ -0,0 +1,16 @@
|
||||
# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
|
||||
|
||||
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
|
||||
IF(insource)
|
||||
MESSAGE(FATAL_ERROR "${_errorMessage}")
|
||||
ENDIF(insource)
|
||||
|
||||
ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
|
@ -0,0 +1,35 @@
|
||||
# This macro compares version numbers of the form "x.y.z"
|
||||
# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
|
||||
# will set FOO_VERSIN_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
|
||||
# where both have to be in a 3-part-version format, leading and trailing
|
||||
# text is ok, e.g.
|
||||
# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
|
||||
# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
|
||||
|
||||
# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
|
||||
|
||||
# parse the parts of the version string
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_major_vers "${requested_version}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" req_minor_vers "${requested_version}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_patch_vers "${requested_version}")
|
||||
|
||||
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_major_vers "${found_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" found_minor_vers "${found_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_patch_vers "${found_version}")
|
||||
|
||||
# compute an overall version number which can be compared at once
|
||||
MATH(EXPR req_vers_num "${req_major_vers}*10000 + ${req_minor_vers}*100 + ${req_patch_vers}")
|
||||
MATH(EXPR found_vers_num "${found_major_vers}*10000 + ${found_minor_vers}*100 + ${found_patch_vers}")
|
||||
|
||||
if (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} FALSE )
|
||||
else (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} TRUE )
|
||||
endif (found_vers_num LESS req_vers_num)
|
||||
|
||||
ENDMACRO(MACRO_ENSURE_VERSION)
|
@ -0,0 +1,18 @@
|
||||
# - include MacroLibrary offers a collection of macros which extend the built-in cmake commands
|
||||
# OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
INCLUDE(MacroOptionalFindPackage)
|
||||
INCLUDE(MacroOptionalAddSubdirectory)
|
||||
INCLUDE(MacroAdditionalCleanFiles)
|
||||
INCLUDE(MacroAddFileDependencies)
|
||||
INCLUDE(MacroAddCompileFlags)
|
||||
INCLUDE(MacroAddLinkFlags)
|
||||
INCLUDE(MacroEnsureOutOfSourceBuild)
|
||||
INCLUDE(MacroBoolTo01)
|
||||
INCLUDE(MacroPushRequiredVars)
|
||||
INCLUDE(MacroLogFeature)
|
@ -0,0 +1,112 @@
|
||||
# This file defines the Feature Logging macros.
|
||||
#
|
||||
# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
|
||||
# Logs the information so that it can be displayed at the end
|
||||
# of the configure run
|
||||
# VAR : TRUE or FALSE, indicating whether the feature is supported
|
||||
# FEATURE: name of the feature, e.g. "libjpeg"
|
||||
# DESCRIPTION: description what this feature provides
|
||||
# URL: home page
|
||||
# REQUIRED: TRUE or FALSE, indicating whether the featue is required
|
||||
# MIN_VERSION: minimum version number. empty string if unneeded
|
||||
# COMMENTS: More info you may want to provide. empty string if unnecessary
|
||||
#
|
||||
# MACRO_DISPLAY_FEATURE_LOG()
|
||||
# Call this to display the collected results.
|
||||
# Exits CMake with a FATAL error message if a required feature is missing
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# INCLUDE(MacroLogFeature)
|
||||
#
|
||||
# FIND_PACKAGE(JPEG)
|
||||
# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
|
||||
# ...
|
||||
# MACRO_DISPLAY_FEATURE_LOG()
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
# Copyright (c) 2006, Allen Winter, <winter@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
IF (NOT _macroLogFeatureAlreadyIncluded)
|
||||
SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(REMOVE ${_file})
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(REMOVE ${_file})
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(REMOVE ${_file})
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_macroLogFeatureAlreadyIncluded TRUE)
|
||||
ENDIF (NOT _macroLogFeatureAlreadyIncluded)
|
||||
|
||||
|
||||
MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
|
||||
|
||||
SET(_required "${ARGV4}")
|
||||
SET(_minvers "${ARGV5}")
|
||||
SET(_comments "${ARGV6}")
|
||||
|
||||
IF (${_var})
|
||||
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
|
||||
ELSE (${_var})
|
||||
IF (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
|
||||
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
|
||||
ELSE (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
|
||||
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
|
||||
ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
|
||||
ENDIF (${_var})
|
||||
|
||||
SET(_logtext "> ${_package}")
|
||||
|
||||
IF (${_minvers} MATCHES ".*")
|
||||
SET(_logtext "${_logtext}, ${_minvers}")
|
||||
ENDIF (${_minvers} MATCHES ".*")
|
||||
SET(_logtext "${_logtext}: ${_description}; ${_url};")
|
||||
IF (${_comments} MATCHES ".*")
|
||||
SET(_logtext "${_logtext}\n${_comments}")
|
||||
ENDIF (${_comments} MATCHES ".*")
|
||||
FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n\n")
|
||||
|
||||
ENDMACRO(MACRO_LOG_FEATURE)
|
||||
|
||||
|
||||
MACRO(MACRO_DISPLAY_FEATURE_LOG)
|
||||
|
||||
SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(READ ${_file} _requirements)
|
||||
MESSAGE(STATUS "\n----------------------------------------------------------------------------------\n-- The following list of REQUIRED packages could not be located on your system. --\n-- Please install them before continuing with this software installation. --\n----------------------------------------------------------------------------------\n${_requirements}----------------------------------------------------------------------------------")
|
||||
# MESSAGE(STATUS "MISSING REQUIREMENTS\n${_requirements}\n")
|
||||
FILE(REMOVE ${_file})
|
||||
MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_summary "\n")
|
||||
SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(READ ${_file} _enabled)
|
||||
FILE(REMOVE ${_file})
|
||||
SET(_summary "${_summary}----------------------------------------------------------------------------------\n-- The following list of OPTIONAL packages were located on your system. --\n-- You will have all the following features available from this software. --\n----------------------------------------------------------------------------------\n${_enabled}")
|
||||
# SET(_summary "${_summary}Enabled Features:\n${_enabled}")
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(READ ${_file} _disabled)
|
||||
FILE(REMOVE ${_file})
|
||||
SET(_summary "${_summary}----------------------------------------------------------------------------------\n-- The following list of OPTIONAL packages could not be located on your system. --\n-- Please consider installing them to enable more features of this software. --\n----------------------------------------------------------------------------------\n${_disabled}")
|
||||
# SET(_summary "${_summary}Disabled Features:\n${_disabled}")
|
||||
ENDIF (EXISTS ${_file})
|
||||
MESSAGE(STATUS "${_summary}")
|
||||
|
||||
ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)
|
@ -0,0 +1,27 @@
|
||||
# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
|
||||
# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
|
||||
# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
|
||||
# this will have two effects
|
||||
# 1 - CMake will not complain if the directory doesn't exist
|
||||
# This makes sense if you want to distribute just one of the subdirs
|
||||
# in a source package, e.g. just one of the subdirs in kdeextragear.
|
||||
# 2 - If the directory exists, it will offer an option to skip the
|
||||
# subdirectory.
|
||||
# This is useful if you want to compile only a subset of all
|
||||
# directories.
|
||||
|
||||
# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
|
||||
GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
|
||||
IF(EXISTS ${_fullPath})
|
||||
OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE)
|
||||
IF(BUILD_${_dir})
|
||||
ADD_SUBDIRECTORY(${_dir})
|
||||
ENDIF(BUILD_${_dir})
|
||||
ENDIF(EXISTS ${_fullPath})
|
||||
ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)
|
@ -0,0 +1,28 @@
|
||||
# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
|
||||
# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
|
||||
# This macro is a combination of OPTION() and FIND_PACKAGE(), it
|
||||
# works like FIND_PACKAGE(), but additionally it automatically creates
|
||||
# an option name WITH_<name>, which can be disabled via the cmake GUI.
|
||||
# or via -DWITH_<name>=OFF
|
||||
# The standard <name>_FOUND variables can be used in the same way
|
||||
# as when using the normal FIND_PACKAGE()
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
|
||||
OPTION(WITH_${_name} "Search for ${_name} package" ON)
|
||||
if (WITH_${_name})
|
||||
FIND_PACKAGE(${_name} ${ARGN})
|
||||
else (WITH_${_name})
|
||||
set(${_name}_FOUND)
|
||||
set(${_name}_INCLUDE_DIR)
|
||||
set(${_name}_INCLUDES)
|
||||
set(${_name}_LIBRARY)
|
||||
set(${_name}_LIBRARIES)
|
||||
endif (WITH_${_name})
|
||||
ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
|
||||
|
@ -0,0 +1,47 @@
|
||||
# this module defines two macros:
|
||||
# MACRO_PUSH_REQUIRED_VARS()
|
||||
# and
|
||||
# MACRO_POP_REQUIRED_VARS()
|
||||
# use these if you call cmake macros which use
|
||||
# any of the CMAKE_REQUIRED_XXX variables
|
||||
#
|
||||
# Usage:
|
||||
# MACRO_PUSH_REQUIRED_VARS()
|
||||
# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
|
||||
# CHECK_FUNCTION_EXISTS(...)
|
||||
# MACRO_POP_REQUIRED_VARS()
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO(MACRO_PUSH_REQUIRED_VARS)
|
||||
|
||||
IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
|
||||
SET(_PUSH_REQUIRED_VARS_COUNTER 0)
|
||||
ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
|
||||
|
||||
MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1")
|
||||
|
||||
SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
|
||||
SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS})
|
||||
ENDMACRO(MACRO_PUSH_REQUIRED_VARS)
|
||||
|
||||
MACRO(MACRO_POP_REQUIRED_VARS)
|
||||
|
||||
# don't pop more than we pushed
|
||||
IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
|
||||
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
|
||||
|
||||
MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1")
|
||||
ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
|
||||
|
||||
ENDMACRO(MACRO_POP_REQUIRED_VARS)
|
||||
|
@ -0,0 +1,16 @@
|
||||
FILE(WRITE ${OUTPUTFILE} "# ${OUTPUTFILE} - a libtool library file, generated by cmake \n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# The name that we can dlopen(3).\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "dlname='${SONAME}'\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Names of this library\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "library_names='${SONAME} ${SONAME} ${SONAME}'\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# The name of the static archive\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "old_library=''\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Libraries that this one depends upon.\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "dependency_libs=''\n")
|
||||
# FILE(APPEND ${OUTPUTFILE} "dependency_libs='${${_target}_LIB_DEPENDS}'\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Is this an already installed library?\ninstalled=yes\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "# Directory that this library needs to be installed in:\n")
|
||||
FILE(APPEND ${OUTPUTFILE} "libdir='${LIBDIR}'\n")
|
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
# used internally by KDE3Macros.cmake
|
||||
# neundorf@kde.org
|
||||
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE}
|
||||
-L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n
|
||||
-impl ${KDE_UIC_H_FILE}
|
||||
${KDE_UIC_FILE}
|
||||
OUTPUT_VARIABLE _uic_CONTENTS
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
STRING(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
|
||||
STRING(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
|
||||
|
||||
FILE(WRITE ${KDE_UIC_CPP_FILE} "#include <kdialog.h>\n#include <klocale.h>\n\n")
|
||||
FILE(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}")
|
||||
|
@ -0,0 +1,50 @@
|
||||
|
||||
MACRO(KDESVN_CHECK_LINK_FLAG FLAGS VARIABLE)
|
||||
IF(NOT DEFINED ${VARIABLE})
|
||||
TRY_COMPILE(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
|
||||
CMAKE_FLAGS -DCMAKE_EXE_LINKER_FLAGS="${FLAGS}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
IF (${VARIABLE})
|
||||
MESSAGE(STATUS "Checking to see if linker accepts flag ${FLAGS} - yes")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the linker accepts the flag ${FLAGS} passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ELSE (${VARIABLE})
|
||||
MESSAGE(STATUS "Checking to see if linker accepts flag ${FLAGS} - no")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
|
||||
"Determining if the linker accepts the flag ${FLAGS} failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF (${VARIABLE})
|
||||
ENDIF(NOT DEFINED ${VARIABLE})
|
||||
ENDMACRO(KDESVN_CHECK_LINK_FLAG)
|
||||
|
||||
# this macro is required to add libtools to normal build so
|
||||
# we may debug our part from within build dir
|
||||
# output name where
|
||||
# _laname _soname ${LIBRARY_OUTPUT_PATH}/kde3
|
||||
MACRO(KDESVN_GENERATE_LIBTOOL_FILE _target)
|
||||
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
|
||||
GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
|
||||
IF(LIBRARY_OUTPUT_PATH)
|
||||
SET(_laname ${LIBRARY_OUTPUT_PATH}/${_laname}.la)
|
||||
ELSE(LIBRARY_OUTPUT_PATH)
|
||||
SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)
|
||||
ENDIF(LIBRARY_OUTPUT_PATH)
|
||||
IF(LIBRARY_OUTPUT_PATH)
|
||||
SET(_libdir "'${LIBRARY_OUTPUT_PATH}/kde3'")
|
||||
ELSE(LIBRARY_OUTPUT_PATH)
|
||||
SET(_libdir "'${CMAKE_CURRENT_BUILD_DIR}/kde3'")
|
||||
ENDIF(LIBRARY_OUTPUT_PATH)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${_target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS
|
||||
-DOUTPUTFILE:FILEPATH=${_laname}
|
||||
-DSONAME:STRING=${_soname}
|
||||
-DLIBDIR:STRING=${_libdir}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmakemodules/generatelibtoolfile.cmake
|
||||
)
|
||||
ENDMACRO(KDESVN_GENERATE_LIBTOOL_FILE)
|
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
VERSION=@VERSION@
|
||||
SRCROOT=@CMAKE_SOURCE_DIR@
|
||||
BUILDDIR=@CMAKE_BINARY_DIR@
|
||||
PROJECT=@PROJECT_NAME@
|
||||
GENTOO_VERSION=@GENTOO_VERSION@
|
||||
|
||||
EXCLUDE="@DIST_EXCLUDE@"
|
||||
INCLUDE="@DIST_INCLUDE@"
|
||||
EXPORT_DIR="${PROJECT}-${VERSION}"
|
||||
|
||||
if [ ! -d ${SRCROOT}/.svn ]; then
|
||||
echo "This script must run for a svn dir!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Exporting source tree"
|
||||
svn export "${SRCROOT}" ${EXPORT_DIR}
|
||||
|
||||
echo "Copy required files to export"
|
||||
for i in $INCLUDE ; do
|
||||
echo " $i"
|
||||
cp ${BUILDDIR}/$i ${EXPORT_DIR}
|
||||
done
|
||||
|
||||
echo "Removing not needed stuff"
|
||||
for i in $EXCLUDE ; do
|
||||
echo " $i"
|
||||
rm -rf $EXPORT_DIR/$i
|
||||
done
|
||||
|
||||
echo "Generating archive"
|
||||
tar cjf ${BUILDDIR}/${PROJECT}-${VERSION}.tar.bz2 ${EXPORT_DIR}
|
||||
|
||||
echo "Cleaning up"
|
||||
rm -rf ${EXPORT_DIR}
|
@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
|
||||
# little helper script for regenerating translation files. Mostly taken from cvs.sh from kde-autotool environment
|
||||
# adapted to a cmake build environment and removed a lot not realy needed stuff
|
||||
#EXTRACTRC=@EXTRACTRC@
|
||||
#PREPARETIPS=@PREPARETIPS@
|
||||
MESSAGES_DIR=@MESSAGES_DIR@
|
||||
SOURCE_DIR=@CMAKE_SOURCE_DIR@
|
||||
MAKE=make
|
||||
POFILES="@POFILES@"
|
||||
podir="${SOURCE_DIR}/po"
|
||||
|
||||
|
||||
cd ${SOURCE_DIR}
|
||||
rm -rf po.backup
|
||||
mkdir po.backup
|
||||
|
||||
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
|
||||
egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i
|
||||
cp po/$i po.backup/backup_$i
|
||||
touch -r po/$i po.backup/backup_$i
|
||||
rm po/$i
|
||||
done
|
||||
|
||||
podir=${podir:-$PWD/po}
|
||||
#files=`find . -name Makefile.am | xargs egrep -l '^messages:' `
|
||||
#dirs=`for i in $files; do echo \`dirname $i\`; done`
|
||||
dirs=${MESSAGES_DIR}
|
||||
tmpname="$PWD/messages.log"
|
||||
if test -z "$EXTRACTRC"; then EXTRACTRC=extractrc ; fi
|
||||
if test -z "$PREPARETIPS"; then PREPARETIPS=preparetips ; fi
|
||||
export EXTRACTRC PREPARETIPS
|
||||
|
||||
for subdir in $dirs; do
|
||||
test -z "$VERBOSE" || echo "Making messages in $subdir"
|
||||
(cd $subdir
|
||||
echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp
|
||||
$EXTRACTRC `find . -name \*.ui -o -name \*.rc` > rc.cpp
|
||||
XGETTEXT="${XGETTEXT:-xgettext} -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x @KDE3_INCLUDE_DIR@/kde.pot"
|
||||
find . -name '*.cpp' | xargs ${XGETTEXT} _translatorinfo.cpp -o ${podir}/@PROJECT_NAME@.pot
|
||||
find . -name '*.ui.h' | xargs ${XGETTEXT} _translatorinfo.cpp -j -o ${podir}/@PROJECT_NAME@.pot
|
||||
) 2>&1 | grep -v '^make\[1\]' > $tmpname
|
||||
test -s $tmpname && { echo $subdir ; cat "$tmpname"; }
|
||||
test -f $subdir/rc.cpp && rm -f $subdir/rc.cpp
|
||||
rm -f $subdir/_translatorinfo.cpp
|
||||
done
|
||||
rm -f $tmpname
|
||||
for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do
|
||||
test -f po/$i || echo "disappeared: $i"
|
||||
done
|
||||
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
|
||||
msgmerge -q -o po/$i po/$i po/$i
|
||||
egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > temp.pot
|
||||
if test -f po.backup/$i && test -n "`diff temp.pot po.backup/$i`"; then
|
||||
echo "will update $i"
|
||||
msgmerge -q po.backup/backup_$i po/$i > temp.pot
|
||||
mv temp.pot po/$i
|
||||
else
|
||||
if test -f po.backup/backup_$i; then
|
||||
test -z "$VERBOSE" || echo "I'm restoring $i"
|
||||
mv po.backup/backup_$i po/$i
|
||||
rm po.backup/$i
|
||||
else
|
||||
echo "will add $i"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
rm -f temp.pot
|
||||
rm -rf po.backup
|
||||
|
||||
echo Merging messages
|
||||
for cat in $POFILES; do
|
||||
msgmerge -o $cat.new $cat @CMAKE_SOURCE_DIR@/po/@PROJECT_NAME@.pot
|
||||
if test -s $cat.new; then
|
||||
grep -v "\"POT-Creation" $cat.new > $cat.new.2
|
||||
grep -v "\"POT-Creation" $cat >> $cat.new.1
|
||||
if diff $cat.new.1 $cat.new.2; then
|
||||
rm $cat.new
|
||||
else
|
||||
mv $cat.new $cat
|
||||
fi
|
||||
rm -f $cat.new.1 $cat.new.2
|
||||
fi
|
||||
done
|
@ -0,0 +1,4 @@
|
||||
#cmakedefine APPLICATION_VERSION "@APPLICATION_VERSION@"
|
||||
#cmakedefine HAVE_MANDRAKE @MANDRAKE@
|
||||
#cmakedefine APPLICATION_INTERNAL_VERSION @APPLICATION_INTERNAL_VERSION@
|
||||
#cmakedefine KBFX_LIB_INSTALL_DIR "@KBFX_LIB_INSTALL_DIR@"
|
@ -0,0 +1,57 @@
|
||||
SET(kbfxconfigappsrc
|
||||
main.cpp
|
||||
kbfxconfigapp.cpp
|
||||
)
|
||||
|
||||
SET(kbfxconfigappui
|
||||
kbfxthemeinfo.ui
|
||||
kbfxconfigdlgbutton.ui
|
||||
kbfxconfigdlgmain.ui
|
||||
kbfxconfigdlgthemes.ui
|
||||
kbfxconfigdlgabout.ui
|
||||
kbfxconfigdlgstyle.ui
|
||||
kbfxconfigdlgtooltip.ui
|
||||
kbfxconfigdlgfonts-old.ui
|
||||
kbfxconfigdlgplugins.ui
|
||||
kbfxconfigdlglayout.ui
|
||||
)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${kbfxconfigappsrc})
|
||||
|
||||
KDE3_ADD_UI_FILES(kbfxconfigappsrc ${kbfxconfigappui})
|
||||
|
||||
KDE3_ADD_EXECUTABLE(kbfxconfigapp ${kbfxconfigappsrc})
|
||||
|
||||
TARGET_LINK_LIBRARIES(kbfxconfigapp
|
||||
kbfxdata
|
||||
kbfxcommon
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${kbfxconfigappsrc})
|
||||
|
||||
KDE4_ADD_UI3_FILES(kbfxconfigappsrc ${kbfxconfigappui})
|
||||
|
||||
KDE4_ADD_EXECUTABLE(kbfxconfigapp ${kbfxconfigappsrc})
|
||||
|
||||
TARGET_LINK_LIBRARIES(kbfxconfigapp
|
||||
kbfxdata
|
||||
kbfxcommon
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxconfigapp
|
||||
RUNTIME DESTINATION ${BIN_INSTALL_DIR})
|
||||
|
||||
INSTALL(FILES kbfxconfigappui.rc DESTINATION ${DATA_INSTALL_DIR}/kbfxconfigapp)
|
||||
INSTALL(FILES kbfxconfigapp.desktop kbfx_theme.desktop DESTINATION ${XDG_APPS_DIR})
|
||||
INSTALL(FILES kbfx_install_theme.desktop kbfx_prepare_theme.desktop
|
||||
DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus)
|
||||
INSTALL(FILES x-kbfxtheme.desktop
|
||||
DESTINATION ${MIME_INSTALL_DIR}/application)
|
@ -0,0 +1,22 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
ServiceTypes=application/x-kbfxtheme
|
||||
Actions=kbfx_install_theme
|
||||
|
||||
[Desktop Action kbfx_install_theme]
|
||||
Icon=kbfxconfigapp
|
||||
Exec=kbfxconfigapp --install %u
|
||||
Name=Install KBFX Theme Package
|
||||
Name[bg]=Инсталиране на пакета KBFX Theme
|
||||
Name[da]=Installér KBFX-temapakke
|
||||
Name[de]=KBFX Theme-Paket installieren
|
||||
Name[el]=Εγκατάσταση του πακέτου θέματος KBFX
|
||||
Name[es]=Instalar paquete con el tema KBFX
|
||||
Name[et]=KBFX teemapaketi paigaldamine
|
||||
Name[fr]=Installer le paquet des thèmes KBFX
|
||||
Name[ja]=KBFX テーマパッケージをインストール
|
||||
Name[nl]=KBFX-themapakket installeren
|
||||
Name[pt]=Instalar o Pacote de Tema do KBFX
|
||||
Name[pt_BR]=Instalar Pacote do Tema KBFX
|
||||
Name[sv]=Installera KBFX-temapaket
|
||||
|
@ -0,0 +1,23 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
ServiceTypes=inode/directory
|
||||
Actions=kbfx_prepare_theme
|
||||
|
||||
[Desktop Action kbfx_prepare_theme]
|
||||
Icon=kbfxconfigapp
|
||||
Exec=kbfxconfigapp --prepare %u
|
||||
Name=Prepare KBFX Theme Package
|
||||
Name[bg]=Подготовка на пакета KBFX Theme
|
||||
Name[da]=Opret KBFX-temapakke
|
||||
Name[de]=KBFX Theme-Paket vorbereiten
|
||||
Name[el]=Προετοιμασία του πακέτου θέματος KBFX
|
||||
Name[es]=Preparar paquete con el tema KBFX
|
||||
Name[et]=KBFX teemapaketi ettevalmistamine
|
||||
Name[fr]=Preparer le paquet des thèmes KBFX
|
||||
Name[ga]=Ullmhaigh Pacáiste Téama KBFX
|
||||
Name[ja]=KBFX テーマパッケージを準備
|
||||
Name[nl]=KBFX-themapakket voorbereiden
|
||||
Name[pt]=Preparar o Pacote de Tema do KBFX
|
||||
Name[pt_BR]=Preparar Pacote do Tema KBFX
|
||||
Name[sv]=Skapa KBFX-temapaket
|
||||
|
@ -0,0 +1,18 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=KBFX Theme Installer
|
||||
Name[de]=Installations von KBFX-Themes
|
||||
Name[el]=Εγκατάσταση θέματος KBFX
|
||||
Name[et]=KBFX teema paigaldaja
|
||||
Name[fr]=Outil d'installation des thèmes KBFX
|
||||
Name[ja]=KBFX テーマインストーラ
|
||||
Name[nl]=KBFX-thema-installatie
|
||||
Name[pt]=Instalador de Temas do KBFX
|
||||
Name[pt_BR]=Instalador de Temas do KBFX
|
||||
Name[sv]=KBFX-temainstallation
|
||||
Exec=kbfxconfigapp --install %u
|
||||
Icon=kbfxconfigapp
|
||||
Type=Application
|
||||
MimeType=application/x-kbfxtheme
|
||||
NoDisplay=true
|
||||
|
@ -0,0 +1,416 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxconfigapp.h"
|
||||
|
||||
KbfxConfigApp::KbfxConfigApp ( QWidget* parent, const char* name, WFlags fl )
|
||||
: KbfxConfigDlgMain ( parent,name,fl )
|
||||
{
|
||||
// m_KbfxVersion = tr2i18n("<p align='center'>Running KBFX version: " APPLICATION_VERSION "</p>");
|
||||
m_KbfxVersion = tr2i18n ( "<p align='center'>%1</p>" );
|
||||
m_KbfxVersion2 = tr2i18n ( "You are running: <b>KBFX " APPLICATION_VERSION "</b>" );
|
||||
m_KbfxNewsBrowserError = tr2i18n ( "<br><p align='center'><font color='#ff0000'>"
|
||||
"The connection to the KBFX News Section on www.kbfx.org is broken."
|
||||
"</font><br><br>"
|
||||
"If you want you can check the latest news for KBFX from here:"
|
||||
"<br><a href='http://www.kbfx.org/'>KBFX News</a></p>" );
|
||||
m_KbfxLogoButton = tr2i18n ( "<font size='+1'><b>KBFX start button</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"You have 3 options to select for your KBFX start button."
|
||||
"You have to select <i>(Normal, Pressed, Hover)</i> images. <br>"
|
||||
"Down below you can also see a preview of the images you have selected." );
|
||||
m_KbfxLogoAbout = tr2i18n ( "<font size='+1'><b>About KBFX</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"Here you can find information about the KBFX Project and all the people involved in it." );
|
||||
m_KbfxLogoFonts = tr2i18n ( "<font size='+1'><b>KBFX font settings</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"Here you can set the fonts of the current theme.<br>"
|
||||
"If you don't have any 'kbfxfontrc' file don't worry about that.<br>"
|
||||
"When done just hit 'Apply' button and KBFX will save the 'kbfxfontrc' file." );
|
||||
m_KbfxLogoLayout = tr2i18n ( "<font size='+1'><b>KBFX Layout</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"Here you can configure the Look and Feel of your KBFX menu.<br>"
|
||||
"The most important settings that are used with the '<strong>Make it...</strong>' buttons are marked with '<strong>*</strong>'<br>"
|
||||
"Have in mind that the Layout of the theme also depends on the sizes of the images!<br>" );
|
||||
m_KbfxLogoPlugins = tr2i18n ( "<font size='+1'><b>KBFX Plugins</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"Here you can select what plugins will be enabled and in which panel of the KBFX menu." );
|
||||
m_KbfxLogoStyle = tr2i18n ( "<font size='+1'><b>Menu Type</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"Please select which kind of menu you would like to use." );
|
||||
m_KbfxLogoThemes = tr2i18n ( "<font size='+1'><b>KBFX Themes</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"To keep it simple place all your themes inside one folder.<br>"
|
||||
"Then create different folders inside that folder with different names.<br>"
|
||||
"KBFX will then read those folders as themes." );
|
||||
m_KbfxLogoTooltip = tr2i18n ( "<font size='+1'><b>KBFX tooltip settings</b><br></font>"
|
||||
"<b>Tip! </b>"
|
||||
"Here you can configure the behaviour of KBFX's own tooltip." );
|
||||
m_KbfxNewsBrowserAddress = "http://www.kbfx.org/news/";
|
||||
InitForm();
|
||||
}
|
||||
|
||||
KbfxConfigApp::~KbfxConfigApp()
|
||||
{}
|
||||
|
||||
void KbfxConfigApp::InitForm()
|
||||
{
|
||||
lb_Main->clear();
|
||||
|
||||
/* initialize Themes page */
|
||||
lb_Main->insertItem ( img_themes, tr2i18n ( "Themes" ), THEMES );
|
||||
KbfxConfigDlgThemes *pageThemes = new KbfxConfigDlgThemes();
|
||||
ws_Main->addWidget ( pageThemes, THEMES );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgThemesChanged() ),
|
||||
pageThemes, SLOT ( ChangeForm() ) );
|
||||
emit KbfxConfigDlgThemesChanged();
|
||||
connect ( pageThemes->KbfxGetMoreThemes, SIGNAL ( clicked() ),
|
||||
this, SLOT ( KbfxGetMoreThemesClicked() ) );
|
||||
connect ( this, SIGNAL ( KbfxThemeDoInstall ( QString & ) ),
|
||||
pageThemes, SLOT ( KbfxThemeInstall ( QString & ) ) );
|
||||
|
||||
/* initialize Button page */
|
||||
lb_Main->insertItem ( img_button, tr2i18n ( "Start Button" ), BUTTON );
|
||||
KbfxConfigDlgButton *pageButton = new KbfxConfigDlgButton();
|
||||
ws_Main->addWidget ( pageButton, BUTTON );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgButtonChanged() ),
|
||||
pageButton, SLOT ( ChangeForm() ) );
|
||||
emit KbfxConfigDlgButtonChanged();
|
||||
|
||||
/* initialize Fonts page */
|
||||
lb_Main->insertItem ( img_fonts, tr2i18n ( "Fonts" ), FONTS );
|
||||
KbfxConfigDlgFonts *pageFonts = new KbfxConfigDlgFonts();
|
||||
ws_Main->addWidget ( pageFonts, FONTS );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgFontsChanged() ),
|
||||
pageFonts, SLOT ( ChangeForm() ) );
|
||||
emit KbfxConfigDlgFontsChanged();
|
||||
|
||||
/* initialize Layout Page */
|
||||
lb_Main->insertItem ( img_search, tr2i18n ( "Layout" ), LAYOUT );
|
||||
KbfxConfigDlgLayout *pageLayout = new KbfxConfigDlgLayout();
|
||||
ws_Main->addWidget ( pageLayout, LAYOUT );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgLayoutChanged() ),
|
||||
pageLayout, SLOT ( ChangeForm() ) );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgLayoutLeft() ),
|
||||
pageLayout, SLOT ( LayoutFormLeft() ) );
|
||||
emit KbfxConfigDlgLayoutChanged();
|
||||
|
||||
/* initialize Plugins Page */
|
||||
lb_Main->insertItem ( img_plugins, tr2i18n ( "Plugins" ), PLUGINS );
|
||||
KbfxConfigDlgPlugins *pagePlugins = new KbfxConfigDlgPlugins();
|
||||
ws_Main->addWidget ( pagePlugins, PLUGINS );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgPluginsChanged() ),
|
||||
pagePlugins, SLOT ( ChangeForm() ) );
|
||||
emit KbfxConfigDlgPluginsChanged();
|
||||
|
||||
/* initialize Tooltip page */
|
||||
lb_Main->insertItem ( img_tooltip, tr2i18n ( "Tooltip" ), TOOLTIP );
|
||||
KbfxConfigDlgTooltip *pageTooltip = new KbfxConfigDlgTooltip();
|
||||
ws_Main->addWidget ( pageTooltip, TOOLTIP );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgTooltipChanged() ),
|
||||
pageTooltip, SLOT ( ChangeForm() ) );
|
||||
emit KbfxConfigDlgTooltipChanged();
|
||||
|
||||
/* initialize Menu Style page */
|
||||
lb_Main->insertItem ( img_style, tr2i18n ( "Menu Style" ), STYLE );
|
||||
KbfxConfigDlgStyle *pageStyle = new KbfxConfigDlgStyle();
|
||||
ws_Main->addWidget ( pageStyle, STYLE );
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgStyleChanged() ),
|
||||
pageStyle, SLOT ( ChangeForm() ) );
|
||||
emit KbfxConfigDlgStyleChanged();
|
||||
|
||||
/* initialize About page */
|
||||
lb_Main->insertItem ( img_about, tr2i18n ( "About" ), ABOUT );
|
||||
KbfxConfigDlgAbout *pageAbout = new KbfxConfigDlgAbout();
|
||||
ws_Main->addWidget ( pageAbout,ABOUT );
|
||||
pageAbout->KbfxLabelVersion->setText ( m_KbfxVersion2 );
|
||||
|
||||
connect ( btn_Default, SIGNAL ( clicked() ),
|
||||
this, SLOT ( btn_DefaultClicked() ) );
|
||||
connect ( btn_Help, SIGNAL ( clicked() ),
|
||||
this, SLOT ( btn_HelpClicked() ) );
|
||||
connect ( lb_Main, SIGNAL ( highlighted ( int ) ),
|
||||
this, SLOT ( KbfxMenuItemChanged ( int ) ) );
|
||||
connect ( btn_SaveApply, SIGNAL ( clicked() ),
|
||||
this, SLOT ( btn_SaveApplyClicked() ) );
|
||||
|
||||
m_KbfxPage = THEMES;
|
||||
lb_Main->setCurrentItem ( THEMES );
|
||||
ws_Main->raiseWidget ( THEMES );
|
||||
}
|
||||
|
||||
/* process help for each page */
|
||||
void KbfxConfigApp::btn_HelpClicked()
|
||||
{
|
||||
if ( m_KbfxPage == THEMES )
|
||||
kapp->invokeHelp ( "kbfx_themes", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == BUTTON )
|
||||
kapp->invokeHelp ( "kbfx_button", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == FONTS )
|
||||
kapp->invokeHelp ( "kbfx_fonts", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == LAYOUT )
|
||||
kapp->invokeHelp ( "kbfx_layout", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == PLUGINS )
|
||||
kapp->invokeHelp ( "kbfx_plugins", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == TOOLTIP )
|
||||
kapp->invokeHelp ( "kbfx_tooltip", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == STYLE )
|
||||
kapp->invokeHelp ( "kbfx_style", "kbfxconfigapp" );
|
||||
if ( m_KbfxPage == ABOUT)
|
||||
kapp->invokeHelp ( "kbfx_about", "kbfxconfigapp" );
|
||||
}
|
||||
|
||||
/* process default options for each page */
|
||||
void KbfxConfigApp::btn_DefaultClicked()
|
||||
{
|
||||
switch ( ws_Main->id ( ws_Main->visibleWidget() ) )
|
||||
{
|
||||
case THEMES: /* Themes page */
|
||||
{
|
||||
ConfigInit().m_SpinxThemeBasePath = ConfigInit().m_SpinxThemeBasePathDefault;
|
||||
ConfigInit().m_UserSpinxThemeBasePath = ConfigInit().m_UserSpinxThemeBasePathDefault;
|
||||
ConfigInit().m_SpinxThemeName = ConfigInit().m_SpinxThemeNameDefault;
|
||||
ConfigInit().m_SpinxDudeBlink = ConfigInit().m_SpinxDudeBlinkDefault;
|
||||
ConfigInit().m_SpinxDudeImage = ConfigInit().m_SpinxDudeImageDefault;
|
||||
ConfigInit().m_KbfxWatcher = ConfigInit().m_KbfxWatcherDefault;
|
||||
ConfigInit().m_KbfxShowOldThemes = ConfigInit().m_KbfxShowOldThemesDefault;
|
||||
emit KbfxConfigDlgThemesChanged();
|
||||
break;
|
||||
}
|
||||
case BUTTON: /* Button page */
|
||||
{
|
||||
ConfigInit().m_KbfxNormalButtonPath = ConfigInit().m_KbfxNormalButtonPathDefault;
|
||||
ConfigInit().m_KbfxHoverButtonPath = ConfigInit().m_KbfxHoverButtonPathDefault;
|
||||
ConfigInit().m_KbfxPressedButtonPath = ConfigInit().m_KbfxPressedButtonPathDefault;
|
||||
ConfigInit().m_ToolBarResize = ConfigInit().m_ToolBarResizeDefault;
|
||||
ConfigInit().m_fadeTime = ConfigInit().m_fadeTimeDefault;
|
||||
emit KbfxConfigDlgButtonChanged();
|
||||
break;
|
||||
}
|
||||
case FONTS: /* Fonts page */
|
||||
{
|
||||
ConfigInit().readFontrc ( ConfigInit().m_SpinxThemeBasePath,
|
||||
ConfigInit().m_SpinxThemeName,
|
||||
FALSE );
|
||||
emit KbfxConfigDlgFontsChanged();
|
||||
break;
|
||||
}
|
||||
case STYLE: /* Style page */
|
||||
{
|
||||
ConfigInit().m_KbfxMenuType = ConfigInit().m_KbfxMenuTypeDefault;
|
||||
emit KbfxConfigDlgStyleChanged();
|
||||
break;
|
||||
}
|
||||
case TOOLTIP: /* Tooltip page */
|
||||
{
|
||||
ConfigInit().m_ToolTip = ConfigInit().m_ToolTipDefault;
|
||||
ConfigInit().m_ToolTipAnimation = ConfigInit().m_ToolTipAnimationDefault;
|
||||
ConfigInit().m_ToolTipText = ConfigInit().m_ToolTipTextDefault;
|
||||
ConfigInit().m_ToolTipAvatar = ConfigInit().m_ToolTipAvatarDefault;
|
||||
ConfigInit().m_SpinxTooltipDudebox = ConfigInit().m_SpinxTooltipDudeboxDefault;
|
||||
ConfigInit().m_SpinxTooltipMask = ConfigInit().m_SpinxTooltipMaskDefault;
|
||||
ConfigInit().m_SpinxTooltipWindow = ConfigInit().m_SpinxTooltipWindowDefault;
|
||||
ConfigInit().m_SpinxTooltipLogo = ConfigInit().m_SpinxTooltipLogoDefault;
|
||||
emit KbfxConfigDlgTooltipChanged();
|
||||
break;
|
||||
}
|
||||
case LAYOUT: /* Layout page */
|
||||
{
|
||||
ConfigInit().readThemerc ( ConfigInit().m_SpinxThemeBasePath,
|
||||
ConfigInit().m_SpinxThemeName,
|
||||
FALSE );
|
||||
emit KbfxConfigDlgLayoutChanged();
|
||||
break;
|
||||
}
|
||||
case PLUGINS: /* Plugins page */
|
||||
{
|
||||
ConfigInit().m_pluginsLeft = ConfigInit().m_pluginsLeftDefault;
|
||||
ConfigInit().m_pluginsRight = ConfigInit().m_pluginsRightDefault;
|
||||
emit KbfxConfigDlgPluginsChanged();
|
||||
break;
|
||||
}
|
||||
case ABOUT: /* About page */
|
||||
{
|
||||
KMessageBox::information ( 0, tr2i18n ( "No default settings here ;)" ) );
|
||||
break;
|
||||
}
|
||||
default: /* Default Action Switch should never be reached */
|
||||
kdDebug() << "Default action switch for default clicked..." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigApp::KbfxMenuItemChanged ( int index )
|
||||
{
|
||||
/*
|
||||
* switch is used in case we want to add special code
|
||||
* for certain page before raiseWidget is called
|
||||
*/
|
||||
|
||||
|
||||
if( m_KbfxPage == LAYOUT )
|
||||
{
|
||||
emit KbfxConfigDlgLayoutLeft();
|
||||
}
|
||||
|
||||
m_KbfxPage = index;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case THEMES: /* Themes page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoThemes);
|
||||
ws_Main->raiseWidget ( THEMES );
|
||||
emit KbfxConfigDlgThemesChanged();
|
||||
break;
|
||||
}
|
||||
case BUTTON: /* Button page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoButton);
|
||||
ws_Main->raiseWidget ( BUTTON );
|
||||
emit KbfxConfigDlgButtonChanged();
|
||||
break;
|
||||
}
|
||||
case FONTS: /* Fonts page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoFonts);
|
||||
ws_Main->raiseWidget ( FONTS );
|
||||
emit KbfxConfigDlgFontsChanged();
|
||||
break;
|
||||
}
|
||||
case STYLE: /* Style page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoStyle);
|
||||
ws_Main->raiseWidget ( STYLE );
|
||||
emit KbfxConfigDlgStyleChanged();
|
||||
break;
|
||||
}
|
||||
case TOOLTIP: /* Tooltip page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoTooltip);
|
||||
ws_Main->raiseWidget ( TOOLTIP );
|
||||
emit KbfxConfigDlgTooltipChanged();
|
||||
break;
|
||||
}
|
||||
case LAYOUT: /* Layout page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoLayout);
|
||||
ws_Main->raiseWidget ( LAYOUT );
|
||||
emit KbfxConfigDlgLayoutChanged();
|
||||
break;
|
||||
}
|
||||
case PLUGINS: /* Plugins page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoPlugins);
|
||||
ws_Main->raiseWidget ( PLUGINS );
|
||||
break;
|
||||
}
|
||||
case ABOUT: /* About page */
|
||||
{
|
||||
KbfxLogoText->setText(m_KbfxLogoAbout);
|
||||
ws_Main->raiseWidget ( ABOUT );
|
||||
break;
|
||||
}
|
||||
default: /* default action switch should never be reached */
|
||||
kdDebug() << "Default action switch for menu changed..." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigApp::KbfxNewsBrowserOpenURLRequest ( const KURL &url, const KParts::URLArgs & )
|
||||
{
|
||||
kdDebug() << "Starting Konqueror ... "<< endl;
|
||||
KRun::runCommand ( "konqueror " + url.url() );
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KbfxConfigApp::KbfxNewsBrowserCompleted()
|
||||
{
|
||||
kio->KbfxKioDownloadEnd();
|
||||
}
|
||||
|
||||
void KbfxConfigApp::browserInit()
|
||||
{
|
||||
/* initialize NewsBrowser widget */
|
||||
kio = new KbfxKioDownload();
|
||||
connect ( kio, SIGNAL ( KbfxKioDownloadReady() ),
|
||||
this, SLOT ( KbfxNewsBrowserLoad() ) );
|
||||
kio->KbfxKioDownloadStart ( m_KbfxNewsBrowserAddress );
|
||||
}
|
||||
|
||||
void KbfxConfigApp::KbfxNewsBrowserLoad()
|
||||
{
|
||||
if ( kio->KbfxBrowserError() ) KBFXNewsBrowser->setText ( m_KbfxNewsBrowserError );
|
||||
else
|
||||
{
|
||||
browser = new KHTMLPart ( KBFXNewsBrowser );
|
||||
browser->openURL ( kio->KbfxBrowserTmpFile() );
|
||||
browser->view()->resize ( KBFXNewsBrowser->width(), KBFXNewsBrowser->height() );
|
||||
browser->view()->setVScrollBarMode ( QScrollView::AlwaysOff );
|
||||
browser->view()->setHScrollBarMode ( QScrollView::AlwaysOff );
|
||||
browser->view()->setFocusPolicy ( QWidget::NoFocus );
|
||||
browser->view()->show();
|
||||
|
||||
connect ( browser->browserExtension(),
|
||||
SIGNAL ( openURLRequest ( const KURL &, const KParts::URLArgs & ) ),
|
||||
this,
|
||||
SLOT ( KbfxNewsBrowserOpenURLRequest ( const KURL &, const KParts::URLArgs & ) ) );
|
||||
connect ( browser, SIGNAL ( completed() ),
|
||||
this, SLOT ( KbfxNewsBrowserCompleted() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigApp::KbfxGetMoreThemesClicked()
|
||||
{
|
||||
KRun::runCommand ( "konqueror 'http://www.kbfx.org/news/new_themes.html'" );
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KbfxConfigApp::KbfxThemeInstall ( QString & themeURL )
|
||||
{
|
||||
emit KbfxThemeDoInstall ( themeURL );
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigApp::btn_SaveApplyClicked()
|
||||
{
|
||||
if( m_KbfxPage == LAYOUT )
|
||||
{
|
||||
emit KbfxConfigDlgLayoutLeft();
|
||||
}
|
||||
|
||||
ConfigInit().write();
|
||||
ConfigInit().writeThemerc ( ConfigInit().m_SpinxThemeName );
|
||||
ConfigInit().writeFontrc ( ConfigInit().m_SpinxThemeName );
|
||||
|
||||
|
||||
DCOPRef m_kickerkbfxDevelnterface ( "kicker","KBFXInterface" );
|
||||
m_kickerkbfxDevelnterface.call ( "notifyConfigChange()" );
|
||||
|
||||
/*
|
||||
// m_kickerkbfxDevelnterface.call ( "notifyConfigChange()" );
|
||||
// DCOPRef m_kickerPanel("kicker","Panel");
|
||||
DCOPRef m_kickerPanel("kicker","kicker");
|
||||
m_kickerPanel.call("restart()");
|
||||
*/
|
||||
}
|
||||
|
||||
#include "kbfxconfigapp.moc"
|
@ -0,0 +1,36 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=KBFX Configurator
|
||||
Name[da]=KBFX-indstilling
|
||||
Name[de]=KBFX einrichten
|
||||
Name[el]=Ρύθμιση KBFX
|
||||
Name[es]=Cofigurador de KBFX
|
||||
Name[et]=KBFX seadistaja
|
||||
Name[fr]=Configuration de KBFX
|
||||
Name[ga]=Cumraitheoir KBFX
|
||||
Name[ja]=KBFX 設定ツール
|
||||
Name[pt]=Configuração do KBFX
|
||||
Name[pt_BR]=Configurador do KBFX
|
||||
Name[sv]=KBFX-inställning
|
||||
Comment=KBFX Configuration Utility
|
||||
Comment[bg]=Настройка на KBFX
|
||||
Comment[br]=Ostilh kefluniadur KBFX
|
||||
Comment[da]=KBFX-indstillingsværktøj
|
||||
Comment[de]=KBFX Konfigurationswerkzeug
|
||||
Comment[el]=Εργαλείο ρύθμισης του KBFX
|
||||
Comment[es]=Utilidad de configuración de KBFX
|
||||
Comment[et]=KBFX seadistamistööriist
|
||||
Comment[fr]=Outil de configuration des services KBFX
|
||||
Comment[ga]=Uirlis Chumraíochta KBFX
|
||||
Comment[gl]=Ferramenta de Configurazón de KBFX
|
||||
Comment[ja]=KBFX 設定ユーティリティ
|
||||
Comment[nl]=KBFX-configuratieprogramma
|
||||
Comment[pt]=Utilitário de Configuração do KBFX
|
||||
Comment[pt_BR]=Utilitário para Configuração do KBFX
|
||||
Comment[sv]=KBFX-inställningsverktyg
|
||||
Icon=kbfxconfigapp
|
||||
Exec=kbfxconfigapp
|
||||
Type=Application
|
||||
Categories=Qt;KDE;Settings;
|
||||
DocPath=kbfxconfigapp/index.html
|
||||
X-DCOP-ServiceType=Unique
|
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 _KBFXCONFIGAPP_H_
|
||||
#define _KBFXCONFIGAPP_H_
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <qbuttongroup.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qmap.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qtabwidget.h>
|
||||
#include <qtextbrowser.h>
|
||||
#include <qtimer.h>
|
||||
#include <qtoolbox.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qvariant.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include <qwidgetstack.h>
|
||||
|
||||
#include <dcopref.h>
|
||||
#include <kactivelabel.h>
|
||||
#include <karchive.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kcombobox.h>
|
||||
#include <kdebug.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <khtml_part.h>
|
||||
#include <khtmlview.h>
|
||||
#include <kicondialog.h>
|
||||
#include <kio/job.h>
|
||||
#include <kio/netaccess.h>
|
||||
#include <klocale.h>
|
||||
#include <kmainwindow.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kpushbutton.h>
|
||||
#include <krun.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <ktar.h>
|
||||
#include <ktempfile.h>
|
||||
#include <ktextedit.h>
|
||||
#include <kurl.h>
|
||||
#include <kurlrequester.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxkiodownload.h>
|
||||
#include <kbfxthemesdata.h>
|
||||
|
||||
#include "kbfxconfigdlgabout.h"
|
||||
#include "kbfxconfigdlgbutton.h"
|
||||
#include "kbfxconfigdlgfonts-old.h"
|
||||
#include "kbfxconfigdlglayout.h"
|
||||
#include "kbfxconfigdlgmain.h"
|
||||
#include "kbfxconfigdlgplugins.h"
|
||||
#include "kbfxconfigdlgstyle.h"
|
||||
#include "kbfxconfigdlgthemes.h"
|
||||
#include "kbfxconfigdlgtooltip.h"
|
||||
|
||||
/**
|
||||
* @short Application Main Window
|
||||
* @author PhobosK <phobosk@mail.kbfx.org>
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
enum {THEMES=0, BUTTON, FONTS, LAYOUT, PLUGINS, TOOLTIP, STYLE, ABOUT};
|
||||
|
||||
class KbfxConfigApp : public KbfxConfigDlgMain
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
KbfxConfigApp ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~KbfxConfigApp();
|
||||
void InitForm();
|
||||
|
||||
QString m_KbfxVersion;
|
||||
QString m_KbfxVersion2;
|
||||
QString m_KbfxNewsBrowserError;
|
||||
QString m_KbfxNewsBrowserAddress;
|
||||
|
||||
void browserInit();
|
||||
|
||||
|
||||
private:
|
||||
QString m_KbfxLogoButton;
|
||||
QString m_KbfxLogoThemes;
|
||||
QString m_KbfxLogoAbout;
|
||||
QString m_KbfxLogoLayout;
|
||||
QString m_KbfxLogoTooltip;
|
||||
QString m_KbfxLogoFonts;
|
||||
QString m_KbfxLogoStyle;
|
||||
QString m_KbfxLogoPlugins;
|
||||
KbfxConfigDlgButton *pageButton;
|
||||
KbfxConfigDlgThemes *pageThemes;
|
||||
KbfxConfigDlgFonts *pageFonts;
|
||||
KbfxConfigDlgStyle *pageStyle;
|
||||
KbfxConfigDlgPlugins *pagePlugins;
|
||||
KbfxConfigDlgLayout *pageLayout;
|
||||
KbfxConfigDlgTooltip *pageTooltip;
|
||||
KbfxConfigDlgAbout *pageAbout;
|
||||
KHTMLPart * browser;
|
||||
KbfxKioDownload * kio;
|
||||
QString m_KbfxThemeUrl;
|
||||
QString m_KbfxThemeFolderUrl;
|
||||
int m_KbfxPage;
|
||||
|
||||
public slots:
|
||||
virtual void btn_DefaultClicked();
|
||||
virtual void btn_HelpClicked();
|
||||
virtual void btn_SaveApplyClicked();
|
||||
virtual void KbfxMenuItemChanged ( int index );
|
||||
virtual void KbfxNewsBrowserOpenURLRequest ( const KURL &, const KParts::URLArgs & );
|
||||
virtual void KbfxNewsBrowserCompleted();
|
||||
virtual void KbfxNewsBrowserLoad();
|
||||
virtual void KbfxGetMoreThemesClicked();
|
||||
virtual void KbfxThemeInstall ( QString & );
|
||||
|
||||
signals:
|
||||
void KbfxConfigDlgButtonChanged();
|
||||
void KbfxConfigDlgThemesChanged();
|
||||
void KbfxConfigDlgStyleChanged();
|
||||
void KbfxConfigDlgTooltipChanged();
|
||||
void KbfxConfigDlgLayoutChanged();
|
||||
void KbfxConfigDlgLayoutLeft();
|
||||
void KbfxConfigDlgPluginsChanged();
|
||||
void KbfxConfigDlgFontsChanged();
|
||||
void KbfxThemeDoInstall( QString & );
|
||||
|
||||
};
|
||||
|
||||
#endif // _KBFXCONFIGAPP_H_
|
@ -0,0 +1,16 @@
|
||||
Begin3
|
||||
Title: $APPNAME$ -- KBFX Configuration Utility
|
||||
Version: $VERSION$
|
||||
Entered-date:
|
||||
Description:
|
||||
Keywords: KDE Qt
|
||||
Author: PhobosK <phobosk@mail.kbfx.org>
|
||||
Maintained-by: PhobosK <phobosk@mail.kbfx.org>
|
||||
Home-page: http://www.kbfx.org
|
||||
Alternate-site:
|
||||
Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
|
||||
xxxxxx kbfxconfigapp-0.1.tar.gz
|
||||
xxx kbfxconfigapp-0.1.lsm
|
||||
Platform: Linux. Needs KDE
|
||||
Copying-policy: $LICENSE$
|
||||
End
|
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||
<kpartgui name="kbfxconfigapp" version="1">
|
||||
<MenuBar>
|
||||
<Menu name="custom"><text>C&ustom</text>
|
||||
<Action name="custom_action" />
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</kpartgui>
|
@ -0,0 +1,159 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgAbout::init()
|
||||
{
|
||||
KbfxPixmapLabelNookie->installEventFilter ( this );
|
||||
KbfxPixmapLabelSiraj->installEventFilter ( this );
|
||||
KbfxPixmapLabelNathanael->installEventFilter ( this );
|
||||
KbfxPixmapLabelPhobosK->installEventFilter ( this );
|
||||
KbfxPixmapLabelEphracis->installEventFilter ( this );
|
||||
KbfxPixmapLabelJohnny->installEventFilter ( this );
|
||||
|
||||
KbfxMemberTextNookie = tr2i18n (
|
||||
"<strong>Name:</strong> Mensur Zahirovic (Nookie)"
|
||||
"<br><br>"
|
||||
"<strong>Country:</strong> Sweden"
|
||||
"<br><br>"
|
||||
"<strong>KBFX:</strong> co-author, Q/A, system design, web designer, bug hunter, project administror"
|
||||
"<br><br>"
|
||||
"<strong>Email:</strong> nookie@mail.kbfx.org" );
|
||||
|
||||
KbfxMemberTextSiraj = tr2i18n (
|
||||
"<strong>Name:</strong> Siraj Razick"
|
||||
"<br><br>"
|
||||
"<strong>Country:</strong> Sri Lanka"
|
||||
"<br><br>"
|
||||
"<strong>KBFX:</strong> author, maintainer, developer, project administror"
|
||||
"<br><br>"
|
||||
"<strong>Email:</strong> siraj@mail.kbfx.org" );
|
||||
|
||||
KbfxMemberTextNathanael = tr2i18n (
|
||||
"<strong>Name:</strong> Nathanael Dracor Gogniat"
|
||||
"<br><br>"
|
||||
"<strong>Country:</strong> Switzerland"
|
||||
"<br><br>"
|
||||
"<strong>KBFX:</strong> project technical writer, documentation manager, co-author"
|
||||
"<br><br>"
|
||||
"<strong>Email:</strong> nathanael@mail.kbfx.org" );
|
||||
|
||||
KbfxMemberTextPhobosK = tr2i18n (
|
||||
"<strong>Name:</strong> PhobosK"
|
||||
"<br><br>"
|
||||
"<strong>Country:</strong> Bulgaria"
|
||||
"<br><br>"
|
||||
"<strong>KBFX:</strong> package & release manager, Q/A, bug hunter, mandriva packages, project administrator, developer Qt/C++"
|
||||
"<br><br>"
|
||||
"<strong>Email:</strong> phobosk@mail.kbfx.org" );
|
||||
|
||||
KbfxMemberTextJohnny = tr2i18n (
|
||||
"<strong>Name:</strong> Johnny Henry Saenz Acuna (scarebyte)"
|
||||
"<br><br>"
|
||||
"<strong>Country:</strong> Peru"
|
||||
"<br><br>"
|
||||
"<strong>KBFX:</strong> developer Qt4/C++"
|
||||
"<br><br>"
|
||||
"<strong>Email:</strong> saenzac@mail.kbfx.org" );
|
||||
|
||||
KbfxMemberTextEphracis = tr2i18n (
|
||||
"<strong>Name:</strong> Christoffer Brodd-Reijer (Ephracis)"
|
||||
"<br><br>"
|
||||
"<strong>Country:</strong> Sweden"
|
||||
"<br><br>"
|
||||
"<strong>KBFX:</strong> library developer for Raptor"
|
||||
"<br><br>"
|
||||
"<strong>Email:</strong> ephracis@mail.kbfx.org" );
|
||||
}
|
||||
|
||||
bool KbfxConfigDlgAbout::eventFilter ( QObject *obj, QEvent *ev )
|
||||
{
|
||||
QCursor kbfxCursor;
|
||||
kbfxCursor.setShape ( Qt::PointingHandCursor );
|
||||
this->setCursor ( ( const QCursor ) kbfxCursor );
|
||||
|
||||
if ( ev->type() == QEvent::FocusIn || ev->type() == QEvent::Enter )
|
||||
{
|
||||
if ( obj == KbfxPixmapLabelNookie )
|
||||
{
|
||||
KbfxTeamInfo->setText ( KbfxMemberTextNookie );
|
||||
KbfxUnmarkAllPixmaps();
|
||||
KbfxPixmapLabelNookie->setFrameShape ( QFrame::WinPanel );
|
||||
return TRUE;
|
||||
}
|
||||
else if ( obj == KbfxPixmapLabelSiraj )
|
||||
{
|
||||
KbfxTeamInfo->setText ( KbfxMemberTextSiraj );
|
||||
KbfxUnmarkAllPixmaps();
|
||||
KbfxPixmapLabelSiraj->setFrameShape ( QFrame::WinPanel );
|
||||
return TRUE;
|
||||
}
|
||||
else if ( obj == KbfxPixmapLabelNathanael )
|
||||
{
|
||||
KbfxTeamInfo->setText ( KbfxMemberTextNathanael );
|
||||
KbfxUnmarkAllPixmaps();
|
||||
KbfxPixmapLabelNathanael->setFrameShape ( QFrame::WinPanel );
|
||||
return TRUE;
|
||||
}
|
||||
else if ( obj == KbfxPixmapLabelPhobosK )
|
||||
{
|
||||
KbfxTeamInfo->setText ( KbfxMemberTextPhobosK );
|
||||
KbfxUnmarkAllPixmaps();
|
||||
KbfxPixmapLabelPhobosK->setFrameShape ( QFrame::WinPanel );
|
||||
return TRUE;
|
||||
}
|
||||
else if ( obj == KbfxPixmapLabelJohnny )
|
||||
{
|
||||
KbfxTeamInfo->setText ( KbfxMemberTextJohnny );
|
||||
KbfxUnmarkAllPixmaps();
|
||||
KbfxPixmapLabelJohnny->setFrameShape ( QFrame::WinPanel );
|
||||
return TRUE;
|
||||
}
|
||||
else if ( obj == KbfxPixmapLabelEphracis )
|
||||
{
|
||||
KbfxTeamInfo->setText ( KbfxMemberTextEphracis );
|
||||
KbfxUnmarkAllPixmaps();
|
||||
KbfxPixmapLabelEphracis->setFrameShape ( QFrame::WinPanel );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ( ev->type() == QEvent::Leave )
|
||||
{
|
||||
if(
|
||||
obj == KbfxPixmapLabelNookie ||
|
||||
obj == KbfxPixmapLabelSiraj ||
|
||||
obj == KbfxPixmapLabelNathanael ||
|
||||
obj == KbfxPixmapLabelPhobosK ||
|
||||
obj == KbfxPixmapLabelEphracis ||
|
||||
obj == KbfxPixmapLabelJohnny )
|
||||
{
|
||||
KbfxTeamInfo->setText("");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return QWidget::eventFilter ( obj, ev );
|
||||
// return FALSE;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgAbout::KbfxUnmarkAllPixmaps()
|
||||
{
|
||||
KbfxPixmapLabelNookie->setFrameShape ( QFrame::NoFrame );
|
||||
KbfxPixmapLabelSiraj->setFrameShape ( QFrame::NoFrame );
|
||||
KbfxPixmapLabelNathanael->setFrameShape ( QFrame::NoFrame );
|
||||
KbfxPixmapLabelPhobosK->setFrameShape ( QFrame::NoFrame );
|
||||
KbfxPixmapLabelEphracis->setFrameShape ( QFrame::NoFrame );
|
||||
KbfxPixmapLabelJohnny->setFrameShape ( QFrame::NoFrame );
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgButton::init()
|
||||
{
|
||||
connect ( this, SIGNAL ( KbfxConfigDlgButtonChanged ( const char *, const QString & ) ),
|
||||
this, SLOT ( ChangeForm ( const char *, const QString & ) ) );
|
||||
}
|
||||
|
||||
/* actions performed when url is selected */
|
||||
void KbfxConfigDlgButton::KbfxURLRequesterNormalUrlSelected ( const QString &selected_img_path )
|
||||
{
|
||||
emit KbfxConfigDlgButtonChanged ( "normal", selected_img_path );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgButton::KbfxURLRequesterPressedUrlSelected ( const QString &selected_img_path )
|
||||
{
|
||||
emit KbfxConfigDlgButtonChanged ( "pressed", selected_img_path );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgButton::KbfxURLRequesterHoverUrlSelected ( const QString &selected_img_path )
|
||||
{
|
||||
emit KbfxConfigDlgButtonChanged ( "hover", selected_img_path );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgButton::KbfxButtonToggled ( bool )
|
||||
{
|
||||
if ( KbfxButton->state() == 2 )
|
||||
KbfxButton->setPixmap ( ConfigInit().m_KbfxPressedButtonPath );
|
||||
|
||||
if ( KbfxButton->state() == 0 )
|
||||
KbfxButton->setPixmap ( ConfigInit().m_KbfxNormalButtonPath );
|
||||
}
|
||||
|
||||
/* url processing */
|
||||
void KbfxConfigDlgButton::ChangeForm ( const char *name, const QString &path )
|
||||
{
|
||||
kdDebug() << "Received: " << name << " + " << path << endl;
|
||||
|
||||
QString tmppath = path;
|
||||
if ( tmppath.startsWith ( "file://" ) ) tmppath.remove ( "file://" );
|
||||
|
||||
QImage tmp ( tmppath );
|
||||
|
||||
QString tmpname = name;
|
||||
if ( tmpname == "pressed" )
|
||||
{
|
||||
if ( tmp.isNull() )
|
||||
{
|
||||
KMessageBox::error ( 0,
|
||||
tr2i18n ( "<p align='center'>Image cannot be used as a pressed button skin!</p>"
|
||||
"<p align='center'>Will use default pressed button skin.</p>" ),
|
||||
tr2i18n ( "Error loading image" ) );
|
||||
tmppath = ConfigInit().m_KbfxPressedButtonPathDefault;
|
||||
}
|
||||
|
||||
kdDebug() << tmpname << " :: " << tmppath << endl;
|
||||
|
||||
KbfxURLRequesterPressed->setURL ( tmppath );
|
||||
KbfxPixmapLabelPressed->setPixmap ( tmppath );
|
||||
ConfigInit().m_KbfxPressedButtonPath = tmppath;
|
||||
|
||||
if ( KbfxButton->state() == 2 )
|
||||
KbfxButton->setPixmap ( ConfigInit().m_KbfxPressedButtonPath );
|
||||
}
|
||||
|
||||
if ( tmpname == "normal" )
|
||||
{
|
||||
if ( tmp.isNull() )
|
||||
{
|
||||
KMessageBox::error ( 0,
|
||||
tr2i18n ( "<p align='center'>Image cannot be used as a normal button skin!</p>"
|
||||
"<p align='center'>Will use default normal button skin.</p>" ),
|
||||
tr2i18n ( "Error loading image" ) );
|
||||
tmppath = ConfigInit().m_KbfxNormalButtonPathDefault;
|
||||
}
|
||||
|
||||
kdDebug() << tmpname << " :: " << tmppath << endl;
|
||||
|
||||
KbfxURLRequesterNormal->setURL ( tmppath );
|
||||
KbfxPixmapLabelNormal->setPixmap ( tmppath );
|
||||
ConfigInit().m_KbfxNormalButtonPath = tmppath;
|
||||
|
||||
if ( KbfxButton->state() == 0 )
|
||||
KbfxButton->setPixmap ( ConfigInit().m_KbfxNormalButtonPath );
|
||||
}
|
||||
|
||||
if ( tmpname == "hover" )
|
||||
{
|
||||
if ( tmp.isNull() )
|
||||
{
|
||||
KMessageBox::error ( 0,
|
||||
tr2i18n ( "<p align='center'>Image cannot be used as a hover button skin!</p>"
|
||||
"<p align='center'>Will use default hover button skin.</p>" ),
|
||||
tr2i18n ( "Error loading image" ) );
|
||||
tmppath = ConfigInit().m_KbfxHoverButtonPathDefault;
|
||||
}
|
||||
|
||||
kdDebug() << tmpname << " :: " << tmppath << endl;
|
||||
|
||||
KbfxURLRequesterHover->setURL ( tmppath );
|
||||
KbfxPixmapLabelHover->setPixmap ( tmppath );
|
||||
ConfigInit().m_KbfxHoverButtonPath = tmppath;
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize Button page at the beginning or after "Default" pressed */
|
||||
void KbfxConfigDlgButton::ChangeForm()
|
||||
{
|
||||
KbfxURLRequesterNormal->setURL ( ConfigInit().m_KbfxNormalButtonPath );
|
||||
KbfxURLRequesterPressed->setURL ( ConfigInit().m_KbfxPressedButtonPath );
|
||||
KbfxURLRequesterHover->setURL ( ConfigInit().m_KbfxHoverButtonPath );
|
||||
KbfxPixmapLabelNormal->setPixmap ( ConfigInit().m_KbfxNormalButtonPath );
|
||||
KbfxPixmapLabelPressed->setPixmap ( ConfigInit().m_KbfxPressedButtonPath );
|
||||
KbfxPixmapLabelHover->setPixmap ( ConfigInit().m_KbfxHoverButtonPath );
|
||||
KbfxButtonToggled ( 1 );
|
||||
|
||||
if ( ConfigInit().m_fadeTime == 0 )
|
||||
KbfxFadeButton->setChecked ( FALSE );
|
||||
else
|
||||
KbfxFadeButton->setChecked ( TRUE );
|
||||
if ( ConfigInit().m_ToolBarResize == TRUE && KbfxResizeKicker->state() == 0 )
|
||||
KbfxResizeKicker->toggle();
|
||||
if ( ConfigInit().m_ToolBarResize == FALSE && KbfxResizeKicker->state() == 2 )
|
||||
KbfxResizeKicker->toggle();
|
||||
|
||||
KbfxFadeTime->setText ( QString::number ( ConfigInit().m_fadeTime ) );
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgButton::KbfxResizeKickerToggled ( bool )
|
||||
{
|
||||
if ( KbfxResizeKicker->state() == 2 )
|
||||
{
|
||||
KbfxResizeKicker->setText ( tr2i18n ( "Panel Resize is 'ON'" ) );
|
||||
ConfigInit().m_ToolBarResize = TRUE;
|
||||
}
|
||||
|
||||
if ( KbfxResizeKicker->state() == 0 )
|
||||
{
|
||||
KbfxResizeKicker->setText ( tr2i18n ( "Panel Resize is 'OFF'" ) );
|
||||
ConfigInit().m_ToolBarResize = FALSE;
|
||||
}
|
||||
|
||||
kdDebug() << "Panel Resize is: "
|
||||
<< ConfigInit().m_ToolBarResize
|
||||
<< endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void KbfxConfigDlgButton::KbfxFadeButton_toggled( bool _state )
|
||||
{
|
||||
if ( _state )
|
||||
{
|
||||
KbfxFadeTime->setText ( QString::number ( ConfigInit().m_fadeTimeDefault ) );
|
||||
ConfigInit().m_fadeTime = ConfigInit().m_fadeTimeDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigInit().m_fadeTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgButton::KbfxFadeTime_lostFocus()
|
||||
{
|
||||
int _value = ( KbfxFadeTime->text () ).toInt();
|
||||
ConfigInit().m_fadeTime = _value;
|
||||
ConfigInit().checkValues();
|
||||
|
||||
KbfxFadeTime->setText ( QString::number ( ConfigInit().m_fadeTime ) );
|
||||
}
|
@ -0,0 +1,204 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgFonts::init()
|
||||
{
|
||||
KbfxFormReady = FALSE;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::ChangeForm()
|
||||
{
|
||||
KbfxFormReady = FALSE;
|
||||
KbfxTheme->setText ( "<p align=left><b>" + ConfigInit().m_SpinxThemeName + "</b></p>" );
|
||||
KbfxBoldHover->setChecked ( ConfigInit().m_fontHoverBold );
|
||||
KbfxApplicationColor->setColor ( ConfigInit().m_fontAppNameColor );
|
||||
KbfxFont_app->setFont ( ConfigInit().m_fontAppNameFont );
|
||||
KbfxCommentColor->setColor ( ConfigInit().m_fontAppCommentColor );
|
||||
KbfxFont_comment->setFont ( ConfigInit().m_fontAppCommentFont );
|
||||
KbfxLineColor->setColor ( ConfigInit().m_lineColor );
|
||||
KbfxCategoryColor->setColor ( ConfigInit().m_fontIndexColor );
|
||||
KbfxFont_category->setFont ( ConfigInit().m_fontIndexFont );
|
||||
KbfxNameColor->setColor ( ConfigInit().m_userNameColor );
|
||||
KbfxFont_username->setFont ( ConfigInit().m_userNameFont );
|
||||
KbfxSeparatorColor->setColor ( ConfigInit().m_sepNameColor );
|
||||
KbfxFont_separator->setFont ( ConfigInit().m_sepNameFont );
|
||||
KbfxPluginColor->setColor ( ConfigInit().m_pluginNameColor );
|
||||
KbfxFont_plugin->setFont ( ConfigInit().m_pluginNameFont );
|
||||
KbfxTooltipColor->setColor ( ConfigInit().m_fontTooltipColor );
|
||||
KbfxFont_tooltip->setFont ( ConfigInit().m_fontTooltipFont );
|
||||
KbfxFormReady = TRUE;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxApplicationColorSelected ( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_fontAppNameColor = color;
|
||||
|
||||
kdDebug() << "Application color: "
|
||||
<< ConfigInit().m_fontAppNameColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxTooltipColorSelected ( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_fontTooltipColor = color;
|
||||
|
||||
kdDebug() << "Tooltip color: "
|
||||
<< ConfigInit().m_fontTooltipColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxCommentColorSelected ( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_fontAppCommentColor = color;
|
||||
|
||||
kdDebug() << "Comment color: "
|
||||
<< ConfigInit().m_fontAppCommentColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxLineColorSelected ( const QColor & color )
|
||||
{
|
||||
ConfigInit().m_lineColor = color;
|
||||
|
||||
kdDebug() << "Line color: "
|
||||
<< ConfigInit().m_lineColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxCategoryColorSelected ( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_fontIndexColor = color;
|
||||
|
||||
kdDebug() << "Category color: "
|
||||
<< ConfigInit().m_fontIndexColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxNameColorSelected ( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_userNameColor = color;
|
||||
|
||||
kdDebug() << "User color: "
|
||||
<< ConfigInit().m_userNameColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxSeparatorColorSelected ( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_sepNameColor = color;
|
||||
|
||||
kdDebug() << "Separator color: "
|
||||
<< ConfigInit().m_sepNameColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxPluginColorSelected( const QColor &color )
|
||||
{
|
||||
ConfigInit().m_pluginNameColor = color;
|
||||
|
||||
kdDebug() << "Plugin color: "
|
||||
<< ConfigInit().m_pluginNameColor
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxExportFileAction()
|
||||
{
|
||||
/*
|
||||
KFileDialog KbfxExportFontRcDialog(QString::null,
|
||||
"*.*|" + tr2i18n("All files"),
|
||||
0,
|
||||
0,
|
||||
TRUE);
|
||||
KbfxExportFontRcDialog.setOperationMode(KFileDialog::Saving);
|
||||
KbfxExportFontRcDialog.setCaption(tr2i18n("Select Folder to export kbfxfontrc file"));
|
||||
KbfxExportFontRcDialog.setMode(KFile::Directory);
|
||||
|
||||
if(!KbfxExportFontRcDialog.exec()) return;
|
||||
|
||||
QString KbfxExportFontRcDialogURL = KbfxExportFontRcDialog.selectedURL().path();
|
||||
*/
|
||||
|
||||
QString KbfxExportFontRcDialogURL = KFileDialog::getExistingDirectory (
|
||||
QString::null,
|
||||
0,
|
||||
tr2i18n ( "Select folder to export kbfxfontrc file" ) ).append ( "/kbfxfontrc" );
|
||||
|
||||
if ( KbfxExportFontRcDialogURL == "/kbfxfontrc") return;
|
||||
|
||||
kdDebug() << "Selected export file is: "
|
||||
<< KbfxExportFontRcDialogURL
|
||||
<< endl;
|
||||
|
||||
KConfig *fontconfig = new KConfig ( KbfxExportFontRcDialogURL );
|
||||
|
||||
fontconfig->setGroup ( "Fonts" );
|
||||
fontconfig->writeEntry ( "TooltipText", ConfigInit().m_fontTooltipColor );
|
||||
fontconfig->writeEntry ( "TooltipTextFont", ConfigInit().m_fontTooltipFont );
|
||||
fontconfig->writeEntry ( "ApplicationText", ConfigInit().m_fontAppNameColor );
|
||||
fontconfig->writeEntry ( "ApplicationTextFont", ConfigInit().m_fontAppNameFont );
|
||||
fontconfig->writeEntry ( "CommentText", ConfigInit().m_fontAppCommentColor );
|
||||
fontconfig->writeEntry ( "CommentTextFont", ConfigInit().m_fontAppCommentFont );
|
||||
fontconfig->writeEntry ( "GroupText", ConfigInit().m_fontIndexColor );
|
||||
fontconfig->writeEntry ( "GroupTextFont", ConfigInit().m_fontIndexFont );
|
||||
fontconfig->writeEntry ( "UserName", ConfigInit().m_userNameColor );
|
||||
fontconfig->writeEntry ( "UserNameFont", ConfigInit().m_userNameFont );
|
||||
fontconfig->writeEntry ( "SeparatorColor", ConfigInit().m_sepNameColor );
|
||||
fontconfig->writeEntry ( "SeparatorFont", ConfigInit().m_sepNameFont );
|
||||
fontconfig->writeEntry ( "PluginColor", ConfigInit().m_pluginNameColor );
|
||||
fontconfig->writeEntry ( "PluginFont", ConfigInit().m_pluginNameFont );
|
||||
fontconfig->writeEntry ( "LineColor", ConfigInit().m_lineColor );
|
||||
fontconfig->writeEntry ( "HoverBold", ConfigInit().m_fontHoverBold );
|
||||
fontconfig->sync();
|
||||
|
||||
delete fontconfig;
|
||||
KMessageBox::information ( 0,
|
||||
tr2i18n ( "<p align='center'>The Font configuration of the KBFX Theme <strong>%1</strong> has been exported successfully!</p>" ).arg ( ConfigInit().m_SpinxThemeName ),
|
||||
tr2i18n ( "KBFX Font Export Ready" ) );
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgFonts::FontChanged()
|
||||
{
|
||||
if (KbfxFormReady)
|
||||
{
|
||||
ConfigInit().m_fontAppNameFont = KbfxFont_app->font();
|
||||
ConfigInit().m_fontAppCommentFont = KbfxFont_comment->font();
|
||||
ConfigInit().m_fontIndexFont = KbfxFont_category->font();
|
||||
ConfigInit().m_userNameFont = KbfxFont_username->font();
|
||||
ConfigInit().m_sepNameFont = KbfxFont_separator->font();
|
||||
ConfigInit().m_pluginNameFont = KbfxFont_plugin->font();
|
||||
ConfigInit().m_fontTooltipFont = KbfxFont_tooltip->font();
|
||||
|
||||
/*
|
||||
kdDebug() << "Changed font... "
|
||||
<< endl << ConfigInit().m_fontAppNameFont
|
||||
<< endl << ConfigInit().m_fontAppCommentFont
|
||||
<< endl << ConfigInit().m_fontIndexFont
|
||||
<< endl << ConfigInit().m_userNameFont
|
||||
<< endl << ConfigInit().m_sepNameFont
|
||||
<< endl << ConfigInit().m_pluginNameFont
|
||||
<< endl << ConfigInit().m_fontTooltipFont
|
||||
<< endl;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgFonts::KbfxBoldHover_toggled( bool state )
|
||||
{
|
||||
ConfigInit().m_fontHoverBold = state;
|
||||
kdDebug() << "Bold on hover is: "
|
||||
<< endl << ConfigInit().m_fontHoverBold
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,641 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgLayout::init()
|
||||
{
|
||||
KbfxLayoutProperty->clear();
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "User Properties" ) ); // index = 0
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "* Top Bar Properties" ) ); // index = 1
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "* Bottom Bar Properties" ) ); // index = 2
|
||||
// KbfxLayoutProperty->insertItem ( tr2i18n ( "Scroll Bar Properties" ) ); // index = 3
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "* List Box Properties" ) ); // index = 4
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "Search Box Properties" ) ); // index = 5
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "* Item Properties" ) ); // index = 6
|
||||
// KbfxLayoutProperty->insertItem ( tr2i18n ( "Tool Bar Properties" ) ); // index = 7
|
||||
KbfxLayoutProperty->insertItem ( tr2i18n ( "* Main Menu Properties" ) ); // index = 8
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::ChangeForm()
|
||||
{
|
||||
KbfxTheme->setText ( "<p align=left><b>" + ConfigInit().m_SpinxThemeName + "</b></p>" );
|
||||
KbfxLayoutProperty->setCurrentItem ( 0 );
|
||||
previous_state = -1;
|
||||
KbfxLayoutProperty_activated ( 0 );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::KbfxLayoutProperty_activated( int index )
|
||||
{
|
||||
switch ( previous_state )
|
||||
{
|
||||
case 0: /* User Properties */
|
||||
{
|
||||
ConfigInit().m_facePos_x = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_facePos_y = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_userNamePos_x = ( lineEdit3->text () ).toInt();
|
||||
ConfigInit().m_userNamePos_y = ( lineEdit4->text () ).toInt();
|
||||
ConfigInit().m_faceIconX = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_faceIconY = ( lineEdit6->text () ).toInt();
|
||||
ConfigInit().m_faceIconH = ( lineEdit7->text () ).toInt();
|
||||
ConfigInit().m_faceIconW = ( lineEdit8->text () ).toInt();
|
||||
ConfigInit().m_faceBoxHideText = checkBox1->isChecked ();
|
||||
kdDebug() << "User Properties VALUES: "
|
||||
<< endl << ConfigInit().m_facePos_x
|
||||
<< endl << ConfigInit().m_facePos_y
|
||||
<< endl << ConfigInit().m_userNamePos_x
|
||||
<< endl << ConfigInit().m_userNamePos_y
|
||||
<< endl << ConfigInit().m_faceIconX
|
||||
<< endl << ConfigInit().m_faceIconY
|
||||
<< endl << ConfigInit().m_faceIconH
|
||||
<< endl << ConfigInit().m_faceIconW
|
||||
<< endl << ConfigInit().m_faceBoxHideText
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
case 1: /* Top Bar Properties */
|
||||
{
|
||||
/*
|
||||
ConfigInit().m_topBar_x = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_topBar_y = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_topBar_h = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_topBar_w = ( lineEdit6->text () ).toInt();
|
||||
*/
|
||||
ConfigInit().m_topBar_h = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_topBar_w = ( lineEdit5->text () ).toInt();
|
||||
kdDebug() << "Top Bar Properties VALUES: "
|
||||
// << endl << ConfigInit().m_topBar_x
|
||||
// << endl << ConfigInit().m_topBar_y
|
||||
<< endl << ConfigInit().m_topBar_h
|
||||
<< endl << ConfigInit().m_topBar_w
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
case 2: /* Bottom Bar Properties */
|
||||
{
|
||||
/*
|
||||
ConfigInit().m_botBar_x = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_botBar_y = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_botBar_h = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_botBar_w = ( lineEdit6->text () ).toInt();
|
||||
*/
|
||||
ConfigInit().m_botBar_h = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_botBar_w = ( lineEdit5->text () ).toInt();
|
||||
kdDebug() << "Bottom Bar Properties VALUES: "
|
||||
// << endl << ConfigInit().m_botBar_x
|
||||
// << endl << ConfigInit().m_botBar_y
|
||||
<< endl << ConfigInit().m_botBar_h
|
||||
<< endl << ConfigInit().m_botBar_w
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
case 3: // Scroll Bar Properties
|
||||
{
|
||||
ConfigInit().m_scrollBarTopX = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_scrollBarTopY = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_scrollBarBotX = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_scrollBarBotY = ( lineEdit6->text () ).toInt();
|
||||
kdDebug() << "Scroll Bar Properties VALUES: "
|
||||
<< endl << ConfigInit().m_scrollBarTopX
|
||||
<< endl << ConfigInit().m_scrollBarTopY
|
||||
<< endl << ConfigInit().m_scrollBarBotX
|
||||
<< endl << ConfigInit().m_scrollBarBotY
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
case 3: /* List Box Properties */
|
||||
{
|
||||
ConfigInit().m_listBox_x = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_listBox_y = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_listBox_h = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_listBox_w = ( lineEdit6->text () ).toInt();
|
||||
kdDebug() << "List Box Properties VALUES: "
|
||||
<< endl << ConfigInit().m_listBox_x
|
||||
<< endl << ConfigInit().m_listBox_y
|
||||
<< endl << ConfigInit().m_listBox_h
|
||||
<< endl << ConfigInit().m_listBox_w
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
case 4: /* Search Box Properties */
|
||||
{
|
||||
ConfigInit().m_searchBox_x = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_searchBox_y = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_searchBox_h = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_searchBox_w = ( lineEdit6->text () ).toInt();
|
||||
kdDebug() << "Search Box Properties VALUES: "
|
||||
<< endl << ConfigInit().m_searchBox_x
|
||||
<< endl << ConfigInit().m_searchBox_y
|
||||
<< endl << ConfigInit().m_searchBox_h
|
||||
<< endl << ConfigInit().m_searchBox_w
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
case 5: /* Item Properties */
|
||||
{
|
||||
ConfigInit().m_itemView_x = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_itemView_y = ( lineEdit2->text () ).toInt();
|
||||
ConfigInit().m_iconSize = ( lineEdit3->text () ).toInt();
|
||||
ConfigInit().m_itemView_h = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_itemView_w = ( lineEdit6->text () ).toInt();
|
||||
ConfigInit().m_commentMargine = ( lineEdit7->text () ).toInt();
|
||||
ConfigInit().m_noComments = checkBox1->isChecked ();
|
||||
kdDebug() << "Item Properties VALUES: "
|
||||
<< endl << ConfigInit().m_itemView_x
|
||||
<< endl << ConfigInit().m_itemView_y
|
||||
<< endl << ConfigInit().m_iconSize
|
||||
<< endl << ConfigInit().m_itemView_h
|
||||
<< endl << ConfigInit().m_itemView_w
|
||||
<< endl << ConfigInit().m_commentMargine
|
||||
<< endl << ConfigInit().m_noComments
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 6: // Tool Bar Properties
|
||||
{
|
||||
ConfigInit().m_toolBarButtonNormalSize = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_toolBarButtonExpandSize = ( lineEdit5->text () ).toInt();
|
||||
kdDebug() << "Tool Bar Properties VALUES: "
|
||||
<< endl << ConfigInit().m_toolBarButtonNormalSize
|
||||
<< endl << ConfigInit().m_toolBarButtonExpandSize
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 6: /* Main Menu Properties */
|
||||
{
|
||||
ConfigInit().m_userMenuHeight = ( lineEdit1->text () ).toInt();
|
||||
ConfigInit().m_userMenuWidth = ( lineEdit5->text () ).toInt();
|
||||
ConfigInit().m_startHidden = checkBox1->isChecked ();
|
||||
kdDebug() << "Main Menu Properties VALUES: "
|
||||
<< endl << ConfigInit().m_userMenuHeight
|
||||
<< endl << ConfigInit().m_userMenuWidth
|
||||
<< endl << ConfigInit().m_startHidden
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
default: /* default action switch does nothing */
|
||||
kdDebug() << "Default action switch for saving layout changed..." << endl;
|
||||
}
|
||||
|
||||
KbfxShowAll ();
|
||||
switch ( index )
|
||||
{
|
||||
case 0: /* User Properties */
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "Face Position X" ) );
|
||||
textLabel2->setText ( tr2i18n ( "Face Position Y" ) );
|
||||
textLabel3->setText ( tr2i18n ( "User Name Position X" ) );
|
||||
textLabel4->setText ( tr2i18n ( "User Name Position Y" ) );
|
||||
textLabel5->setText ( tr2i18n ( "Face Box Position X" ) );
|
||||
textLabel6->setText ( tr2i18n ( "Face Box Position Y" ) );
|
||||
textLabel7->setText ( tr2i18n ( "Face Box Height" ) );
|
||||
textLabel8->setText ( tr2i18n ( "Face Box Width" ) );
|
||||
checkBox1->setText ( tr2i18n ( "Hide User Name" ) );
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_facePos_x ) );
|
||||
lineEdit2->setText ( QString::number ( ConfigInit().m_facePos_y ) );
|
||||
lineEdit3->setText ( QString::number ( ConfigInit().m_userNamePos_x ) );
|
||||
lineEdit4->setText ( QString::number ( ConfigInit().m_userNamePos_y ) );
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_faceIconX ) );
|
||||
lineEdit6->setText ( QString::number ( ConfigInit().m_faceIconY ) );
|
||||
lineEdit7->setText ( QString::number ( ConfigInit().m_faceIconH ) );
|
||||
lineEdit8->setText ( QString::number ( ConfigInit().m_faceIconW ) );
|
||||
checkBox1->setChecked ( ConfigInit().m_faceBoxHideText );
|
||||
previous_state = 0;
|
||||
break;
|
||||
}
|
||||
case 1: /* Top Bar Properties */
|
||||
{
|
||||
// textLabel1->setText ( tr2i18n ( "Top Bar Position X" ) );
|
||||
// textLabel2->setText ( tr2i18n ( "Top Bar Position Y" ) );
|
||||
textLabel1->setText ( tr2i18n ( "* Top Bar Height" ) );
|
||||
textLabel2->hide();
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
// textLabel5->setText ( tr2i18n ( "Top Bar Height" ) );
|
||||
// textLabel6->setText ( tr2i18n ( "Top Bar Width" ) );
|
||||
textLabel5->setText ( tr2i18n ( "Top Bar Width" ) );
|
||||
textLabel6->hide();
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->hide();
|
||||
checkBox2->hide();
|
||||
// lineEdit1->setText ( QString::number ( ConfigInit().m_topBar_x ) );
|
||||
// lineEdit2->setText ( QString::number ( ConfigInit().m_topBar_y ) );
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_topBar_h ) );
|
||||
lineEdit2->hide();
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
// lineEdit5->setText ( QString::number ( ConfigInit().m_topBar_h ) );
|
||||
// lineEdit6->setText ( QString::number ( ConfigInit().m_topBar_w ) );
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_topBar_w ) );
|
||||
lineEdit6->hide();
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
previous_state = 1;
|
||||
break;
|
||||
}
|
||||
case 2: /* Bottom Bar Properties */
|
||||
{
|
||||
// textLabel1->setText ( tr2i18n ( "Bottom Bar Position X" ) );
|
||||
// textLabel2->setText ( tr2i18n ( "Bottom Bar Position Y" ) );
|
||||
textLabel1->setText ( tr2i18n ( "* Bottom Bar Height" ) );
|
||||
textLabel2->hide();
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
// textLabel5->setText ( tr2i18n ( "Bottom Bar Height" ) );
|
||||
// textLabel6->setText ( tr2i18n ( "Bottom Bar Width" ) );
|
||||
textLabel5->setText ( tr2i18n ( "Bottom Bar Width" ) );
|
||||
textLabel6->hide();
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->hide();
|
||||
checkBox2->hide();
|
||||
// lineEdit1->setText ( QString::number ( ConfigInit().m_botBar_x ) );
|
||||
// lineEdit2->setText ( QString::number ( ConfigInit().m_botBar_y ) );
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_botBar_h ) );
|
||||
lineEdit2->hide();
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
// lineEdit5->setText ( QString::number ( ConfigInit().m_botBar_h ) );
|
||||
// lineEdit6->setText ( QString::number ( ConfigInit().m_botBar_w ) );
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_botBar_w ) );
|
||||
lineEdit6->hide();
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
previous_state = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
case 3: // Scroll Bar Properties
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "Top Scroll Bar Position X" ) );
|
||||
textLabel2->setText ( tr2i18n ( "Top Scroll Bar Position Y" ) );
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
textLabel5->setText ( tr2i18n ( "Bottom Scroll Bar Position X" ) );
|
||||
textLabel6->setText ( tr2i18n ( "Bottom Scroll Bar Position Y" ) );
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->hide();
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_scrollBarTopX ) );
|
||||
lineEdit2->setText ( QString::number ( ConfigInit().m_scrollBarTopY ) );
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_scrollBarBotX ) );
|
||||
lineEdit6->setText ( QString::number ( ConfigInit().m_scrollBarBotY ) );
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
previous_state = 3;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
case 3: /* List Box Properties */
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "* List Box Position X" ) );
|
||||
textLabel2->setText ( tr2i18n ( "* List Box Position Y" ) );
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
textLabel5->setText ( tr2i18n ( "List Box Height" ) );
|
||||
textLabel6->setText ( tr2i18n ( "* List Box Width" ) );
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->hide();
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_listBox_x ) );
|
||||
lineEdit2->setText ( QString::number ( ConfigInit().m_listBox_y ) );
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_listBox_h ) );
|
||||
lineEdit6->setText ( QString::number ( ConfigInit().m_listBox_w ) );
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
previous_state = 3;
|
||||
break;
|
||||
}
|
||||
case 4: /* Search Box Properties */
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "Search Box Position X" ) );
|
||||
textLabel2->setText ( tr2i18n ( "Search Box Position Y" ) );
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
textLabel5->setText ( tr2i18n ( "Search Box Height" ) );
|
||||
textLabel6->setText ( tr2i18n ( "Search Box Width" ) );
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->hide();
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_searchBox_x ) );
|
||||
lineEdit2->setText ( QString::number ( ConfigInit().m_searchBox_y ) );
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_searchBox_h ) );
|
||||
lineEdit6->setText ( QString::number ( ConfigInit().m_searchBox_w ) );
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
previous_state = 4;
|
||||
break;
|
||||
}
|
||||
case 5: /* Item Properties */
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "* Item Position X" ) );
|
||||
textLabel2->setText ( tr2i18n ( "* Item Position Y" ) );
|
||||
textLabel3->setText ( tr2i18n ( "Icon Size in Item" ) );
|
||||
textLabel4->hide();
|
||||
textLabel5->setText ( tr2i18n ( "Item Height" ) );
|
||||
textLabel6->setText ( tr2i18n ( "* Item Width" ) );
|
||||
textLabel7->setText ( tr2i18n ( "Comment Margin in Item" ) );
|
||||
textLabel8->hide();
|
||||
checkBox1->setText ( tr2i18n ( "No Comments in Item" ) );
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_itemView_x ) );
|
||||
lineEdit2->setText ( QString::number ( ConfigInit().m_itemView_y ) );
|
||||
lineEdit3->setText ( QString::number ( ConfigInit().m_iconSize ) );
|
||||
lineEdit4->hide();
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_itemView_h ) );
|
||||
lineEdit6->setText ( QString::number ( ConfigInit().m_itemView_w ) );
|
||||
lineEdit7->setText ( QString::number ( ConfigInit().m_commentMargine ) );
|
||||
lineEdit8->hide();
|
||||
checkBox1->setChecked ( ConfigInit().m_noComments );
|
||||
previous_state = 5;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 6: // Tool Bar Properties
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "Tool Bar Button Normal Size" ) );
|
||||
textLabel2->hide();
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
textLabel5->setText ( tr2i18n ( "Tool Bar Button Pressed Size" ) );
|
||||
textLabel6->hide();
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->hide();
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_toolBarButtonNormalSize ) );
|
||||
lineEdit2->hide();
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_toolBarButtonExpandSize ) );
|
||||
lineEdit6->hide();
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
previous_state = 6;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 6: /* Main Menu Properties */
|
||||
{
|
||||
textLabel1->setText ( tr2i18n ( "* Main Menu Height" ) );
|
||||
textLabel2->hide();
|
||||
textLabel3->hide();
|
||||
textLabel4->hide();
|
||||
textLabel5->setText ( tr2i18n ( "* Main Menu Width" ) );
|
||||
textLabel6->hide();
|
||||
textLabel7->hide();
|
||||
textLabel8->hide();
|
||||
checkBox1->setText ( tr2i18n ( "Contracted Menues" ) );
|
||||
checkBox2->hide();
|
||||
lineEdit1->setText ( QString::number ( ConfigInit().m_userMenuHeight ) );
|
||||
lineEdit2->hide();
|
||||
lineEdit3->hide();
|
||||
lineEdit4->hide();
|
||||
lineEdit5->setText ( QString::number ( ConfigInit().m_userMenuWidth ) );
|
||||
lineEdit6->hide();
|
||||
lineEdit7->hide();
|
||||
lineEdit8->hide();
|
||||
checkBox1->setChecked ( ConfigInit().m_startHidden );
|
||||
previous_state = 6;
|
||||
break;
|
||||
}
|
||||
default: /* default action switch should never be reached */
|
||||
kdDebug() << "Default action switch for layout changed..." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::KbfxShowAll()
|
||||
{
|
||||
textLabel1->show();
|
||||
textLabel2->show();
|
||||
textLabel3->show();
|
||||
textLabel4->show();
|
||||
textLabel5->show();
|
||||
textLabel6->show();
|
||||
textLabel7->show();
|
||||
textLabel8->show();
|
||||
checkBox1->show();
|
||||
checkBox2->show();
|
||||
lineEdit1->show();
|
||||
lineEdit2->show();
|
||||
lineEdit3->show();
|
||||
lineEdit4->show();
|
||||
lineEdit5->show();
|
||||
lineEdit6->show();
|
||||
lineEdit7->show();
|
||||
lineEdit8->show();
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::KbfxExportFileAction()
|
||||
{
|
||||
QString KbfxExportLayoutRcDialogURL = KFileDialog::getExistingDirectory (
|
||||
QString::null,
|
||||
0,
|
||||
tr2i18n ( "Select folder to export kbfxlayoutrc file" ) ).append ( "/kbfxlayoutrc" );
|
||||
|
||||
if ( KbfxExportLayoutRcDialogURL == "/kbfxlayoutrc") return;
|
||||
|
||||
kdDebug() << "Selected export file is: "
|
||||
<< KbfxExportLayoutRcDialogURL
|
||||
<< endl;
|
||||
|
||||
/* write layout theme configuration file */
|
||||
KConfig *layoutconfig = new KConfig ( KbfxExportLayoutRcDialogURL );
|
||||
|
||||
layoutconfig->setGroup ( "KbfxButton" );
|
||||
layoutconfig->writeEntry ( "FadeTime", ConfigInit().m_fadeTime );
|
||||
|
||||
/*
|
||||
// No need for this to be exported because it is user/installation specific
|
||||
layoutconfig->writeEntry ( "Normal", ConfigInit().m_KbfxNormalButtonPath );
|
||||
layoutconfig->writeEntry ( "Hover", ConfigInit().m_KbfxHoverButtonPath );
|
||||
layoutconfig->writeEntry ( "Press", ConfigInit().m_KbfxPressedButtonPath );
|
||||
|
||||
layoutconfig->setGroup ( "ToolTip" );
|
||||
layoutconfig->writeEntry ( "Avatar", m_ToolTipAvatar );
|
||||
layoutconfig->writeEntry ( "Dudebox", m_SpinxTooltipDudebox );
|
||||
layoutconfig->writeEntry ( "Mask", m_SpinxTooltipMask );
|
||||
layoutconfig->writeEntry ( "Window", m_SpinxTooltipWindow );
|
||||
layoutconfig->writeEntry ( "Logo", m_SpinxTooltipLogo );
|
||||
*/
|
||||
|
||||
layoutconfig->setGroup ( "TopBar" );
|
||||
layoutconfig->writeEntry ( "DudeX", ConfigInit().m_facePos_x );
|
||||
layoutconfig->writeEntry ( "DudeY", ConfigInit().m_facePos_y );
|
||||
layoutconfig->writeEntry ( "FaceX", ConfigInit().m_faceIconX );
|
||||
layoutconfig->writeEntry ( "FaceY", ConfigInit().m_faceIconY );
|
||||
layoutconfig->writeEntry ( "FaceH", ConfigInit().m_faceIconH );
|
||||
layoutconfig->writeEntry ( "FaceW", ConfigInit().m_faceIconW );
|
||||
layoutconfig->writeEntry ( "UserNameX", ConfigInit().m_userNamePos_x );
|
||||
layoutconfig->writeEntry ( "UserNameY", ConfigInit().m_userNamePos_y );
|
||||
layoutconfig->writeEntry ( "DisableUserName", ConfigInit().m_faceBoxHideText );
|
||||
layoutconfig->writeEntry ( "Height", ConfigInit().m_topBar_h );
|
||||
layoutconfig->writeEntry ( "Width", ConfigInit().m_topBar_w );
|
||||
layoutconfig->writeEntry ( "X", ConfigInit().m_topBar_x );
|
||||
layoutconfig->writeEntry ( "Y", ConfigInit().m_topBar_y );
|
||||
|
||||
layoutconfig->setGroup ( "BottomBar" );
|
||||
layoutconfig->writeEntry ( "Height", ConfigInit().m_botBar_h );
|
||||
layoutconfig->writeEntry ( "Width", ConfigInit().m_botBar_w );
|
||||
layoutconfig->writeEntry ( "X", ConfigInit().m_botBar_x );
|
||||
layoutconfig->writeEntry ( "Y", ConfigInit().m_botBar_y );
|
||||
|
||||
layoutconfig->setGroup ( "Scrollbars" );
|
||||
layoutconfig->writeEntry ( "ScrollBarBotX", ConfigInit().m_scrollBarBotX );
|
||||
layoutconfig->writeEntry ( "ScrollBarBotY", ConfigInit().m_scrollBarBotY );
|
||||
layoutconfig->writeEntry ( "ScrollBarTopX", ConfigInit().m_scrollBarTopX );
|
||||
layoutconfig->writeEntry ( "ScrollBarTopY", ConfigInit().m_scrollBarTopY );
|
||||
|
||||
layoutconfig->setGroup ( "ListBox" );
|
||||
layoutconfig->writeEntry ( "Height", ConfigInit().m_listBox_h );
|
||||
layoutconfig->writeEntry ( "Width", ConfigInit().m_listBox_w );
|
||||
layoutconfig->writeEntry ( "X", ConfigInit().m_listBox_x );
|
||||
layoutconfig->writeEntry ( "Y", ConfigInit().m_listBox_y );
|
||||
|
||||
layoutconfig->setGroup ( "SearchBox" );
|
||||
layoutconfig->writeEntry ( "Height", ConfigInit().m_searchBox_h );
|
||||
layoutconfig->writeEntry ( "Width", ConfigInit().m_searchBox_w );
|
||||
layoutconfig->writeEntry ( "X", ConfigInit().m_searchBox_x );
|
||||
layoutconfig->writeEntry ( "Y", ConfigInit().m_searchBox_y );
|
||||
layoutconfig->writeEntry ( "FixedPos", ConfigInit().m_searchBox_static );
|
||||
|
||||
layoutconfig->setGroup ( "ItemView" );
|
||||
layoutconfig->writeEntry ( "Height", ConfigInit().m_itemView_h );
|
||||
layoutconfig->writeEntry ( "Width", ConfigInit().m_itemView_w );
|
||||
layoutconfig->writeEntry ( "X", ConfigInit().m_itemView_x );
|
||||
layoutconfig->writeEntry ( "Y", ConfigInit().m_itemView_y );
|
||||
|
||||
layoutconfig->setGroup ( "ToolBar" );
|
||||
layoutconfig->writeEntry ( "ButtonNormalSize", ConfigInit().m_toolBarButtonNormalSize );
|
||||
layoutconfig->writeEntry ( "ButtonPressedSize", ConfigInit().m_toolBarButtonExpandSize );
|
||||
|
||||
layoutconfig->setGroup ( "MainMenu" );
|
||||
layoutconfig->writeEntry ( "UserMenuHeight", ConfigInit().m_userMenuHeight );
|
||||
layoutconfig->writeEntry ( "UserMenuWidth", ConfigInit().m_userMenuWidth );
|
||||
layoutconfig->writeEntry ( "ContractedMenu", ConfigInit().m_startHidden );
|
||||
|
||||
layoutconfig->setGroup ( "ItemProperties" );
|
||||
layoutconfig->writeEntry ( "NoComments", ConfigInit().m_noComments );
|
||||
layoutconfig->writeEntry ( "CommentMargin", ConfigInit().m_commentMargine );
|
||||
layoutconfig->writeEntry ( "IconSize", ConfigInit().m_iconSize );
|
||||
|
||||
layoutconfig->sync();
|
||||
|
||||
delete layoutconfig;
|
||||
|
||||
KMessageBox::information ( 0,
|
||||
tr2i18n ( "<p align='center'>The Layout configuration of the KBFX Theme <strong>%1</strong> has been exported successfully!</p>" ).arg ( ConfigInit().m_SpinxThemeName ),
|
||||
tr2i18n ( "KBFX Layout Export Ready" ) );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::LayoutFormLeft()
|
||||
{
|
||||
KbfxLayoutProperty_activated ( previous_state );
|
||||
kdDebug() << "Called Leave form... Previous state is:" << previous_state << endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::Kbfx2PanelsLeft_clicked()
|
||||
{
|
||||
KbfxMakePanel( 0 );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::Kbfx2PanelsRight_clicked()
|
||||
{
|
||||
KbfxMakePanel( 1 );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::Kbfx3Panels_clicked()
|
||||
{
|
||||
KbfxMakePanel( 2 );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgLayout::KbfxMakePanel( int l_type )
|
||||
{
|
||||
if ( !KbfxMessage() )
|
||||
return;
|
||||
|
||||
LayoutFormLeft();
|
||||
int mid_h = ConfigInit().m_userMenuHeight - ConfigInit().m_botBar_h - ConfigInit().m_topBar_h;
|
||||
int mid_w = ConfigInit().m_userMenuWidth;
|
||||
|
||||
ConfigInit().m_topBar_w = mid_w;
|
||||
ConfigInit().m_botBar_w = mid_w;
|
||||
ConfigInit().m_listBox_h = mid_h;
|
||||
ConfigInit().m_listBox_w = mid_w/4;
|
||||
ConfigInit().m_itemView_h = mid_h;
|
||||
ConfigInit().m_listBox_y = ConfigInit().m_topBar_h;
|
||||
ConfigInit().m_itemView_y = ConfigInit().m_topBar_h;
|
||||
|
||||
if ( l_type == 0 )
|
||||
{
|
||||
ConfigInit().m_listBox_x = 0;
|
||||
ConfigInit().m_itemView_x = ConfigInit().m_listBox_w;
|
||||
ConfigInit().m_itemView_w = mid_w - ConfigInit().m_listBox_w;
|
||||
}
|
||||
|
||||
if ( l_type == 1 )
|
||||
{
|
||||
ConfigInit().m_itemView_x = 0;
|
||||
ConfigInit().m_itemView_w = mid_w - ConfigInit().m_listBox_w;
|
||||
ConfigInit().m_listBox_x = ConfigInit().m_itemView_w;
|
||||
}
|
||||
|
||||
if ( l_type == 2 )
|
||||
{
|
||||
ConfigInit().m_listBox_x = 0;
|
||||
ConfigInit().m_itemView_x = ConfigInit().m_listBox_w;
|
||||
ConfigInit().m_itemView_w = mid_w/2;
|
||||
}
|
||||
|
||||
KbfxLayoutProperty->setCurrentItem ( 0 );
|
||||
previous_state = -1;
|
||||
KbfxLayoutProperty_activated ( 0 );
|
||||
|
||||
KMessageBox::information ( 0,
|
||||
tr2i18n ( "<p align='center'>The Layout configuration of the KBFX Theme <strong>%1</strong> is ready!</p><p align='center'>Be sure to click the <strong>Apply</strong> button in order the changes to become active!</p>" ).arg ( ConfigInit().m_SpinxThemeName ),
|
||||
tr2i18n ( "KBFX Layout Ready" ) );
|
||||
}
|
||||
|
||||
bool KbfxConfigDlgLayout::KbfxMessage()
|
||||
{
|
||||
int messageBoxReturn = KMessageBox::warningContinueCancel ( 0,
|
||||
tr2i18n ( "<p align='center'>KBFX will calculate the necessary values using the present values for:</p>"
|
||||
"<p align='center'><strong>* Main Menu Height</strong> and <strong>* Main Menu Width</strong><br>"
|
||||
"<strong>* Bottom Bar Height</strong> and <strong>* Top Bar Height</strong><br></p>"
|
||||
"<p align='center'>So be sure that you have entered their values as you desire!</p>"
|
||||
"<p align='center'><strong>NOTE:</strong> Have in mind that the Layout of the theme also depends on the sizes of the images! "
|
||||
"So if the theme does not look like as you desire either change the images' sizes to smaller width OR change <strong>* Main Menu Width</strong> to higher value!</p>" ),
|
||||
tr2i18n ( "Prepare Layout for the KBFX theme" ),
|
||||
tr2i18n ( "Prepare" ) );
|
||||
|
||||
if ( messageBoxReturn == KMessageBox::Cancel )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgMain::init()
|
||||
{
|
||||
img_button = image1;
|
||||
img_themes = image2;
|
||||
img_fonts = image3;
|
||||
img_style = image4;
|
||||
img_tooltip = image5;
|
||||
img_search = image6;
|
||||
img_plugins = image7;
|
||||
img_about = image8;
|
||||
}
|
||||
|
@ -0,0 +1,390 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>KbfxConfigDlgPlugins</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>KbfxConfigDlgPlugins</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>660</width>
|
||||
<height>217</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>KBFX Control Center</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>Minimum</enum>
|
||||
</property>
|
||||
<widget class="KActiveLabel" row="0" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>kActiveLabel37</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>29</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32767</width>
|
||||
<height>29</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="paletteForegroundColor">
|
||||
<color>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="paletteBackgroundPixmap">
|
||||
<pixmap>image0</pixmap>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>NoFocus</enum>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>AutoText</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><b><h3><p align="center">Plugins options</p></h3></b></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>KbfxSelectPanel</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>StyledPanel</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Select KBFX Panel</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="KComboBox" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>KbfxPanel</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32767</width>
|
||||
<height>44</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>WheelFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Plugin to configure</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Plugin to configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32767</width>
|
||||
<height>44</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Please select the panel you want to configure: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="KActionSelector" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>KbfxPluginSelector</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>WheelFocus</enum>
|
||||
</property>
|
||||
<property name="availableLabel">
|
||||
<string>&Available Plugins:</string>
|
||||
</property>
|
||||
<property name="selectedLabel">
|
||||
<string>&Enabled Plugins:</string>
|
||||
</property>
|
||||
<property name="buttonIconSize">
|
||||
<enum>SmallIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget" row="3" column="2">
|
||||
<property name="name">
|
||||
<cstring>layout3</cstring>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>KbfxConfigurePluginButton</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>WheelFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Configure Plugin</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>Alt+C</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Configure the selected plugin</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Configure the selected plugin</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>KbfxPluginInfoButton</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>WheelFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Plugin Information</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>Alt+P</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Information about the selected plugin</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Information about the selected plugin</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer2_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
<spacer row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
</customwidgets>
|
||||
<images>
|
||||
<image name="image0">
|
||||
<data format="XPM.GZ" length="4075">789ced974b6fda401446f7fc0a8bec5095601eb64755174d7080a669d3b48b4a5517e33134a1101230e151f5bfd7f7bbc3f8510bb29a45d5b331e77e77c6c6067b7cd670bede5c3b8db3da3291c9bd72d49d5c388d78359b6dbf7d7ff3ab5677dda6d3124e2770dcfaab5afdd651ce4953785d11937e822acf63bd81c67bfd0c1d793eeb47ad8118917e20755d4f8a31e935d4f394c48ede4395df941dd277a4adaedf9501e995568f75001dfb9154a443ad8ab547da96412bc2cc97465ba4a1d636a77da348df9276ba818c3cd273a33ee985d688d30d69d7156e14916e8de230d65a5b9cee8c22fd028dfd91c05409ab08549374611407b9d42a387d328af459abe4746514e99cd40b645375491f8c62bf8f5a5d4e6746914e49fdb64c2f12e94fad3eeb049a9e7485eb7baf3566bd23a5b31ce3c4fe808aa813e3fa8ea02af263ec68ac35603d85c642ffea147494a6b80ab156c17a422a9afb34d22a631ca4d41ab19e5a058767157ce52a22a6322bb51debc95a69830b5445cc5466a5b6633d592b6df0fba962cc5466a5b6633d592b6df003b60afe4156c15ff810938c5ca9f4a16c93228509714b39c43423572a7d28dbb4486142dce2521e8acce78f9a3983da3c5f6152a7b17a8afdb042cb1c33cef6e0760d160ccbd290243a5824cb65be6cf449b35a9961cf29694752985383470fd86c36db941d581bb84a6cd6eb7cd9e82ea3d4b11fbacb83e7668173f07705a58b14aeec4378aeab3032ad16356dc753be17863d260cc34ba26f2a3daa6429d337a50c1a13f6fb61a99a178cc5aa63301c0e98a1fe3434952c435533a8e04094efc02ae8a55c8117b7578fc732cc2a58075a050b51ab60256c15acccad825703abfcdfe3bfb3c75babe045d52a78ddb34afdf7ebda1f4394dd1e</data>
|
||||
</image>
|
||||
</images>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>KbfxConfigurePluginButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxConfigurePluginButton_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>KbfxPluginInfoButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxPluginInfoButton_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>KbfxPanel</sender>
|
||||
<signal>activated(int)</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxPanelSelected(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>KbfxPluginSelector</sender>
|
||||
<signal>movedDown(QListBoxItem*)</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxPluginSelector_movedDown(QListBoxItem*)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>KbfxPluginSelector</sender>
|
||||
<signal>movedUp(QListBoxItem*)</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxPluginSelector_movedUp(QListBoxItem*)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>KbfxPluginSelector</sender>
|
||||
<signal>removed(QListBoxItem*)</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxPluginSelector_removed(QListBoxItem*)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>KbfxPluginSelector</sender>
|
||||
<signal>added(QListBoxItem*)</signal>
|
||||
<receiver>KbfxConfigDlgPlugins</receiver>
|
||||
<slot>KbfxPluginSelector_added(QListBoxItem*)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>KbfxPanel</tabstop>
|
||||
<tabstop>KbfxPluginSelector</tabstop>
|
||||
<tabstop>KbfxConfigurePluginButton</tabstop>
|
||||
<tabstop>KbfxPluginInfoButton</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="global" impldecl="in declaration">kbfxthemesdata.h</include>
|
||||
<include location="global" impldecl="in declaration">kbfxconfig.h</include>
|
||||
<include location="global" impldecl="in declaration">kdebug.h</include>
|
||||
<include location="global" impldecl="in declaration">qstringlist.h</include>
|
||||
<include location="global" impldecl="in declaration">kstandarddirs.h</include>
|
||||
<include location="global" impldecl="in declaration">kmessagebox.h</include>
|
||||
<include location="global" impldecl="in declaration">qlistbox.h</include>
|
||||
<include location="global" impldecl="in declaration">kbfxplasmapluginloader.h</include>
|
||||
<include location="local" impldecl="in implementation">kbfxconfigdlgplugins.ui.h</include>
|
||||
</includes>
|
||||
<slots>
|
||||
<slot>ChangeForm()</slot>
|
||||
<slot>KbfxConfigurePluginButton_clicked()</slot>
|
||||
<slot>KbfxPluginInfoButton_clicked()</slot>
|
||||
<slot>KbfxPanelSelected( int _sel )</slot>
|
||||
<slot>KbfxPluginSelector_movedDown( QListBoxItem * )</slot>
|
||||
<slot>KbfxPluginSelector_movedUp( QListBoxItem * )</slot>
|
||||
<slot>KbfxPluginSelector_removed( QListBoxItem * )</slot>
|
||||
<slot>KbfxPluginSelector_added( QListBoxItem * )</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function access="private" returnType="QStringList">KbfxListPlugins( int panel )</function>
|
||||
<function access="private">KbfxSaveSelectedPlugins()</function>
|
||||
</functions>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
<includehints>
|
||||
<includehint>kactivelabel.h</includehint>
|
||||
<includehint>kcombobox.h</includehint>
|
||||
<includehint>kactionselector.h</includehint>
|
||||
</includehints>
|
||||
</UI>
|
@ -0,0 +1,157 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
void KbfxConfigDlgPlugins::init()
|
||||
{
|
||||
KbfxPanel->clear();
|
||||
KbfxPanel->insertItem ( tr2i18n ( "Left Panel" ) ); // index = 0
|
||||
KbfxPanel->insertItem ( tr2i18n ( "Right Panel" ) ); // index = 1
|
||||
}
|
||||
|
||||
void KbfxConfigDlgPlugins::ChangeForm()
|
||||
{
|
||||
KbfxPanel->setCurrentItem ( 0 );
|
||||
KbfxPluginSelector-> selectedListBox()-> clear();
|
||||
KbfxPluginSelector-> availableListBox()-> clear();
|
||||
KbfxPluginSelector-> selectedListBox()-> insertStringList ( ConfigInit().m_pluginsLeft );
|
||||
KbfxPluginSelector-> availableListBox()-> insertStringList ( KbfxListPlugins ( 0 ) ); // list Left Panel Plugins
|
||||
}
|
||||
|
||||
QStringList KbfxConfigDlgPlugins::KbfxListPlugins ( int panel )
|
||||
{
|
||||
QStringList _plugins;
|
||||
_plugins.clear();
|
||||
bool _not_present;
|
||||
QStringList::Iterator it_available;
|
||||
QStringList::Iterator it_requested;
|
||||
|
||||
KbfxPlasmaPluginLoader *_tmp = new KbfxPlasmaPluginLoader();
|
||||
QStringList allPlugins = _tmp -> scanPlugins();
|
||||
delete _tmp;
|
||||
|
||||
for ( it_available = allPlugins.begin(); it_available != allPlugins.end(); ++it_available )
|
||||
{
|
||||
_not_present = TRUE;
|
||||
if ( panel == 0 )
|
||||
{
|
||||
for ( it_requested = ConfigInit ().m_pluginsLeft.begin ();
|
||||
it_requested != ConfigInit ().m_pluginsLeft.end (); ++it_requested )
|
||||
{
|
||||
if ( ( *it_available ).contains ( *it_requested ) > 0 )
|
||||
{
|
||||
_not_present = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( panel == 1 )
|
||||
{
|
||||
for ( it_requested = ConfigInit ().m_pluginsRight.begin ();
|
||||
it_requested != ConfigInit ().m_pluginsRight.end (); ++it_requested )
|
||||
{
|
||||
if ( ( *it_available ).contains ( *it_requested ) > 0 )
|
||||
{
|
||||
_not_present = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( _not_present )
|
||||
{
|
||||
_plugins += ( *it_available );
|
||||
}
|
||||
}
|
||||
|
||||
kdDebug() << "Available PLUGINS: " << _plugins << endl;
|
||||
return _plugins;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxConfigurePluginButton_clicked()
|
||||
{
|
||||
KMessageBox::information ( 0, tr2i18n ( "<p align='center'>Not Implemented yet.</p>" ) );
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxPluginInfoButton_clicked()
|
||||
{
|
||||
KMessageBox::information ( 0, tr2i18n ( "<p align='center'>Not Implemented yet.</p>" ) );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxSaveSelectedPlugins()
|
||||
{
|
||||
int _selectedPanel = KbfxPanel->currentItem();
|
||||
QStringList _plugins;
|
||||
_plugins.clear();
|
||||
int it;
|
||||
int _num = KbfxPluginSelector-> selectedListBox()->count();
|
||||
for ( it = 0; it < _num; ++it )
|
||||
{
|
||||
_plugins += KbfxPluginSelector -> selectedListBox() -> text ( it );
|
||||
}
|
||||
kdDebug() << "Selected PLUGINS: " << _plugins << endl;
|
||||
if ( _selectedPanel == 0 )
|
||||
{
|
||||
ConfigInit().m_pluginsLeft = _plugins;
|
||||
kdDebug() << "Saved to Left Panel... " << endl;
|
||||
}
|
||||
if ( _selectedPanel == 1 )
|
||||
{
|
||||
ConfigInit().m_pluginsRight = _plugins;
|
||||
kdDebug() << "Saved to Right Panel... " << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxPanelSelected ( int _sel )
|
||||
{
|
||||
KbfxPluginSelector-> selectedListBox()-> clear();
|
||||
KbfxPluginSelector-> availableListBox()-> clear();
|
||||
if ( _sel )
|
||||
{
|
||||
KbfxPluginSelector-> selectedListBox()-> insertStringList ( ConfigInit().m_pluginsRight );
|
||||
KbfxPluginSelector-> availableListBox()-> insertStringList ( KbfxListPlugins ( 1 ) ); // list Right Panel Plugins
|
||||
}
|
||||
else
|
||||
{
|
||||
KbfxPluginSelector-> selectedListBox()-> insertStringList ( ConfigInit().m_pluginsLeft );
|
||||
KbfxPluginSelector-> availableListBox()-> insertStringList ( KbfxListPlugins ( 0 ) ); // list Left Panel Plugins
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxPluginSelector_movedDown ( QListBoxItem * )
|
||||
{
|
||||
/* save current selection */
|
||||
KbfxSaveSelectedPlugins();
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxPluginSelector_movedUp ( QListBoxItem * )
|
||||
{
|
||||
/* save current selection */
|
||||
KbfxSaveSelectedPlugins();
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxPluginSelector_removed ( QListBoxItem * )
|
||||
{
|
||||
/* save current selection */
|
||||
KbfxSaveSelectedPlugins();
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgPlugins::KbfxPluginSelector_added ( QListBoxItem * )
|
||||
{
|
||||
/* save current selection */
|
||||
KbfxSaveSelectedPlugins();
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgStyle::KbfxStyleSelected ( int id )
|
||||
{
|
||||
if ( id == 0 ) ConfigInit().m_KbfxMenuType="spinx";
|
||||
if ( id == 1 ) ConfigInit().m_KbfxMenuType="kmenu";
|
||||
|
||||
kdDebug() << "Selected style: " << ConfigInit().m_KbfxMenuType << endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgStyle::ChangeForm()
|
||||
{
|
||||
if ( ConfigInit().m_KbfxMenuType == "spinx" )
|
||||
KbfxStyleGroupBox->setButton ( 0 );
|
||||
|
||||
if ( ConfigInit().m_KbfxMenuType == "kmenu" )
|
||||
KbfxStyleGroupBox->setButton ( 1 );
|
||||
|
||||
kdDebug() << "Style: " << ConfigInit().m_KbfxMenuType << endl;
|
||||
}
|
@ -0,0 +1,367 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
KbfxThemeInfo * KbfxConfigDlgThemes::_info_box = 0;
|
||||
|
||||
void KbfxConfigDlgThemes::init()
|
||||
{
|
||||
KbfxFormReady = FALSE;
|
||||
img_nopreview = image0;
|
||||
|
||||
connect ( this, SIGNAL ( KbfxThemeDoInstall ( QString & ) ),
|
||||
this, SLOT ( KbfxThemeInstall ( QString & ) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
void KbfxConfigDlgThemes::KbfxDudeAnimationButtonToggled(bool)
|
||||
{
|
||||
if(KbfxAnimationButton->state() == 2)
|
||||
{
|
||||
KbfxAnimationButton->setText(tr2i18n("Animation is ON"));
|
||||
KbfxAnimationButton->setPaletteBackgroundColor(QColor(0,255,0));
|
||||
ConfigInit().m_SpinxDudeBlink = TRUE;
|
||||
}
|
||||
|
||||
if(KbfxAnimationButton->state() == 0)
|
||||
{
|
||||
KbfxAnimationButton->setText(tr2i18n("Animation is OFF"));
|
||||
KbfxAnimationButton->setPaletteBackgroundColor(QColor(221,223,228));
|
||||
ConfigInit().m_SpinxDudeBlink = FALSE;
|
||||
}
|
||||
|
||||
kdDebug() << "SpinxDudeBlink State is:"
|
||||
<< ConfigInit().m_SpinxDudeBlink
|
||||
<< endl;
|
||||
}
|
||||
*/
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxURLRequesterThemesPathUrlSelected ( const QString &path )
|
||||
{
|
||||
QString tmppath = path;
|
||||
|
||||
if ( tmppath.startsWith ( "file://" ) ) tmppath.remove ( "file://" );
|
||||
if ( !tmppath.endsWith ( "/" ) ) tmppath.append ( "/" );
|
||||
|
||||
QDir d ( tmppath );
|
||||
d.setFilter ( QDir::Dirs );
|
||||
if ( !d.exists() )
|
||||
{
|
||||
kdDebug() << "Themes folder does not exist: " << tmppath << endl;
|
||||
|
||||
KMessageBox::error ( 0,
|
||||
tr2i18n ( "<p align='center'>Invalid user themes folder!</p>"
|
||||
"<p align='center'>Will use default user themes folder.</p>" ),
|
||||
tr2i18n ( "Error loading themes" ) );
|
||||
|
||||
tmppath = ConfigInit().m_UserSpinxThemeBasePathDefault;
|
||||
}
|
||||
|
||||
KbfxURLRequesterThemesPath->setURL ( tmppath );
|
||||
|
||||
KbfxThemeList->clear();
|
||||
KbfxThemeList->insertStringList ( KbfxThemesData().setThemeList ( tmppath ).keys() );
|
||||
KbfxThemeList->setCurrentItem ( 0 );
|
||||
|
||||
ConfigInit().m_SpinxThemeName = KbfxThemeList->currentText();
|
||||
ConfigInit().m_SpinxThemeBasePath = KbfxThemesData().setThemeList ( ConfigInit().m_UserSpinxThemeBasePath ) [ConfigInit().m_SpinxThemeName];
|
||||
ConfigInit().m_UserSpinxThemeBasePath = tmppath;
|
||||
|
||||
setKbfxThemePreview();
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxThemeSelected ( const QString &name )
|
||||
{
|
||||
if (KbfxFormReady)
|
||||
{
|
||||
ConfigInit().m_SpinxThemeName = name;
|
||||
ConfigInit().m_SpinxThemeBasePath = KbfxThemesData().setThemeList ( ConfigInit().m_UserSpinxThemeBasePath ) [ConfigInit().m_SpinxThemeName];
|
||||
ConfigInit().readFontrc ( ConfigInit().m_SpinxThemeBasePath,
|
||||
ConfigInit().m_SpinxThemeName );
|
||||
ConfigInit().readThemerc ( ConfigInit().m_SpinxThemeBasePath,
|
||||
ConfigInit().m_SpinxThemeName );
|
||||
|
||||
kdDebug() << "Selected theme: "
|
||||
<< name
|
||||
<< endl
|
||||
<< "Base path: "
|
||||
<< ConfigInit().m_SpinxThemeBasePath
|
||||
<< endl;
|
||||
|
||||
setKbfxThemePreview();
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::setKbfxThemePreview()
|
||||
{
|
||||
QString path = ConfigInit().m_SpinxThemeBasePath + ConfigInit().m_SpinxThemeName + "/preview.png";
|
||||
|
||||
QImage tmp ( path );
|
||||
if ( tmp.isNull() )
|
||||
{
|
||||
kdDebug() << "No preview available for theme: "
|
||||
<< ConfigInit().m_SpinxThemeBasePath + ConfigInit().m_SpinxThemeName
|
||||
<< endl;
|
||||
|
||||
// QString default_path = locate("data", "kbfx/images/nopreview.png");
|
||||
KbfxPixmapPreview->setPixmap ( img_nopreview );
|
||||
}
|
||||
else
|
||||
{
|
||||
KbfxPixmapPreview->setPixmap ( path );
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::ChangeForm()
|
||||
{
|
||||
KbfxFormReady = FALSE;
|
||||
KbfxURLRequesterThemesPath->setURL ( ConfigInit().m_UserSpinxThemeBasePath );
|
||||
KbfxThemeList->clear();
|
||||
|
||||
KbfxThemeList->insertStringList ( KbfxThemesData().setThemeList ( ConfigInit().m_UserSpinxThemeBasePath ).keys() );
|
||||
|
||||
kdDebug() << "Theme path: "
|
||||
<< KbfxThemesData().setThemeList ( ConfigInit().m_UserSpinxThemeBasePath ) [ConfigInit().m_SpinxThemeName]
|
||||
<< endl;
|
||||
|
||||
KbfxThemeList->setSelected ( KbfxThemeList->findItem ( ConfigInit().m_SpinxThemeName ), TRUE );
|
||||
|
||||
setKbfxThemePreview();
|
||||
|
||||
KbfxDudeImage->setPixmap ( ConfigInit().m_SpinxDudeImage );
|
||||
|
||||
kdDebug() << "Dude image: "
|
||||
<< ConfigInit().m_SpinxDudeImage
|
||||
<< endl
|
||||
<< "Default dude image: "
|
||||
<< ConfigInit().m_SpinxDudeImageDefault
|
||||
<< endl;
|
||||
|
||||
KbfxFormReady = TRUE;
|
||||
|
||||
KbfxShowOldThemes->setChecked ( ConfigInit().m_KbfxShowOldThemes );
|
||||
KbfxWatch->setChecked ( ConfigInit().m_KbfxWatcher );
|
||||
|
||||
/*
|
||||
if(ConfigInit().m_SpinxDudeBlink == TRUE && KbfxAnimationButton->state() == 0)
|
||||
KbfxAnimationButton->toggle();
|
||||
|
||||
if(ConfigInit().m_SpinxDudeBlink == FALSE && KbfxAnimationButton->state() == 2)
|
||||
KbfxAnimationButton->toggle();
|
||||
*/
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxDeleteThemeClicked()
|
||||
{
|
||||
int messageBoxReturn;
|
||||
int messageBoxUserResReturn;
|
||||
QString KbfxThemeRcDestination = KGlobal::dirs()->saveLocation ( "data", QString ( "kbfx/themerc/" ), TRUE );
|
||||
KbfxThemeRcDestination.append( ConfigInit().m_SpinxThemeName );
|
||||
|
||||
messageBoxReturn = KMessageBox::warningContinueCancel ( 0,
|
||||
tr2i18n ( "<p align='center'>Are you sure you want to uninstall the KBFX theme <strong>%1</strong>?</p>" ).arg ( ConfigInit().m_SpinxThemeName ),
|
||||
tr2i18n ( "Uninstall KBFX theme" ),
|
||||
tr2i18n ( "Uninstall" ) );
|
||||
|
||||
if ( messageBoxReturn == KMessageBox::Cancel ) return;
|
||||
|
||||
messageBoxUserResReturn = KMessageBox::questionYesNo ( 0,
|
||||
tr2i18n ( "<p align='center'>Do you want to keep your personal settings for theme <strong>%1</strong>?</p>" ).arg ( ConfigInit().m_SpinxThemeName ),
|
||||
tr2i18n ( "Personal settings" ),
|
||||
tr2i18n ( "Keep settings" ),
|
||||
tr2i18n ( "Delete settings" ) );
|
||||
|
||||
if ( messageBoxUserResReturn == KMessageBox::No )
|
||||
{
|
||||
if ( QFile::exists ( KbfxThemeRcDestination + "_fontrc" ) )
|
||||
{
|
||||
QFile::remove ( KbfxThemeRcDestination + "_fontrc" );
|
||||
|
||||
kdDebug() << "Deleting user's fontrc file: "
|
||||
<< KbfxThemeRcDestination + "_fontrc"
|
||||
<< endl;
|
||||
}
|
||||
if ( QFile::exists ( KbfxThemeRcDestination + "_layoutrc" ) )
|
||||
{
|
||||
QFile::remove ( KbfxThemeRcDestination + "_layoutrc" );
|
||||
kdDebug() << "Deleting user's layoutrc file: "
|
||||
<< KbfxThemeRcDestination + "_layoutrc"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
kdDebug() << "Deleting theme: "
|
||||
<< ConfigInit().m_SpinxThemeName
|
||||
<< " - "
|
||||
<< ConfigInit().m_SpinxThemeBasePath + ConfigInit().m_SpinxThemeName
|
||||
<< endl;
|
||||
|
||||
if ( !KIO::NetAccess::del ( ConfigInit().m_SpinxThemeBasePath+ConfigInit().m_SpinxThemeName, 0 ) )
|
||||
{
|
||||
KMessageBox::sorry ( 0,
|
||||
tr2i18n ( "<p align='center'>Could not uninstall this KBFX theme.</p>"
|
||||
"<p align='center'>You may not have sufficient permissions to delete "
|
||||
"the folder <strong>%1<strong>.</p>" ).arg ( ConfigInit().m_SpinxThemeBasePath + ConfigInit().m_SpinxThemeName ) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ChangeForm();
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxInstallThemeClicked()
|
||||
{
|
||||
KFileDialog KbfxInstallDialog ( QString::null,
|
||||
"*.tar *.tar.bz2 *.tar.gz *.kbfxtheme|" + tr2i18n ( "KBFX theme packages (*.tar, *.tar.bz2, *.tar.gz, *.kbfxtheme)" ),
|
||||
0,
|
||||
0,
|
||||
TRUE );
|
||||
KbfxInstallDialog.setCaption ( tr2i18n ( "Select KBFX theme package to install" ) );
|
||||
KbfxInstallDialog.setMode ( KFile::File | KFile::ExistingOnly );
|
||||
|
||||
if ( !KbfxInstallDialog.exec() ) return;
|
||||
|
||||
KbfxInstallDialogURL = KbfxInstallDialog.selectedURL().path();
|
||||
|
||||
emit KbfxThemeDoInstall ( KbfxInstallDialogURL );
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxThemeInstall ( QString &installUrl )
|
||||
{
|
||||
KTar KbfxThemeArchive ( installUrl );
|
||||
|
||||
if ( !KbfxThemeArchive.open ( IO_ReadOnly ) )
|
||||
{
|
||||
KMessageBox::sorry ( 0, tr2i18n ( "<p align='center'>Could not read this KBFX theme package.</p>" ) );
|
||||
|
||||
kdDebug() << "Error reading archive: " << installUrl << endl;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const QString KbfxThemeDestination = KGlobal::dirs()->saveLocation ( "data",
|
||||
QString ( "kbfx/skins/" ),
|
||||
TRUE );
|
||||
|
||||
kdDebug() << "Copying theme: " << KbfxThemeDestination << endl;
|
||||
|
||||
const KArchiveDirectory *KbfxThemeArchiveDir = KbfxThemeArchive.directory();
|
||||
KbfxThemeArchiveDir->copyTo ( KbfxThemeDestination, TRUE );
|
||||
|
||||
ChangeForm();
|
||||
}
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxSelectDudeImageClicked()
|
||||
{
|
||||
KFileDialog KbfxDudeImageDialog ( QString::null,
|
||||
"image/jpeg image/png image/x-xpm image/gif ",
|
||||
0,
|
||||
0,
|
||||
TRUE );
|
||||
|
||||
KbfxDudeImageDialog.setCaption ( tr2i18n ( "Select personal image" ) );
|
||||
KbfxDudeImageDialog.setMode ( KFile::File | KFile::ExistingOnly );
|
||||
|
||||
if ( !KbfxDudeImageDialog.exec() ) return;
|
||||
|
||||
ConfigInit().m_SpinxDudeImage = KbfxDudeImageDialog.selectedURL().path();
|
||||
|
||||
QImage tmp ( ConfigInit().m_SpinxDudeImage );
|
||||
if ( tmp.isNull() )
|
||||
{
|
||||
KMessageBox::error ( 0,
|
||||
tr2i18n ( "<p align='center'>Image cannot be used as a personal image!</p>"
|
||||
"<p align='center'>Will use default personal image.</p>" ),
|
||||
tr2i18n ( "Error loading image" ) );
|
||||
|
||||
ConfigInit().m_SpinxDudeImage=ConfigInit().m_SpinxDudeImageDefault;
|
||||
}
|
||||
|
||||
KbfxDudeImage->setPixmap ( ConfigInit().m_SpinxDudeImage );
|
||||
|
||||
kdDebug() << "Dude image changed: "
|
||||
<< ConfigInit().m_SpinxDudeImage
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxDeleteDudeImageClicked()
|
||||
{
|
||||
QString tmp_dude = ConfigInit().m_SpinxThemeBasePath + ConfigInit().m_SpinxThemeName + "/menu_top_image_person.png";
|
||||
QFile tmp ( tmp_dude );
|
||||
if ( tmp.exists() )
|
||||
{
|
||||
ConfigInit().m_SpinxDudeImage = tmp_dude;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigInit().m_SpinxDudeImage = locate ( "data","kbfx/skins/default/menu_top_image_person.png" );
|
||||
}
|
||||
|
||||
KbfxDudeImage->setPixmap ( ConfigInit().m_SpinxDudeImage );
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxThemeInfoClicked()
|
||||
{
|
||||
QPixmap _logo = QPixmap (ConfigInit ().m_SpinxThemeBasePath + ConfigInit ().m_SpinxThemeName + "/logo.png");
|
||||
|
||||
ConfigInit().readThemeInfo ( ConfigInit().m_SpinxThemeBasePath, ConfigInit().m_SpinxThemeName );
|
||||
_info_box = new KbfxThemeInfo (this,"infodlg",Qt::WType_Modal);
|
||||
|
||||
if ( !_logo.isNull() )
|
||||
{
|
||||
_info_box->KbfxThemeLogo->setPixmap( _logo );
|
||||
}
|
||||
else
|
||||
{
|
||||
_info_box->KbfxThemeLogo->hide();
|
||||
_info_box->hideSpacer();
|
||||
}
|
||||
_info_box->KbfxThemeName->setText( ConfigInit().m_SpinxThemeName );
|
||||
_info_box->KbfxThemeVersion->setText( ConfigInit().m_InfoVersion );
|
||||
_info_box->KbfxAuthorName->setText( ConfigInit().m_InfoAuthor );
|
||||
if ( ConfigInit().m_InfoEmail == ConfigInit().m_InfoEmailDefault )
|
||||
{
|
||||
_info_box->KbfxAuthorEmail->setText( ConfigInit().m_InfoEmail );
|
||||
}
|
||||
else
|
||||
{
|
||||
_info_box->KbfxAuthorEmail->setText( "<a href='mailto:" + ConfigInit().m_InfoEmail + "'>" + ConfigInit().m_InfoEmail + "</a>" );
|
||||
}
|
||||
if ( ConfigInit().m_InfoUrl == ConfigInit().m_InfoUrlDefault )
|
||||
{
|
||||
_info_box->KbfxThemeHomepage->setText( ConfigInit().m_InfoUrl );
|
||||
}
|
||||
else
|
||||
{
|
||||
_info_box->KbfxThemeHomepage->setText( "<a href='" + ConfigInit().m_InfoUrl + "'>" + ConfigInit().m_InfoUrl + "</a>" );
|
||||
}
|
||||
|
||||
_info_box->show();
|
||||
_info_box->update();
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxShowOldThemes_toggled( bool state )
|
||||
{
|
||||
ConfigInit().m_KbfxShowOldThemes = state;
|
||||
kdDebug() << "Show Old Themes is: " << ConfigInit().m_KbfxShowOldThemes << endl;
|
||||
|
||||
ChangeForm();
|
||||
}
|
||||
|
||||
|
||||
void KbfxConfigDlgThemes::KbfxWatch_toggled( bool state )
|
||||
{
|
||||
ConfigInit().m_KbfxWatcher = state;
|
||||
kdDebug() << "Watch for Installs is: " << ConfigInit().m_KbfxWatcher << endl;
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
void KbfxConfigDlgTooltip::init()
|
||||
{
|
||||
img_on = ConfigInit().KbfxOnImg;
|
||||
img_off = ConfigInit().KbfxOffImg;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgTooltip::KbfxTooltipAnimationButtonToggled ( bool )
|
||||
{
|
||||
if ( KbfxTooltipAnimationButton->state() == 2 )
|
||||
{
|
||||
KbfxTooltipAnimationButton->setText ( tr2i18n ( "Turn the animation 'OFF'" ) );
|
||||
KbfxTooltipAnimationPixmapLabel->setPixmap ( img_on );
|
||||
ConfigInit().m_ToolTipAnimation = TRUE;
|
||||
}
|
||||
|
||||
if ( KbfxTooltipAnimationButton->state() == 0 )
|
||||
{
|
||||
KbfxTooltipAnimationButton->setText ( tr2i18n ( "Turn the animation 'ON'" ) );
|
||||
KbfxTooltipAnimationPixmapLabel->setPixmap ( img_off );
|
||||
ConfigInit().m_ToolTipAnimation = FALSE;
|
||||
}
|
||||
|
||||
kdDebug() << "Tooltip animation state: "
|
||||
<< ConfigInit().m_ToolTipAnimation
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgTooltip::KbfxTooltipTextEditTextChanged()
|
||||
{
|
||||
ConfigInit().m_ToolTipText = KbfxTooltipTextEdit->text();
|
||||
|
||||
kdDebug() << "Tooltip text: "
|
||||
<< ConfigInit().m_ToolTipText
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgTooltip::KbfxTooltipOnButtonToggled ( bool )
|
||||
{
|
||||
if ( KbfxTooltipOnButton->state() == 2 )
|
||||
{
|
||||
KbfxTooltipOnButton->setText ( tr2i18n ( "Turn the tooltip 'OFF'" ) );
|
||||
KbfxTooltipOnPixmapLabel->setPixmap ( img_on );
|
||||
ConfigInit().m_ToolTip = TRUE;
|
||||
}
|
||||
|
||||
if ( KbfxTooltipOnButton->state() == 0 )
|
||||
{
|
||||
KbfxTooltipOnButton->setText ( tr2i18n ( "Turn the tooltip 'ON'" ) );
|
||||
KbfxTooltipOnPixmapLabel->setPixmap ( img_off );
|
||||
ConfigInit().m_ToolTip = FALSE;
|
||||
|
||||
}
|
||||
|
||||
kdDebug() << "Tooltip state: "
|
||||
<< ConfigInit().m_ToolTip
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxConfigDlgTooltip::ChangeForm()
|
||||
{
|
||||
if ( ConfigInit().m_ToolTip == TRUE && KbfxTooltipOnButton->state() == 0 )
|
||||
KbfxTooltipOnButton->toggle();
|
||||
|
||||
if ( ConfigInit().m_ToolTip == FALSE && KbfxTooltipOnButton->state() == 2 )
|
||||
KbfxTooltipOnButton->toggle();
|
||||
|
||||
if ( ConfigInit().m_ToolTipAnimation == TRUE && KbfxTooltipAnimationButton->state() == 0 )
|
||||
KbfxTooltipAnimationButton->toggle();
|
||||
|
||||
if ( ConfigInit().m_ToolTipAnimation == FALSE && KbfxTooltipAnimationButton->state() == 2 )
|
||||
KbfxTooltipAnimationButton->toggle();
|
||||
|
||||
KbfxTooltipTextEdit->setText ( ConfigInit().m_ToolTipText );
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by the form's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
void KbfxThemeInfo::init()
|
||||
{
|
||||
}
|
||||
|
||||
void KbfxThemeInfo::hideSpacer()
|
||||
{
|
||||
KbfxSpacer->changeSize(0,0);
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kapplication.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kuniqueapplication.h>
|
||||
|
||||
#include "kbfxconfigapp.h"
|
||||
|
||||
static const char description[] = I18N_NOOP ( "KBFX Configuration Utility" );
|
||||
static const char version[] = APPLICATION_VERSION;
|
||||
static const KCmdLineOptions options[] =
|
||||
{
|
||||
{"install <theme URL>", I18N_NOOP ( "Install KBFX theme from <URL>" ), 0},
|
||||
{ "prepare <folder URL>", I18N_NOOP ( "Prepare KBFX theme from folder <URL>" ), 0 },
|
||||
{ "about", I18N_NOOP ( "Show the About page" ), 0 },
|
||||
KCmdLineLastOption
|
||||
};
|
||||
|
||||
static KbfxConfigApp *mainWin = 0;
|
||||
|
||||
class KbfxConfigApplication : public KUniqueApplication
|
||||
{
|
||||
public:
|
||||
KbfxConfigApplication() { }
|
||||
virtual ~KbfxConfigApplication() { }
|
||||
|
||||
virtual int newInstance()
|
||||
{
|
||||
KCmdLineArgs* KbfxArgs = KCmdLineArgs::parsedArgs();
|
||||
|
||||
/* prepare kbfx theme cmdline option given */
|
||||
if ( KbfxArgs->isSet ( "prepare" ) )
|
||||
{
|
||||
QString m_KbfxThemeFolderUrl = KbfxArgs->getOption ( "prepare" );
|
||||
if ( m_KbfxThemeFolderUrl.endsWith ( "/" ) ) m_KbfxThemeFolderUrl.truncate ( m_KbfxThemeFolderUrl.length()-1 );
|
||||
QString theme_name = m_KbfxThemeFolderUrl.section ( '/', -1 );
|
||||
QString archive_dir = m_KbfxThemeFolderUrl.section ( '/', 0, -2 );
|
||||
QString archive_name = archive_dir+"/"+ theme_name+".kbfxtheme";
|
||||
kdDebug() << "Prepare option arguments: "
|
||||
<< theme_name
|
||||
<< endl
|
||||
<< archive_dir
|
||||
<< endl
|
||||
<< archive_name
|
||||
<< endl;
|
||||
|
||||
KTar ThemeArchive ( archive_name,"application/x-bzip" );
|
||||
|
||||
if ( !ThemeArchive.open ( IO_WriteOnly ) )
|
||||
{
|
||||
KMessageBox::sorry ( 0,
|
||||
tr2i18n ( "<p align='center'>Could not create this KBFX theme package.</p>" ) );
|
||||
|
||||
kdDebug() << "Error creating theme file: "
|
||||
<< archive_name
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeArchive.addLocalDirectory ( m_KbfxThemeFolderUrl,theme_name );
|
||||
ThemeArchive.close ();
|
||||
KMessageBox::information ( 0,
|
||||
tr2i18n ( "<p align='center'>KBFX Theme <strong>%1</strong> prepared.</p>" ).arg ( theme_name ),
|
||||
tr2i18n ( "KBFX Theme Ready" ) );
|
||||
kdDebug() << "KBFX theme file ready: "
|
||||
<< archive_name
|
||||
<< endl;
|
||||
}
|
||||
|
||||
kdDebug() << "KBFX theme prepared. Quitting..." << endl;
|
||||
QTimer::singleShot ( 100, mainWin, SLOT ( deleteLater() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* install kbfx theme cmdline option given */
|
||||
if ( KbfxArgs->isSet ( "install" ) )
|
||||
{
|
||||
QString m_KbfxThemeUrl = KbfxArgs->getOption ( "install" );
|
||||
kdDebug() << "Install option argument: "
|
||||
<< m_KbfxThemeUrl
|
||||
<< endl;
|
||||
|
||||
mainWin->lb_Main->setCurrentItem ( THEMES );
|
||||
mainWin->KbfxMenuItemChanged ( THEMES );
|
||||
mainWin->KbfxThemeInstall ( m_KbfxThemeUrl );
|
||||
}
|
||||
|
||||
/* show the "About" page */
|
||||
if ( KbfxArgs->isSet ( "about" ) )
|
||||
{
|
||||
kdDebug() << "About option argument given on command line."
|
||||
<< endl;
|
||||
|
||||
mainWin->lb_Main->setCurrentItem ( ABOUT );
|
||||
mainWin->KbfxMenuItemChanged ( ABOUT );
|
||||
}
|
||||
|
||||
mainWin->show();
|
||||
mainWin->browserInit();
|
||||
}
|
||||
return KUniqueApplication::newInstance();
|
||||
}
|
||||
};
|
||||
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
KAboutData about ( "kbfxconfigapp",
|
||||
I18N_NOOP ( "kbfxconfigapp" ),
|
||||
version,
|
||||
description,
|
||||
KAboutData::License_GPL,
|
||||
"(C) 2006 PhobosK",
|
||||
0,
|
||||
0,
|
||||
"phobosk@mail.kbfx.org" );
|
||||
about.addAuthor ( "PhobosK", 0, "phobosk@mail.kbfx.org" );
|
||||
|
||||
KCmdLineArgs::init( argc, argv, &about );
|
||||
KUniqueApplication::addCmdLineOptions();
|
||||
KCmdLineArgs::addCmdLineOptions( options );
|
||||
|
||||
if (!KUniqueApplication::start())
|
||||
return 1;
|
||||
|
||||
KbfxConfigApplication app;
|
||||
|
||||
mainWin = new KbfxConfigApp();
|
||||
/*
|
||||
Don't show initially untill found out if prepare option is given on the command line
|
||||
mainWin->show();
|
||||
*/
|
||||
app.setMainWidget ( mainWin );
|
||||
|
||||
/* mainWin has WDestructiveClose flag by default, so it will delete itself */
|
||||
return app.exec();
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=MimeType
|
||||
MimeType=application/x-kbfxtheme
|
||||
Icon=kbfxconfigapp
|
||||
Patterns=*.kbfxtheme
|
||||
|
||||
Comment=KBFX Theme Package
|
||||
Comment[bg]=Пакет KBFX Theme
|
||||
Comment[da]=KBFX-temapakke
|
||||
Comment[de]=KBFX Theme-Paket
|
||||
Comment[el]=Πακέτο θέματος KBFX
|
||||
Comment[es]=Paquete con el tema KBFX
|
||||
Comment[et]=KBFX teemapakett
|
||||
Comment[fr]=Paquet des thèmes KBFX
|
||||
Comment[ja]=KBFX テーマパッケージ
|
||||
Comment[nl]=KBFX-themapakket
|
||||
Comment[pt]=Pacote de Tema do KBFX
|
||||
Comment[pt_BR]=Pacote do Tema KBFX
|
||||
Comment[sv]=KBFX-temapaket
|
@ -0,0 +1,26 @@
|
||||
KBFX Team Managers
|
||||
------------------
|
||||
Siraj Razick: <siraj@kdemail.net>
|
||||
Mensur Zahirovic: <nookie@mail.kbfx.org>
|
||||
PhobosK: <phobosk@kdemail.net>
|
||||
Nathanael Gogniat: <nathanael@mail.kbfx.org>
|
||||
|
||||
|
||||
Translations
|
||||
------------
|
||||
Hungary (HU) Ferenc Stelcz <ferenc@stelcz.hu>
|
||||
Italia (IT) Divilinux <divilinux@mail.kbfx.org>
|
||||
Bulgaria (BG) Lexus <lexus@mail.kbfx.org>
|
||||
PhobosK <phobosk@kdemail.net>
|
||||
Netherlands (NL) Monkey 9 <monkey9@iae.nl>
|
||||
|
||||
|
||||
Ideas and Guidence
|
||||
------------------
|
||||
Aaron Seigo: <aseigo@kde.org>
|
||||
Vandenoever:
|
||||
|
||||
|
||||
Patches
|
||||
-------
|
||||
Darwin M. Bautista <djclue917@gmail.com> 001.patch
|
@ -0,0 +1,17 @@
|
||||
SET(DOCFILES
|
||||
AUTHORS
|
||||
# ChangeLog
|
||||
# COPYING
|
||||
CREDITS
|
||||
HACKING
|
||||
# HOWTO
|
||||
# INSTALL
|
||||
# KNOWN_BUGS
|
||||
# LICENSE
|
||||
# NEWS
|
||||
# README
|
||||
# TODO
|
||||
)
|
||||
|
||||
INSTALL(FILES ${DOCFILES}
|
||||
DESTINATION ${SHARE_INSTALL_PREFIX}/doc/kbfx)
|
@ -0,0 +1,11 @@
|
||||
Credits and Thanks go to:
|
||||
=========================
|
||||
|
||||
Revaline C. Regendra: For the Launch button in the default "KBFX Silk TTP" theme (version 0.4.9.3-20070117).
|
||||
--------------------- Copyright (c) 2006. Revaline^Studio; Revaline's Launch Menu v4.0
|
||||
http://www.kde-look.org/content/show.php?content=36399
|
||||
regendra_mail7@yahoo.com
|
||||
|
||||
Petri Damstén: For the KMFFontChooser class.
|
||||
-------------- http://www.iki.fi/damu/software/kmediafactory/
|
||||
damu@iki.fi
|
@ -0,0 +1,123 @@
|
||||
0.4.9.3.1
|
||||
=========
|
||||
- CHANGED layout and font configfile specs
|
||||
- UPDATED help documentation
|
||||
- ADDED fade transition effect on the KBFX Button
|
||||
- ADDED install guides for using checkinstall
|
||||
- ADDED Hungarian translation (thanks to Ferenc Stelcz for it)
|
||||
- ADDED option to watch for KDE global changes like new installed applications
|
||||
- ADDED option for Theme Info
|
||||
- ADDED resizable configuration dialogs
|
||||
- ADDED drag&drop hover, pressed and normal images over the KBFX button
|
||||
- ADDED tooltip support for the KBFX button
|
||||
- ADDED switch between KBFX and K Menu
|
||||
- ADDED new two panel skin - "2panels"
|
||||
- ADDED configurable middle background - middleboxbg.png
|
||||
- ADDED fonts support in every part of the menu
|
||||
- ADDED layout support in the KBFX Configurator
|
||||
- ADDED support for the new versions of strigi
|
||||
- ADDED support for use of strigi in Gentoo
|
||||
- ADDED support for SVN version in Gentoo
|
||||
- ADDED support for PCLinuxOS rpm build (thanks to @PaGal and @tom777 for the testing)
|
||||
- ADDED support for future KDE4 (part 1)
|
||||
- ADDED uninstall option for "build.sh" script
|
||||
- FIXED cmake uninstall
|
||||
- FIXED RPM .la issues
|
||||
- FIXED some major bugs
|
||||
- REMOVED Water effect (too much CPU time consuming and not a favorite one for our users)
|
||||
|
||||
0.4.9.3-20070117
|
||||
================
|
||||
- Initial Release of the 0.4.9.3 Series - KBFX Silk (0.4.9.3)
|
||||
- New Build system (cmake)
|
||||
- Re-write of the data backend
|
||||
- Re-write of the GUI
|
||||
- Totally new theme
|
||||
- Improved configuration dialog
|
||||
|
||||
0.4.9.2rc4
|
||||
==========
|
||||
- CHANGED some aspects of autoconf/automake behavior
|
||||
- CHANGED "Toolbar Resize" behavior - turned off by default so kicker doesn't change its size anymore
|
||||
- ADDED support for Mandriva 2007 compilation (no menudrake there by default)
|
||||
- FIXED Search bar behavior (thanks @gropiuskalle)
|
||||
- FIXED some minor bugs
|
||||
|
||||
0.4.9.2rc3
|
||||
==========
|
||||
- ADDED support for preparing .kbfxtheme files in Konqueror (look the explanation in HOWTO file)
|
||||
- ADDED "--prepare" command line option to pack existing KBFX Skin Folders to .kbfxtheme files
|
||||
- ADDED "Default Theme's Personal Image" to the "KBFX Configurator Application"
|
||||
- ADDED "Toolbar Resize" option to the "KBFX Configurator Application" for the toolbar where the KBFX Button resides
|
||||
- ADDED it, bg and nl translations
|
||||
- FIXED some minor bugs
|
||||
|
||||
0.4.9.2rc2
|
||||
==========
|
||||
- CHANGED "KBFX Configurator Application" - rewritten from scratch and is no more part of "kcontrol"
|
||||
- CHANGED "Tooltip Animation" behavior - turned off by default
|
||||
- ADDED new Default Theme
|
||||
- ADDED fonts configuration option to the "KBFX Configurator Application"
|
||||
- ADDED Install/Delete Themes to the "KBFX Configurator Application"
|
||||
- ADDED support for .kbfxtheme files in Konqueror (look the explanation in HOWTO file)
|
||||
- ADDED possibility to change "dude" image to the "KBFX Configurator Application"
|
||||
- ADDED Free-BSD Support
|
||||
- FIXED font alignment problems
|
||||
- FIXED long applications name problem
|
||||
- FIXED some memory leaks
|
||||
- FIXED some minor bugs
|
||||
|
||||
0.4.9.2-20060708cvs
|
||||
===================
|
||||
- UPDATED make system
|
||||
|
||||
0.4.9.2-20060611cvs
|
||||
===================
|
||||
- ADDED PC-BSD Support
|
||||
- ADDED Drag and Drop Support
|
||||
- FIXED a bug with showing icons in "Recently Used" items
|
||||
- FIXED a bug with the placement of ".face.icon" (thanks @Nucc)
|
||||
- Flicker Free KBFX Button
|
||||
- Flicker Free KBFX SPINX Menu TOP
|
||||
- Better scrolling
|
||||
|
||||
0.4.9.2-20060528cvs
|
||||
===================
|
||||
- ADDED support for Fedora rpm
|
||||
- ADDED an option to disable tooltips (see HOWTO file)
|
||||
- FIXED a problem with building SUSE rpm
|
||||
|
||||
0.4.9.2rc1
|
||||
==========
|
||||
- ADDED support for Buttons with Drop shadows
|
||||
- ADDED Font settings as part of the Theme itself
|
||||
- ADDED Kiosk mode support
|
||||
- ADDED Handling of submenus
|
||||
- FIXED make system for all distributions
|
||||
- Better support for Mandriva distribution
|
||||
- More applications for the menu
|
||||
- Grouping header for each application group and sub groups
|
||||
|
||||
0.4.9.1
|
||||
=======
|
||||
- New HTML based Config
|
||||
- Spinx Bar improved and redone for MAX icandy with better theme support
|
||||
- Double buffered rendering for kbfx button
|
||||
- image support
|
||||
- Animated scrollbars like thing
|
||||
- icons zoom
|
||||
- Improved skin support
|
||||
- themeable tooltip ( two types animated and none animated)
|
||||
- KDE user icon support (KDM icons)
|
||||
- user Name support (login name)
|
||||
- Application Items are sorted
|
||||
- Better user support and Help
|
||||
- login and lock buttons are working now
|
||||
- Mouse Cursor has more sense
|
||||
- KControl Module uses HTML ..old config removed
|
||||
- Automatic icons and theme installation with source code
|
||||
- The applet is renamed , from kbfxvista to kbfxspinx
|
||||
- Animated User Image
|
||||
- Add more to Menu Action for Application List Better Customizations.
|
||||
- 32x32 icons support
|
||||
|
@ -0,0 +1,21 @@
|
||||
========================
|
||||
| Some syntax rules: |
|
||||
========================
|
||||
|
||||
Variables:
|
||||
----------
|
||||
|
||||
{prefix}_{variablename}
|
||||
|
||||
Prefixes Use
|
||||
"m_" for member variables
|
||||
"p_" for pointer variables
|
||||
"a_" for variables of argument functions
|
||||
|
||||
|
||||
Comments:
|
||||
---------
|
||||
|
||||
Please make small comments on important issues.
|
||||
And TODOs also.
|
||||
|
@ -0,0 +1,411 @@
|
||||
How to apply the Menu button
|
||||
============================
|
||||
|
||||
The menu button is starting point for the menu.
|
||||
It first has to be added to the panel.
|
||||
To add the KBFX Menu to the panel, proceed as following:
|
||||
Right-click on the panel, on which you want to place the KBFX button
|
||||
Select "Add Applet to panel" in the context menu
|
||||
Select "KBFX Spinx"
|
||||
A tooltip appears "KBFX Spinx Added"
|
||||
If you move your mouse over the button, a tooltip appears (turned off
|
||||
in the default configuration).
|
||||
If you want to, you can now remove the K-Menu button and move the KBFX
|
||||
to the desired place on the panel.
|
||||
To open the menu, just click on the button.
|
||||
|
||||
|
||||
|
||||
How to create themes for KBFX 0.4.9.3
|
||||
=====================================
|
||||
|
||||
So you want to create your own themes for KBFX 0.4.9.3?
|
||||
The guide is done in a simple manner and we hope that you will easily and
|
||||
simply create themes for KBFX 0.4.9.3. If you don't like something in this
|
||||
guide, please feel free to contact us at IRC on irc.freenode.org
|
||||
on channel #kbfx
|
||||
|
||||
NOTE: - The values for Width and Height are only our suggested values.
|
||||
You can use whatever values you feel are appropriate for your theme.
|
||||
- If ANY of these images are missing KBFX will use the image with the
|
||||
same name from the "default" theme.
|
||||
- In order to be used by the Configurator and by KBFX, every theme for
|
||||
0.4.9.3 MUST HAVE a file in it's folder named "version-2" !
|
||||
|
||||
topbg.png
|
||||
---------
|
||||
This is an image that is at the top of the menu.
|
||||
Width = 504px
|
||||
Height = 95px
|
||||
|
||||
dudebox.png
|
||||
-----------
|
||||
This is the background image where your personal image is displayed.
|
||||
Width = 95px
|
||||
Height = 88px
|
||||
|
||||
menu_top_image_person.png
|
||||
-------------------------
|
||||
This image is used for theme's default personal image.
|
||||
Width = 48 px
|
||||
Height = 48 px
|
||||
|
||||
find.png
|
||||
--------
|
||||
This is a small image displayed in the search field.
|
||||
Width = 22px
|
||||
Height = 21px
|
||||
|
||||
rhstile.png
|
||||
-----------
|
||||
This is normal image displayed in categories.
|
||||
Width = 132px
|
||||
Height = 23px
|
||||
|
||||
rhshovertile.png
|
||||
----------------
|
||||
This is a hover image for categories.Used as hover image for rhstile.png
|
||||
Width = 132px
|
||||
Height = 23px
|
||||
|
||||
scrollnormal.png / scrollnormalbot.png
|
||||
--------------------------------------
|
||||
These images are used as top and bottom scrollbars.
|
||||
Width = 240px
|
||||
Height = 10px
|
||||
|
||||
separator.png / indexseparator.png
|
||||
----------------------------------
|
||||
These are the separator images which separate your different subcategories.
|
||||
Width = 240px
|
||||
Height = 27px
|
||||
|
||||
tilenormal.png
|
||||
--------------
|
||||
This is the normal image where your applications are showed.
|
||||
Width = 240px
|
||||
Height = 46px
|
||||
|
||||
tilehover.png
|
||||
-------------
|
||||
This is the hover image where your applications are showed.
|
||||
Width = 240px
|
||||
Height = 46px
|
||||
|
||||
listboxbg.png
|
||||
-------------
|
||||
This is the background under the categories. It can be viewed on description
|
||||
on both sides of the menu.
|
||||
Width = 108px
|
||||
Height = 23px
|
||||
|
||||
middleboxbg.png
|
||||
---------------
|
||||
This is the background of the middle part of the menu.
|
||||
Width = 200px
|
||||
Height = 270px
|
||||
|
||||
botbg.png
|
||||
---------
|
||||
This is the background image at the bottom of the menu.
|
||||
Width = 504px
|
||||
Height = 38px
|
||||
|
||||
lock.png
|
||||
--------
|
||||
This is the lock image.
|
||||
Width = 84px
|
||||
Height = 38px
|
||||
|
||||
lockhover.png
|
||||
-------------
|
||||
This is the lock hover image.
|
||||
Width = 84px
|
||||
Height = 38px
|
||||
|
||||
logout.png
|
||||
----------
|
||||
This is the logout image.
|
||||
Width = 84px
|
||||
Height = 38px
|
||||
|
||||
|
||||
logouthover.png
|
||||
---------------
|
||||
This is the logout hover image.
|
||||
Width = 84px
|
||||
Height = 38px
|
||||
|
||||
mask.png
|
||||
--------
|
||||
This is deciding what size your menu will have when users install it
|
||||
and which will be the transparent parts of the menu (through the alpha
|
||||
mask of the png image). Of course the size can be controlled later by
|
||||
the configuration of KBFX.
|
||||
Width = 504px
|
||||
Height = 513px
|
||||
|
||||
logo.png
|
||||
---------
|
||||
logo.png is used as a theme's or author's logo shown in the Information box of
|
||||
the KBFX Configurator. You can put whatever image you want and it will be scaled
|
||||
to 100px width by 100px height.
|
||||
Width = up to 100 px
|
||||
Height = up to 100 px
|
||||
|
||||
preview.png
|
||||
-----------
|
||||
preview.png should be a snapshot of the working KBFX theme. It is used in the
|
||||
configuration application in order the user to see what the theme will look like.
|
||||
Width = 170 px
|
||||
Height = 205 px
|
||||
|
||||
normal.png / hover.png / pressed.png
|
||||
------------------------------------
|
||||
These are the KBFX Buttons for the kicker panel that are used in the theme.
|
||||
Width and Height - as you like, but preferably Height not to be too much.
|
||||
|
||||
|
||||
More information can be found on:
|
||||
http://www.kbfx.org/staticpages/index.php?page=howto0493
|
||||
|
||||
|
||||
|
||||
How to write theme's kbfxfontrc and kbfxlayoutrc files
|
||||
======================================================
|
||||
|
||||
Every theme MAY have two configuration files named:
|
||||
|
||||
kbfxfontrc - configures the fonts properties that the theme uses
|
||||
kbfxlayoutrc - configures the layout of the theme, the KBFX button
|
||||
and some other properties of the theme
|
||||
|
||||
If one or both of these files don't exist, KBFX internal configuration
|
||||
options will be used for fonts and layout.
|
||||
All the properties and values are separated between different Sections
|
||||
in the way showed below:
|
||||
|
||||
[Section]
|
||||
property = value
|
||||
|
||||
When you want to prepare a theme, have in mind that every change that you
|
||||
make in the "KBFX Configurator" is kept in files in your home KDE directory.
|
||||
Usually these files are here:
|
||||
~/.kde/share/apps/kbfx/themerc
|
||||
and are named:
|
||||
THEMENAME_layoutrc
|
||||
THEMENAME_fontrc
|
||||
So if you want to ship your theme settings from the "KBFX Configurator", the best
|
||||
thing to do is to use the buttons: "EXPORT KBFXFONTRC FILE" ("Fonts" section of the
|
||||
Configurator) and "EXPORT KBFXLAYOUTRC FILE" ("Layout section" of the Configurator)
|
||||
and put the exported files in your theme folder.
|
||||
|
||||
NOTE: - Pay close attention to the case of the properties and Sections names
|
||||
because the configuration is CASE SENSITIVE!
|
||||
- The order of the sections in the file is not important!
|
||||
- Have in mind that the Layout of the theme also depends on the sizes of
|
||||
the images!
|
||||
|
||||
|
||||
File kbfxfontrc
|
||||
---------------
|
||||
It's best the colors to be represented in RGB format.
|
||||
Font Properties should constrain to QFont class representation.
|
||||
The values bellow are the default ones:
|
||||
|
||||
[Fonts]
|
||||
TooltipText=0,0,0
|
||||
TooltipTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
ApplicationText=0,0,0
|
||||
ApplicationTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
CommentText=128,125,0
|
||||
CommentTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
GroupText=0,0,0
|
||||
GroupTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
UserName=255,255,255
|
||||
UserNameFont=Arial,10,-1,5,75,0,0,0,0,0
|
||||
SeparatorColor=0,0,0
|
||||
SeparatorFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
PluginColor=0,0,0
|
||||
PluginFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
LineColor=255,220,125
|
||||
# This is if the font when you hover on an item will be bold
|
||||
HoverBold = false
|
||||
|
||||
File kbfxlayoutrc
|
||||
-----------------
|
||||
The values bellow are the default ones:
|
||||
|
||||
[KbfxButton]
|
||||
# Time in msec for which the button
|
||||
# to fade in/out
|
||||
FadeTime=75
|
||||
# The three properties below describe the
|
||||
# paths to the theme's buttons.
|
||||
# KBFX uses the normal.png/hover.png/pressed.png
|
||||
# that are in the theme's folder by default.
|
||||
# So we recommend NOT to use the below three
|
||||
# properties!
|
||||
Normal = KBFX Normal Button Full Path
|
||||
Hover = KBFX Hover Button Full Path
|
||||
Press = KBFX Pressed Button Full Path
|
||||
|
||||
[TopBar]
|
||||
# Face Position X
|
||||
DudeX=-1
|
||||
# Face Position Y
|
||||
DudeY=-1
|
||||
# Face Box Height
|
||||
FaceH=64
|
||||
# Face Box Width
|
||||
FaceW=65
|
||||
# Face Box Position X
|
||||
FaceX=27
|
||||
# Face Box Position Y
|
||||
FaceY=8
|
||||
# User Name Position X
|
||||
UserNameX=130
|
||||
# User Name Position Y
|
||||
UserNameY=32
|
||||
# Hide User Name
|
||||
DisableUserName=false
|
||||
# Top Bar Height
|
||||
Height=95
|
||||
# THE PROPERTIES BELOW ARE NOT USED FOR NOW
|
||||
# Top Bar Width
|
||||
Width=504
|
||||
# Top Bar Position X
|
||||
X=0
|
||||
# Top Bar Position Y
|
||||
Y=0
|
||||
|
||||
[BottomBar]
|
||||
# Bottom Bar Height
|
||||
Height=38
|
||||
# THE PROPERTIES BELOW ARE NOT USED FOR NOW
|
||||
# Bottom Bar Width
|
||||
Width=504
|
||||
# Bottom Bar Position X
|
||||
X=0
|
||||
# Bottom Bar Position Y
|
||||
Y=428
|
||||
|
||||
[Scrollbars]
|
||||
# THIS SECTION IS NOT USED FOR NOW
|
||||
# Bottom Scroll Bar Position X
|
||||
ScrollBarBotX=108
|
||||
# Bottom Scroll Bar Position Y
|
||||
ScrollBarBotY=95
|
||||
# Top Scroll Bar Position X
|
||||
ScrollBarTopX=108
|
||||
# Top Scroll Bar Position Y
|
||||
ScrollBarTopY=95
|
||||
|
||||
[ListBox]
|
||||
# List Box Position X
|
||||
X=0
|
||||
# List Box Position Y
|
||||
Y=95
|
||||
# List Box Width
|
||||
Width=132
|
||||
# THE PROPERTIES BELOW ARE NOT USED FOR NOW
|
||||
# List Box Height
|
||||
Height=275
|
||||
|
||||
[SearchBox]
|
||||
# Search Box Height
|
||||
Height=22
|
||||
# Search Box Width
|
||||
Width=240
|
||||
# Search Box Position X
|
||||
X=130
|
||||
# Search Box Position Y
|
||||
Y=48
|
||||
|
||||
[ItemView]
|
||||
# Item Position X
|
||||
X=132
|
||||
# Item Position Y
|
||||
Y=95
|
||||
# Item Width
|
||||
Width=240
|
||||
# THE PROPERTIES BELOW ARE NOT USED FOR NOW
|
||||
# Item Height
|
||||
Height=275
|
||||
|
||||
[ItemProperties]
|
||||
# Comment Margin in Item
|
||||
CommentMargin=66
|
||||
# Icon Size in Item
|
||||
IconSize=32
|
||||
# No Comments in Item
|
||||
NoComments=false
|
||||
|
||||
[ToolBar]
|
||||
# THIS SECTION IS NOT USED FOR NOW
|
||||
# Tool Bar Button Normal Size
|
||||
ButtonNormalSize=48
|
||||
# Tool Bar Button Pressed Size
|
||||
ButtonPressedSize=48
|
||||
|
||||
[MainMenu]
|
||||
# Main Menu Height
|
||||
UserMenuHeight=513
|
||||
# Main Menu Width
|
||||
UserMenuWidth=504
|
||||
# Contracted Menues
|
||||
ContractedMenu=false
|
||||
|
||||
File version-2
|
||||
--------------
|
||||
|
||||
This file is obligatory to exist, though it can be empty.
|
||||
It is used to designate that the theme is in the new format and the
|
||||
properties that are in the file are used in the KBFX Configurator for
|
||||
showing the user some info about the theme.
|
||||
The values in this file cannot be overwritten by the KBFX Configurator.
|
||||
If existing, the file should contain information about the theme's version,
|
||||
author's name, author's email and a homepage for the theme.
|
||||
The unspecified fields are replaced with the string - "Not Specified".
|
||||
The values bellow are self explanatory and are just an example:
|
||||
|
||||
[ThemeGeneral]
|
||||
ThemeVersion=0.51
|
||||
AuthorName=Nookie
|
||||
AuthorEmail=nookie@no_spam.org
|
||||
Homepage=http://www.kbfx.org
|
||||
|
||||
|
||||
|
||||
How to create a ".kbfxtheme" file for 0.4.9.3
|
||||
=============================================
|
||||
|
||||
The ".kbfxtheme" file is a simple archive file (.tar.gz or .tar.bz2) that should
|
||||
contain at least these elements:
|
||||
- one or more theme folders with all the necessary images/files inside. Have in mind
|
||||
that the name of the theme is the name of the folder.
|
||||
- in the theme(s) folder(s) there should be an image named preview.png that serves
|
||||
as a live preview of the look of the theme.
|
||||
- in the theme(s) folder(s) there should be a file named version-2
|
||||
- the extension of the archive should be ".kbfxtheme"
|
||||
|
||||
You can create ".kbfxtheme" file following these instructions (there is
|
||||
an option in Konqueror's rightclick "Actions" menu for preparing KBFX Theme Package
|
||||
OR you can create the ".kbfxtheme" file manually as described bellow):
|
||||
- Create a folder with a name that is identical to the name you want for your theme.
|
||||
- Put the necessary images/files inside it (see the above instructions for the images part).
|
||||
- Create an archive of the folder (with ark/tar etc).
|
||||
- Rename the archive file to ".kbfxtheme" and you are ready.
|
||||
|
||||
|
||||
How to help us out
|
||||
==================
|
||||
|
||||
You can help us for the KBFX releases with the translation of the interface.
|
||||
For this purpose please download the kbfxconfigapp.pot file from SourceForge:
|
||||
http://sourceforge.net/project/showfiles.php?group_id=141258&package_id=210120 .
|
||||
Another way to get a .pot file is to use the command "make package-messages"
|
||||
just after the configuration of the compilation process is done.
|
||||
Then use KBabel (http://kbabel.kde.org/) or poEdit (http://www.poedit.org/) to make the translation.
|
||||
Next send the .po file to my mail - phobosk@mail.kbfx.org
|
||||
Thanks in advance for this help.
|
@ -0,0 +1,203 @@
|
||||
############################################
|
||||
# #
|
||||
# INSTALL file for KBFX > 0.4.9.2 #
|
||||
# #
|
||||
############################################
|
||||
Last update: 03/03/2007
|
||||
|
||||
Installation Notes by PhobosK
|
||||
|
||||
|
||||
|
||||
|
||||
1. Requirements :
|
||||
=================
|
||||
|
||||
- Cmake ( http://www.cmake.org ) - min. version 2.4.2
|
||||
- KDE3 and Qt3 sources - header files/devel packages
|
||||
- Strigi ( http://strigi.sf.net ) - header files/devel packages needed too
|
||||
(optional package)
|
||||
|
||||
|
||||
|
||||
2. Compilation Instructions :
|
||||
=============================
|
||||
|
||||
2.1. Unpack the sources of KBFX with (x.y.z-XXXXXXXX represents the version of
|
||||
the KBFX package, for example : 0.4.9.3-20070117):
|
||||
|
||||
> tar xjvf kbfx-x.y.z-XXXXXXXX.tar.bz2
|
||||
|
||||
2.2. Change into the new directory:
|
||||
|
||||
> cd kbfx-x.y.z-XXXXXXXX/
|
||||
|
||||
2.3. Start the configuration and the compilation using the command:
|
||||
|
||||
> ./build.sh
|
||||
|
||||
Note for Mandriva < 2007 users:
|
||||
===============================
|
||||
The build script (by default) enables the use of "menudrake"
|
||||
instead of "kmenuedit". If you want to prevent this behavior then
|
||||
pass ONE of these options to the build script:
|
||||
"--menudrake-off" OR "-m"
|
||||
|
||||
Notes for other building options:
|
||||
=================================
|
||||
"--prefix" OR "-p" to install KBFX in a different than the default folder
|
||||
(default is KDE install folder) for example:
|
||||
> ./build.sh -p /home/user
|
||||
"--strigi" OR "-s" to enable Strigi support in KBFX
|
||||
(default is no Strigi support)
|
||||
"--kde4" OR "-k" to build KBFX for KDE4
|
||||
(default is for KDE3)
|
||||
"--verbose" OR "-v" to make the build script give more verbose information
|
||||
"--nocheck" OR "-n" to make the build script not to check if an old KBFX
|
||||
version is installed (default is to check)
|
||||
|
||||
|
||||
|
||||
3. Using the "checkinstall" application for building KBFX packages :
|
||||
====================================================================
|
||||
|
||||
"checkinstall" DOES NOT work with cmake correctly up to this moment. :(
|
||||
It can be used with additional commands in order to "work properly".
|
||||
Here is the procedure to follow as user (NOT as ROOT) in order to obtain
|
||||
the necessary distribution package.
|
||||
NOTE: - x.y.z-XXXXXXXX represents the version of the KBFX package,
|
||||
in this example it is: 0.4.9.3-20070117
|
||||
- in the example here the version string is replaced only in the
|
||||
checkinstall comand but you have to do that everywhere the
|
||||
"x.y.z-XXXXXXXX" string is met
|
||||
|
||||
> cd /tmp
|
||||
> tar xjvf kbfx-x.y.z-XXXXXXXX.tar.bz2
|
||||
> cd kbfx-x.y.z-XXXXXXXX/
|
||||
> mkdir -p build/package
|
||||
> cd build
|
||||
> export DESTDIR=/tmp/kbfx-x.y.z-XXXXXXXX/build/package
|
||||
> cmake ../ -DCMAKE_INSTALL_PREFIX=`kde-config --prefix`
|
||||
> make install DESTDIR=/tmp/kbfx-x.y.z-XXXXXXXX/build/package
|
||||
> find package/|sed s#^package/#./# > installed_files.txt
|
||||
> cd package/
|
||||
> su
|
||||
> checkinstall -nodoc --pkgname="kbfx" --pkgversion="0.4.9.3" --pkgrelease="20070117" \
|
||||
--exclude="/" --include=../installed_files.txt --pakdir=/tmp/kbfx-0.4.9.3-20070117 sleep 1
|
||||
|
||||
When ready, "checkinstall" will show you the folder where the prepared package
|
||||
is, like in this Mandriva Example:
|
||||
|
||||
**********************************************************************
|
||||
|
||||
Done. The new package has been saved to
|
||||
|
||||
/tmp/kbfx-0.4.9.3-20070117/kbfx-0.4.9.3-20070117.i386.rpm
|
||||
You can install it in your system anytime using:
|
||||
|
||||
rpm -i kbfx-0.4.9.3-20070117.i386.rpm
|
||||
|
||||
**********************************************************************
|
||||
|
||||
Of course the best way to make RPM packages is to use the "kbfx.spec" file provided
|
||||
in the KBFX sources like described bellow.
|
||||
|
||||
|
||||
|
||||
4. RPM Building Instructions (Mandriva, Fedora, Suse) :
|
||||
=======================================================
|
||||
|
||||
If you prefer manipulate a RPM, you can build it with the following commands:
|
||||
|
||||
4.1. Build the RPM
|
||||
|
||||
> rpmbuild -tb kbfx-x.y.z-XXXXXXXX.tar.bz2
|
||||
|
||||
or (for Mandriva)
|
||||
|
||||
> rpmbuild --rebuild kbfx-x.y.z-XXXXXXXX-mdv20070.src.rpm
|
||||
|
||||
or (for Fedora)
|
||||
|
||||
> rpmbuild --rebuild kbfx-x.y.z-XXXXXXXX-FCx.src.rpm
|
||||
|
||||
or (for SuSe)
|
||||
|
||||
> rpmbuild --rebuild kbfx-x.y.z-XXXXXXXX-suseXXX.src.rpm
|
||||
|
||||
4.2. If succeed, you will found the rpm in /usr/src/rpm/RPMS (for Mandriva)
|
||||
or /usr/src/redhat/RPMS (for Fedora) or /usr/src/packages/RPMS (for Suse)
|
||||
according to the platform you have.
|
||||
|
||||
4.3. Install the rpm as usually by:
|
||||
> rpm -Uvh kbfx-x.y.z-XXXXXXXX.rpm
|
||||
|
||||
Notes for building RPM from KBFX SVN versions :
|
||||
===============================================
|
||||
- Follow these commands in the sources directory:
|
||||
> ./build.sh
|
||||
> Answer "N" to the question if you want to install KBFX
|
||||
> cd build
|
||||
> make dist
|
||||
- A file "kbfx-x.y.z-XXXXXXXX.tar.bz2" will be created in the build
|
||||
directory.
|
||||
- Proceed with the steps described in 4.1., 4.2., 4.3.
|
||||
|
||||
|
||||
|
||||
5. Gentoo users:
|
||||
================
|
||||
|
||||
In order to use the strigi engine in KBFX you have to do these steps:
|
||||
- Copy the "strigi-X.X.X.ebuild" and the "kbfx-0.4.9.X.ebuild" (from the sources
|
||||
directory) to your local portage tree as needed
|
||||
OR use the "kbfx-0.4.9.X-portage-overlay.tar.bz2"
|
||||
- Set the flag "strigi" for the kbfx ebuild
|
||||
- Emerge "clucene"
|
||||
- Emerge "kbfx"
|
||||
|
||||
There is a Layman overlay resource on the SourceForge SVN.
|
||||
You can add it by this command:
|
||||
> layman -f -o https://kbfx.svn.sourceforge.net/svnroot/kbfx/layman/kbfx-overlay.xml \
|
||||
-a kbfx
|
||||
After you add the "kbfx" overlay you can use it as usual.
|
||||
|
||||
|
||||
|
||||
6. Getting SVN version:
|
||||
=======================
|
||||
|
||||
To download the latest development source, you need to go to KDE SVN
|
||||
and download it from there. The current SVN address of the repository is:
|
||||
svn://anonsvn.kde.org/home/kde/trunk/playground/base/kbfx_plasma
|
||||
|
||||
Here are the instructions on how to get a copy of the SVN Repository:
|
||||
|
||||
6.1. Install your distribution's package named "subversion"
|
||||
OR download and install it from: http://subversion.tigris.org
|
||||
|
||||
6.2. Create a folder where you will compile/install KBFX and enter in it.
|
||||
For example do this:
|
||||
|
||||
> mkdir -p ~/usr/src/svn
|
||||
> cd ~/usr/src/svn
|
||||
|
||||
6.3. Checkout the SVN version of KBFX in this way and proceed as follows:
|
||||
|
||||
> svn co svn://anonsvn.kde.org/home/kde/trunk/playground/base/kbfx_plasma
|
||||
> cd kbfx_plasma
|
||||
|
||||
6.4. Proceed with the compilation/installation of KBFX as described in 2.3.
|
||||
|
||||
> ./build.sh
|
||||
|
||||
6.5. If you want always to have the latest version of KBFX you may leave
|
||||
the folder ~/usr/src/svn/kbfx_plasma intact for future use.
|
||||
When you want to update the source files of KBFX you just need to do
|
||||
"svn up" in this folder, delete the folder ~/usr/src/svn/kbfx_plasma/build
|
||||
and do the step described in 2.3. i.e:
|
||||
|
||||
> cd ~/usr/src/svn/kbfx_plasma
|
||||
> svn up
|
||||
> rm -fR build
|
||||
> ./build.sh
|
@ -0,0 +1 @@
|
||||
1. Global keybindings DOES NOT work
|
@ -0,0 +1,37 @@
|
||||
"KBFX Silk" (0.4.9.3.1)
|
||||
=======================
|
||||
|
||||
Hello everyone,
|
||||
|
||||
After a long silence from us now we are happy to announce that finally the
|
||||
stable release of KBFX is ready.
|
||||
We made a lot of changes to the KBFX Configurator and to KBFX Menu itself.
|
||||
However we were not able to implement everything you proposed and everything we
|
||||
wanted. So some of the features (see the TODO list in the source files)
|
||||
in "KBFX Silk" (0.4.9.3.1) are still not ready. We are sure that they will
|
||||
present in the next stable release which will be due just after KDE4 is
|
||||
released. The menu itself, however, is fully functional.
|
||||
|
||||
Thanks to all of you who gave us ideas and who tested the prerelease versions of
|
||||
KBFX.
|
||||
|
||||
All the best from your KBFX Team. :)
|
||||
|
||||
|
||||
Note: Things to be considered before installing "KBFX Silk"
|
||||
===========================================================
|
||||
|
||||
1.) To configure and compile "KBFX Silk" you need Cmake >= 2.4.2 from http://www.cmake.org
|
||||
|
||||
2.) To configure, compile and install "KBFX Silk" simply run ./build.sh
|
||||
|
||||
3.) Before the install of "KBFX Silk", please unload and uninstall any previous version of KBFX.
|
||||
|
||||
4.) After the install of "KBFX Silk" please relogin KDE.
|
||||
|
||||
5.) If you need file searching capabilities in KBFX, please download and install Strigi
|
||||
from http://strigi.sf.net
|
||||
|
||||
6.) To enable Strigi support in KBFX, please pass "--strigi" OR "-s" option to build.sh
|
||||
i.e: ./build.sh --strigi
|
||||
|
@ -0,0 +1,44 @@
|
||||
KBFX Preface:
|
||||
============
|
||||
KBFX is an alternative to the classical K-Menu button and it's menu.
|
||||
It improves the user experience by enabling the user to set a bigger (and
|
||||
thus more visible) start button and by finally replacing the Win95-like
|
||||
K-Menu with the Spinx bar.
|
||||
If you still want the old menu, because you're used to it, it is still
|
||||
available as an option in KBFX.
|
||||
|
||||
|
||||
Team/Credits
|
||||
============
|
||||
The KBFX team is small, but very active. The members are:
|
||||
Siraj Razick: Maintainer, initiator of KBFX, Developer, Project Admin
|
||||
Mensur Zahirovic (nookie): Web-development, Q&A, Graphics, Bug Hunter,
|
||||
Project Admin
|
||||
Nathanael Gogniat (dracor): Documentation
|
||||
PhobosK: Package & Release Manager, Quality Assurance, Bug Hunter,
|
||||
Mandriva Packages, Project Admin, Developer QT/C++
|
||||
Johnny Henry Sáenz Acuña (scarebyte): Developer QT4/C++, Debian Packages
|
||||
Fathi Boudra (fabo): Developper QT/C++, Debian Packages
|
||||
Pascal Jungblut (Jongking): Development support
|
||||
|
||||
Special thanks goes to:
|
||||
Akhmad Fathonih, Asif Ali Rizwaan, Dominik, Victor, Ron (bfman), Steady
|
||||
|
||||
We would also like to thank everyone who has contributed to KBFX by using
|
||||
it and sending feedback and bugs and everyone who has contributed button
|
||||
designs or ideas.
|
||||
|
||||
|
||||
Other Useful Info
|
||||
=================
|
||||
For Installation Instructions:
|
||||
see INSTALL
|
||||
For useful howtoes:
|
||||
see HOWTO
|
||||
For known bugs:
|
||||
see KNOWN_BUGS
|
||||
Project Homepage:
|
||||
http://www.kbfx.org
|
||||
Project Releases:
|
||||
http://sourceforge.net/project/showfiles.php?group_id=141258
|
||||
|
@ -0,0 +1,62 @@
|
||||
###############
|
||||
# #
|
||||
# TODO List #
|
||||
# #
|
||||
###############
|
||||
|
||||
|
||||
KEYS
|
||||
----
|
||||
* Completed
|
||||
+ Work In Progress
|
||||
- Still Dreaming About It
|
||||
? What On The Earth Is This
|
||||
! Top Important - To Be Done As Soon As Possible
|
||||
|
||||
|
||||
KBFX Cmake
|
||||
----------
|
||||
!+ # KDE4 Compatibility
|
||||
!- # Auto Strigi Sensitive
|
||||
|
||||
|
||||
KBFX Docs
|
||||
---------
|
||||
- # Document Plugin Interface
|
||||
|
||||
|
||||
KBFX App
|
||||
--------
|
||||
!- # Implement A Recently Used Menu
|
||||
!- # Rightclick On An App - Menu (Run, Edit, Properties etc.)
|
||||
!- # Implement A "Switch User" Button (Like Logout And Lock Buttons)
|
||||
!- # Customization Of The Logout And Lock Buttons Places
|
||||
!- # To Implement Another Way Of Reloading KBFX Not Through Kicker DCOP Reload
|
||||
!- # Rewrite the DCOP interface (in src/) to DBUS for KDE4 support. Should be done in a way to preserve KDE3 compatibility!
|
||||
!- # Side Slider For The Programs In The Middle Part Except The Arrow Up/Down (@janet Proposal)
|
||||
+ # Make The Canvas Autoadjust On Group Fold
|
||||
- # Add Config Interface For Each Plugin
|
||||
- # Clean Plugin Interface
|
||||
- # Write More Plugins
|
||||
- # Some Tool-Tips Would Be Really Nice To Have, Especially The Cancel And Logout Buttons (@athleston Proposal)
|
||||
- # Configurable Timeout When Clicking And Hovering Over A Group In The Menu (@ruffy Proposal)
|
||||
- # Beryl Compatibility (@ruffy Proposal And Testing - http://img406.imageshack.us/img406/1554/snapshot207ed.png )
|
||||
- # Submenu Handling - See http://img211.imageshack.us/img211/2026/kbfxsubmenusweirdod7.jpg (@janet Proposal)
|
||||
|
||||
|
||||
KBFX Config
|
||||
-----------
|
||||
|
||||
|
||||
KBFX Design
|
||||
-----------
|
||||
|
||||
|
||||
Remover
|
||||
-------
|
||||
|
||||
|
||||
Public Relations
|
||||
----------------
|
||||
+ # Talk To Heliocastro About Shifting To Extragears : emailTO helio@kde.org
|
||||
+ # Talk To SuSe People
|
@ -0,0 +1,5 @@
|
||||
FILE(GLOB JPGFILES *.jpg )
|
||||
FILE(GLOB PNGFILES *.png )
|
||||
|
||||
INSTALL(FILES ${JPGFILES} ${PNGFILES}
|
||||
DESTINATION ${HTML_INSTALL_DIR}/en/common)
|
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,2 @@
|
||||
KDE3_CREATE_HANDBOOK ( index.docbook )
|
||||
KDE3_INSTALL_HANDBOOK ( kbfxconfigapp )
|
@ -0,0 +1,5 @@
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_INSTALL_ICONS(hicolor)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_INSTALL_ICONS(hicolor)
|
||||
ENDIF (NOT USE_KDE4)
|
@ -0,0 +1,31 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header
|
||||
|
||||
inherit kde eutils
|
||||
need-kde 3.3
|
||||
|
||||
MY_PN="${PN}-0.4.9.3.1"
|
||||
S="${WORKDIR}/${MY_PN}"
|
||||
|
||||
DESCRIPTION="KDE alternative K-Menu"
|
||||
HOMEPAGE="http://www.kbfx.org/"
|
||||
SRC_URI="mirror://sourceforge/${PN}/${MY_PN}.tar.bz2"
|
||||
|
||||
SLOT="0"
|
||||
LICENSE="GPL-2"
|
||||
KEYWORDS="x86 ~ppc ~amd64"
|
||||
IUSE="strigi"
|
||||
|
||||
DEPEND=">=dev-util/cmake-2.4.2
|
||||
strigi? ( kde-misc/strigi )"
|
||||
|
||||
export DESTDIR=${D}
|
||||
|
||||
src_compile() {
|
||||
cd ${S}
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${KDEDIR} \
|
||||
-DUSE_STRIGI:BOOL=$( use strigi && echo ON || echo OFF ) \
|
||||
. || die
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header
|
||||
|
||||
inherit kde eutils subversion
|
||||
need-kde 3.3
|
||||
|
||||
DESCRIPTION="The SVN Version of the KDE alternative K-Menu KBFX"
|
||||
HOMEPAGE="http://www.kbfx.org/"
|
||||
ESVN_REPO_URI="svn://anonsvn.kde.org/home/kde/trunk/playground/base/kbfx_plasma"
|
||||
|
||||
SLOT="0"
|
||||
LICENSE="GPL-2"
|
||||
KEYWORDS="~x86 ~ppc ~amd64"
|
||||
IUSE="strigi"
|
||||
|
||||
DEPEND=">=dev-util/cmake-2.4.2
|
||||
strigi? ( kde-misc/strigi )"
|
||||
|
||||
export DESTDIR=${D}
|
||||
|
||||
src_compile() {
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${KDEDIR} \
|
||||
-DUSE_STRIGI:BOOL=$( use strigi && echo ON || echo OFF ) \
|
||||
. || die
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header
|
||||
|
||||
inherit kde eutils subversion
|
||||
need-kde 3.3
|
||||
|
||||
DESCRIPTION="The SVN Version of the KDE alternative K-Menu KBFX"
|
||||
HOMEPAGE="http://www.kbfx.org/"
|
||||
ESVN_REPO_URI="svn://anonsvn.kde.org/home/kde/trunk/playground/base/kbfx_plasma"
|
||||
|
||||
SLOT="0"
|
||||
LICENSE="GPL-2"
|
||||
KEYWORDS="~x86 ~ppc ~amd64"
|
||||
IUSE="strigi"
|
||||
|
||||
DEPEND=">=dev-util/cmake-2.4.2
|
||||
strigi? ( kde-misc/strigi )"
|
||||
|
||||
export DESTDIR=${D}
|
||||
|
||||
src_compile() {
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${KDEDIR} \
|
||||
-DUSE_STRIGI:BOOL=$( use strigi && echo ON || echo OFF ) \
|
||||
. || die
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header
|
||||
|
||||
inherit kde eutils
|
||||
need-kde 3.3
|
||||
|
||||
MY_PN="${PN}-@VERSION@"
|
||||
S="${WORKDIR}/${MY_PN}"
|
||||
|
||||
DESCRIPTION="KDE alternative K-Menu"
|
||||
HOMEPAGE="http://www.kbfx.org/"
|
||||
SRC_URI="mirror://sourceforge/${PN}/${MY_PN}.tar.bz2"
|
||||
|
||||
SLOT="0"
|
||||
LICENSE="GPL-2"
|
||||
KEYWORDS="@GENTOO_KEYWORDS@"
|
||||
IUSE="strigi"
|
||||
|
||||
DEPEND=">=dev-util/cmake-2.4.2
|
||||
strigi? ( kde-misc/strigi )"
|
||||
|
||||
export DESTDIR=${D}
|
||||
|
||||
src_compile() {
|
||||
cd ${S}
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${KDEDIR} \
|
||||
-DUSE_STRIGI:BOOL=$( use strigi && echo ON || echo OFF ) \
|
||||
. || die
|
||||
}
|
@ -0,0 +1,255 @@
|
||||
%define name kbfx
|
||||
%define version 0.4.9.3.1
|
||||
%define kbfx_release 1
|
||||
%define is_stable 1
|
||||
%define debug_package %{nil}
|
||||
|
||||
%define is_unknown %(test -e /etc/mandrake-release -o -e /etc/SuSE-release -o -e /etc/fedora-release -o -e /etc/pclinuxos-release && echo 0 || echo 1)
|
||||
%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
|
||||
%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0)
|
||||
%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
|
||||
%define is_pclinuxos %(test -e /etc/pclinuxos-release && echo 1 || echo 0)
|
||||
|
||||
%if %{is_suse}
|
||||
%define prefix /opt/kde3
|
||||
Group: System/GUI/KDE
|
||||
Release: %{kbfx_release}.suse%(echo "%{suse_version}" | %__sed -e 's/.$//')
|
||||
Requires: kdelibs3
|
||||
BuildRequires: kdelibs3-devel kdebase3-devel
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: glibc-devel, libstdc++-devel
|
||||
%endif
|
||||
|
||||
%if %{is_fedora}
|
||||
%define fedora_version %(rpm -q --queryformat '%{VERSION}' fedora-release)
|
||||
%define fedora_vernum %(echo "%{fedora_version}" | tr -d '.')
|
||||
%define prefix /usr
|
||||
Group: System/GUI/KDE
|
||||
Release: %{kbfx_release}.FC%{fedora_vernum}
|
||||
Requires: kdebase
|
||||
BuildRequires: kdebase-devel qt-devel
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: glibc-devel, libstdc++-devel
|
||||
%endif
|
||||
|
||||
%if %{is_mandrake}
|
||||
%if %{is_pclinuxos} < 1
|
||||
%define prefix /usr
|
||||
Group: Graphical desktop/KDE
|
||||
Release: %{kbfx_release}.mdv%(echo "%{mdkversion}" | %__sed -e 's/.$//')
|
||||
Requires: kdebase
|
||||
BuildRequires: kdebase-devel
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: glibc-devel, libstdc++-devel
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{is_pclinuxos}
|
||||
%define prefix /usr
|
||||
Group: Graphical desktop/KDE
|
||||
Release: %{kbfx_release}.pclos%{product_version}
|
||||
Requires: kdelibs
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: kdelibs-devel
|
||||
%endif
|
||||
|
||||
%if %{is_unknown}
|
||||
%define prefix %(kde-config --prefix)
|
||||
Group: Graphical desktop/KDE
|
||||
Release: %{kbfx_release}
|
||||
BuildRequires: cmake, automake, libtool
|
||||
%endif
|
||||
|
||||
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
License: GPL
|
||||
URL: http://www.kbfx.org
|
||||
Summary: An alternative to the classical K-Menu button and it's menu.
|
||||
BuildRoot: %{_tmppath}/build-%{name}-%{version}-root
|
||||
Packager: PhobosK <phobosk@mail.kbfx.org>
|
||||
Vendor: KBFX TEAM
|
||||
Provides: kbfx
|
||||
|
||||
%if %{is_stable} < 1
|
||||
Source: %{name}-%{version}-%{kbfx_release}.tar.bz2
|
||||
%else
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
%endif
|
||||
|
||||
%description
|
||||
KBFX is an alternative to the classical K-Menu button and it's menu.
|
||||
It improves the user experience by enabling the user to set a bigger (and thus more visible) start button and by finally replacing the Win95-like K-Menu with the Spinx bar.
|
||||
If you still want the old menu, because you're used to it, it is still available as an option in kbfx.
|
||||
|
||||
Main features:
|
||||
Spinx Bar has 6 Basic Functionalities.
|
||||
1.Selecting an Application Group
|
||||
2.Selecting an Application
|
||||
3.Type and locate an Application
|
||||
4.Logout of the Desktop
|
||||
5.Lock the Desktop
|
||||
6.Launch KBFX settings manager
|
||||
7.Scroll up and down the application list
|
||||
|
||||
Extra features:
|
||||
1.Double buffered Widgets to minimize flicker.
|
||||
2.Animated scroll bars
|
||||
3.New Tooltip
|
||||
4.Gif/Mng File Support
|
||||
5.New Control Manager
|
||||
|
||||
%prep
|
||||
|
||||
%if %{is_stable} < 1
|
||||
%setup -n %{name}-%{version}-%{kbfx_release}
|
||||
%else
|
||||
%setup -n %{name}-%{version}
|
||||
%endif
|
||||
|
||||
rm -Rf build
|
||||
mkdir build
|
||||
cd build
|
||||
export DESTDIR=${RPM_BUILD_ROOT}
|
||||
cmake ../ -DCMAKE_INSTALL_PREFIX=%{prefix}
|
||||
|
||||
%build
|
||||
cd build
|
||||
|
||||
%install
|
||||
cd build
|
||||
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d ${RPM_BUILD_ROOT} ] && rm -Rf ${RPM_BUILD_ROOT};
|
||||
export DESTDIR=${RPM_BUILD_ROOT}
|
||||
make install
|
||||
|
||||
%if %{is_mandrake}
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_menudir}
|
||||
cat << EOF > ${RPM_BUILD_ROOT}%{_menudir}/%{name}
|
||||
?package(%{name}): needs="kde" kde_filename="kbfxconfig" \
|
||||
section="System/Configuration/Other" title="KBFX Configurator" icon="kbfxconfigapp" \
|
||||
command="kbfxconfigapp" longtitle="KBFX Configuration Utility" \
|
||||
kde_opt="\\\\nEncoding=UTF-8\\\\nType=Application"
|
||||
EOF
|
||||
%endif
|
||||
|
||||
%post
|
||||
if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
|
||||
/sbin/ldconfig
|
||||
|
||||
%postun
|
||||
if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
|
||||
/sbin/ldconfig
|
||||
|
||||
|
||||
%clean
|
||||
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d ${RPM_BUILD_ROOT} ] && rm -Rf ${RPM_BUILD_ROOT};
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%{prefix}/*
|
||||
|
||||
%changelog
|
||||
|
||||
* Wed May 16 2007 0.4.9.3.1
|
||||
- CHANGED layout and font configfile specs
|
||||
- UPDATED help documentation
|
||||
- ADDED fade transition effect on the KBFX Button
|
||||
- ADDED install guides for using checkinstall
|
||||
- ADDED Hungarian translation (thanks to Ferenc Stelcz for it)
|
||||
- ADDED option to watch for KDE global changes like new installed applications
|
||||
- ADDED option for Theme Info
|
||||
- ADDED resizable configuration dialogs
|
||||
- ADDED drag&drop hover, pressed and normal images over the KBFX button
|
||||
- ADDED tooltip support for the KBFX button
|
||||
- ADDED switch between KBFX and K Menu
|
||||
- ADDED new two panel skin - "2panels"
|
||||
- ADDED configurable middle background - middleboxbg.png
|
||||
- ADDED fonts support in every part of the menu
|
||||
- ADDED layout support in the KBFX Configurator
|
||||
- ADDED support for the new versions of strigi
|
||||
- ADDED support for use of strigi in Gentoo
|
||||
- ADDED support for SVN version in Gentoo
|
||||
- ADDED support for PCLinuxOS rpm build (thanks to @PaGal and @tom777 for the testing)
|
||||
- ADDED support for future KDE4 (part 1)
|
||||
- ADDED uninstall option for "build.sh" script
|
||||
- FIXED cmake uninstall
|
||||
- FIXED RPM .la issues
|
||||
- FIXED some major bugs
|
||||
- REMOVED Water effect (too much CPU time consuming and not a favorite one for our users)
|
||||
|
||||
* Wed Jan 17 2007 0.4.9.3-20070117
|
||||
- Initial Release of the 0.4.9.3 Series - KBFX Silk (0.4.9.3)
|
||||
- New Build system (cmake)
|
||||
- Re-write of the data backend
|
||||
- Re-write of the GUI
|
||||
- Totally new theme
|
||||
- Improved configuration dialog
|
||||
|
||||
* Fri Nov 17 2006 0.4.9.2rc4
|
||||
- CHANGED some aspects of autoconf/automake behaviour
|
||||
- CHANGED "Toolbar Resize" behaviour - turned off by default so kicker doesn't change its size anymore
|
||||
- ADDED support for Mandriva 2007 compilation (no menudrake there by default)
|
||||
- FIXED Searchbar behaviour (thanks @gropiuskalle)
|
||||
- FIXED some minor bugs
|
||||
|
||||
* Sun Nov 05 2006 0.4.9.2rc3
|
||||
- ADDED support for preparing .kbfxtheme files in konqueror (look the explanation in HOWTO file)
|
||||
- ADDED "--prepare" commandline option to pack existing KBFX Skin Folders to .kbfxtheme files
|
||||
- ADDED "Default Theme's Personal Image" to the "KBFX Configurator Application"
|
||||
- ADDED "Toolbar Resize" option to the "KBFX Configurator Application" for the toolbar where the KBFX Button resides
|
||||
- ADDED it, bg and nl translations
|
||||
- FIXED some minor bugs
|
||||
|
||||
* Mon Sep 19 2006 0.4.9.2rc2
|
||||
- CHANGED "KBFX Configurator Application" - rewritten from scratch and is no more part of "kcontrol"
|
||||
- CHANGED "Tooltip Animation" behaviour - turned off by default
|
||||
- ADDED new Default Theme
|
||||
- ADDED fonts configuration option to the "KBFX Configurator Application"
|
||||
- ADDED Install/Delete Themes to the "KBFX Configurator Application"
|
||||
- ADDED support for .kbfxtheme files in konqueror (look the explanation in HOWTO file)
|
||||
- ADDED possibility to change "dude" image to the "KBFX Configurator Application"
|
||||
- ADDED Free-BSD Support
|
||||
- FIXED font alignment problems
|
||||
- FIXED long applications name problem
|
||||
- FIXED some memory leaks
|
||||
- FIXED some minor bugs
|
||||
|
||||
* Sun Jun 18 2006 0.4.9.2-20060708cvs
|
||||
- UPDATED make system
|
||||
|
||||
* Sun Jun 11 2006 0.4.9.2-20060611cvs
|
||||
- ADDED KNOWN_BUGS file in the project documents
|
||||
- ADDED PC-BSD Support
|
||||
- ADDED Drag and Drop Support
|
||||
- FIXED a bug with showing icons in "Recently Used" items
|
||||
- FIXED a bug with the placement of ".face.icon" (thanks @Nucc)
|
||||
- Flicker Free KBFX Button
|
||||
- Flicker Free KBFX SPINX Menu TOP
|
||||
- Better scrolling
|
||||
|
||||
|
||||
* Sun May 28 2006 0.4.9.2-20060528cvs
|
||||
- ADDED suport for Fedora rpm
|
||||
- ADDED an option to disable tooltip (see HOWTO file)
|
||||
- FIXED a problem with building SUSE rpm
|
||||
|
||||
|
||||
* Wed May 10 2006 0.4.9.2rc1
|
||||
- ADDED suport for SUSE rpm
|
||||
- ADDED support for Buttons with Drop shadows
|
||||
- ADDED Font settings as part of the Theme itself
|
||||
- ADDED Grouping header for each application group and sub groups
|
||||
- ADDED Kiosk mode support
|
||||
- ADDED Handling of submenus
|
||||
- FIXED a problem with make
|
||||
- FIXED make system for all distributions
|
||||
- Better support for Mandriva distribution
|
||||
- More applications for the menu
|
||||
|
||||
|
||||
* Sun Apr 16 2006 0.4.9.1-1
|
||||
Initial rpm release
|
||||
- FIXED Kbfx configuration
|
||||
- FIXED Slack 1.9 automake and compilation
|
||||
- FIXED /tmp/.kbfx.html
|
||||
|
@ -0,0 +1,255 @@
|
||||
%define name @APPLICATION_NAME@
|
||||
%define version @APPLICATION_MAIN_VERSION@@APPLICATION_STABLE_RELEASE@
|
||||
%define kbfx_release @LIB_SUB_RELEASE@
|
||||
%define is_stable @APPLICATION_STABLE@
|
||||
%define debug_package %{nil}
|
||||
|
||||
%define is_unknown %(test -e /etc/mandrake-release -o -e /etc/SuSE-release -o -e /etc/fedora-release -o -e /etc/pclinuxos-release && echo 0 || echo 1)
|
||||
%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
|
||||
%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0)
|
||||
%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
|
||||
%define is_pclinuxos %(test -e /etc/pclinuxos-release && echo 1 || echo 0)
|
||||
|
||||
%if %{is_suse}
|
||||
%define prefix /opt/kde3
|
||||
Group: System/GUI/KDE
|
||||
Release: %{kbfx_release}.suse%(echo "%{suse_version}" | %__sed -e 's/.$//')
|
||||
Requires: kdelibs3
|
||||
BuildRequires: kdelibs3-devel kdebase3-devel
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: glibc-devel, libstdc++-devel
|
||||
%endif
|
||||
|
||||
%if %{is_fedora}
|
||||
%define fedora_version %(rpm -q --queryformat '%{VERSION}' fedora-release)
|
||||
%define fedora_vernum %(echo "%{fedora_version}" | tr -d '.')
|
||||
%define prefix /usr
|
||||
Group: System/GUI/KDE
|
||||
Release: %{kbfx_release}.FC%{fedora_vernum}
|
||||
Requires: kdebase
|
||||
BuildRequires: kdebase-devel qt-devel
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: glibc-devel, libstdc++-devel
|
||||
%endif
|
||||
|
||||
%if %{is_mandrake}
|
||||
%if %{is_pclinuxos} < 1
|
||||
%define prefix /usr
|
||||
Group: Graphical desktop/KDE
|
||||
Release: %{kbfx_release}.mdv%(echo "%{mdkversion}" | %__sed -e 's/.$//')
|
||||
Requires: kdebase
|
||||
BuildRequires: kdebase-devel
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: glibc-devel, libstdc++-devel
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{is_pclinuxos}
|
||||
%define prefix /usr
|
||||
Group: Graphical desktop/KDE
|
||||
Release: %{kbfx_release}.pclos%{product_version}
|
||||
Requires: kdelibs
|
||||
BuildRequires: cmake, automake, libtool
|
||||
BuildRequires: kdelibs-devel
|
||||
%endif
|
||||
|
||||
%if %{is_unknown}
|
||||
%define prefix %(kde-config --prefix)
|
||||
Group: Graphical desktop/KDE
|
||||
Release: %{kbfx_release}
|
||||
BuildRequires: cmake, automake, libtool
|
||||
%endif
|
||||
|
||||
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
License: GPL
|
||||
URL: http://www.kbfx.org
|
||||
Summary: An alternative to the classical K-Menu button and it's menu.
|
||||
BuildRoot: %{_tmppath}/build-%{name}-%{version}-root
|
||||
Packager: PhobosK <phobosk@mail.kbfx.org>
|
||||
Vendor: KBFX TEAM
|
||||
Provides: kbfx
|
||||
|
||||
%if %{is_stable} < 1
|
||||
Source: %{name}-%{version}-%{kbfx_release}.tar.bz2
|
||||
%else
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
%endif
|
||||
|
||||
%description
|
||||
KBFX is an alternative to the classical K-Menu button and it's menu.
|
||||
It improves the user experience by enabling the user to set a bigger (and thus more visible) start button and by finally replacing the Win95-like K-Menu with the Spinx bar.
|
||||
If you still want the old menu, because you're used to it, it is still available as an option in kbfx.
|
||||
|
||||
Main features:
|
||||
Spinx Bar has 6 Basic Functionalities.
|
||||
1.Selecting an Application Group
|
||||
2.Selecting an Application
|
||||
3.Type and locate an Application
|
||||
4.Logout of the Desktop
|
||||
5.Lock the Desktop
|
||||
6.Launch KBFX settings manager
|
||||
7.Scroll up and down the application list
|
||||
|
||||
Extra features:
|
||||
1.Double buffered Widgets to minimize flicker.
|
||||
2.Animated scroll bars
|
||||
3.New Tooltip
|
||||
4.Gif/Mng File Support
|
||||
5.New Control Manager
|
||||
|
||||
%prep
|
||||
|
||||
%if %{is_stable} < 1
|
||||
%setup -n %{name}-%{version}-%{kbfx_release}
|
||||
%else
|
||||
%setup -n %{name}-%{version}
|
||||
%endif
|
||||
|
||||
rm -Rf build
|
||||
mkdir build
|
||||
cd build
|
||||
export DESTDIR=${RPM_BUILD_ROOT}
|
||||
cmake ../ -DCMAKE_INSTALL_PREFIX=%{prefix}
|
||||
|
||||
%build
|
||||
cd build
|
||||
|
||||
%install
|
||||
cd build
|
||||
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d ${RPM_BUILD_ROOT} ] && rm -Rf ${RPM_BUILD_ROOT};
|
||||
export DESTDIR=${RPM_BUILD_ROOT}
|
||||
make install
|
||||
|
||||
%if %{is_mandrake}
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_menudir}
|
||||
cat << EOF > ${RPM_BUILD_ROOT}%{_menudir}/%{name}
|
||||
?package(%{name}): needs="kde" kde_filename="kbfxconfig" \
|
||||
section="System/Configuration/Other" title="KBFX Configurator" icon="kbfxconfigapp" \
|
||||
command="kbfxconfigapp" longtitle="KBFX Configuration Utility" \
|
||||
kde_opt="\\\\nEncoding=UTF-8\\\\nType=Application"
|
||||
EOF
|
||||
%endif
|
||||
|
||||
%post
|
||||
if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
|
||||
/sbin/ldconfig
|
||||
|
||||
%postun
|
||||
if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
|
||||
/sbin/ldconfig
|
||||
|
||||
|
||||
%clean
|
||||
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d ${RPM_BUILD_ROOT} ] && rm -Rf ${RPM_BUILD_ROOT};
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%{prefix}/*
|
||||
|
||||
%changelog
|
||||
|
||||
* Wed May 16 2007 0.4.9.3.1
|
||||
- CHANGED layout and font configfile specs
|
||||
- UPDATED help documentation
|
||||
- ADDED fade transition effect on the KBFX Button
|
||||
- ADDED install guides for using checkinstall
|
||||
- ADDED Hungarian translation (thanks to Ferenc Stelcz for it)
|
||||
- ADDED option to watch for KDE global changes like new installed applications
|
||||
- ADDED option for Theme Info
|
||||
- ADDED resizable configuration dialogs
|
||||
- ADDED drag&drop hover, pressed and normal images over the KBFX button
|
||||
- ADDED tooltip support for the KBFX button
|
||||
- ADDED switch between KBFX and K Menu
|
||||
- ADDED new two panel skin - "2panels"
|
||||
- ADDED configurable middle background - middleboxbg.png
|
||||
- ADDED fonts support in every part of the menu
|
||||
- ADDED layout support in the KBFX Configurator
|
||||
- ADDED support for the new versions of strigi
|
||||
- ADDED support for use of strigi in Gentoo
|
||||
- ADDED support for SVN version in Gentoo
|
||||
- ADDED support for PCLinuxOS rpm build (thanks to @PaGal and @tom777 for the testing)
|
||||
- ADDED support for future KDE4 (part 1)
|
||||
- ADDED uninstall option for "build.sh" script
|
||||
- FIXED cmake uninstall
|
||||
- FIXED RPM .la issues
|
||||
- FIXED some major bugs
|
||||
- REMOVED Water effect (too much CPU time consuming and not a favorite one for our users)
|
||||
|
||||
* Wed Jan 17 2007 0.4.9.3-20070117
|
||||
- Initial Release of the 0.4.9.3 Series - KBFX Silk (0.4.9.3)
|
||||
- New Build system (cmake)
|
||||
- Re-write of the data backend
|
||||
- Re-write of the GUI
|
||||
- Totally new theme
|
||||
- Improved configuration dialog
|
||||
|
||||
* Fri Nov 17 2006 0.4.9.2rc4
|
||||
- CHANGED some aspects of autoconf/automake behaviour
|
||||
- CHANGED "Toolbar Resize" behaviour - turned off by default so kicker doesn't change its size anymore
|
||||
- ADDED support for Mandriva 2007 compilation (no menudrake there by default)
|
||||
- FIXED Searchbar behaviour (thanks @gropiuskalle)
|
||||
- FIXED some minor bugs
|
||||
|
||||
* Sun Nov 05 2006 0.4.9.2rc3
|
||||
- ADDED support for preparing .kbfxtheme files in konqueror (look the explanation in HOWTO file)
|
||||
- ADDED "--prepare" commandline option to pack existing KBFX Skin Folders to .kbfxtheme files
|
||||
- ADDED "Default Theme's Personal Image" to the "KBFX Configurator Application"
|
||||
- ADDED "Toolbar Resize" option to the "KBFX Configurator Application" for the toolbar where the KBFX Button resides
|
||||
- ADDED it, bg and nl translations
|
||||
- FIXED some minor bugs
|
||||
|
||||
* Mon Sep 19 2006 0.4.9.2rc2
|
||||
- CHANGED "KBFX Configurator Application" - rewritten from scratch and is no more part of "kcontrol"
|
||||
- CHANGED "Tooltip Animation" behaviour - turned off by default
|
||||
- ADDED new Default Theme
|
||||
- ADDED fonts configuration option to the "KBFX Configurator Application"
|
||||
- ADDED Install/Delete Themes to the "KBFX Configurator Application"
|
||||
- ADDED support for .kbfxtheme files in konqueror (look the explanation in HOWTO file)
|
||||
- ADDED possibility to change "dude" image to the "KBFX Configurator Application"
|
||||
- ADDED Free-BSD Support
|
||||
- FIXED font alignment problems
|
||||
- FIXED long applications name problem
|
||||
- FIXED some memory leaks
|
||||
- FIXED some minor bugs
|
||||
|
||||
* Sun Jun 18 2006 0.4.9.2-20060708cvs
|
||||
- UPDATED make system
|
||||
|
||||
* Sun Jun 11 2006 0.4.9.2-20060611cvs
|
||||
- ADDED KNOWN_BUGS file in the project documents
|
||||
- ADDED PC-BSD Support
|
||||
- ADDED Drag and Drop Support
|
||||
- FIXED a bug with showing icons in "Recently Used" items
|
||||
- FIXED a bug with the placement of ".face.icon" (thanks @Nucc)
|
||||
- Flicker Free KBFX Button
|
||||
- Flicker Free KBFX SPINX Menu TOP
|
||||
- Better scrolling
|
||||
|
||||
|
||||
* Sun May 28 2006 0.4.9.2-20060528cvs
|
||||
- ADDED suport for Fedora rpm
|
||||
- ADDED an option to disable tooltip (see HOWTO file)
|
||||
- FIXED a problem with building SUSE rpm
|
||||
|
||||
|
||||
* Wed May 10 2006 0.4.9.2rc1
|
||||
- ADDED suport for SUSE rpm
|
||||
- ADDED support for Buttons with Drop shadows
|
||||
- ADDED Font settings as part of the Theme itself
|
||||
- ADDED Grouping header for each application group and sub groups
|
||||
- ADDED Kiosk mode support
|
||||
- ADDED Handling of submenus
|
||||
- FIXED a problem with make
|
||||
- FIXED make system for all distributions
|
||||
- Better support for Mandriva distribution
|
||||
- More applications for the menu
|
||||
|
||||
|
||||
* Sun Apr 16 2006 0.4.9.1-1
|
||||
Initial rpm release
|
||||
- FIXED Kbfx configuration
|
||||
- FIXED Slack 1.9 automake and compilation
|
||||
- FIXED /tmp/.kbfx.html
|
||||
|
@ -0,0 +1,48 @@
|
||||
SET(libkbfxcommonsrc
|
||||
kbfxkiodownload.cpp
|
||||
kbfxpixmaplabel.cpp
|
||||
kbfxconfig.cpp
|
||||
kbfxpushbutton.cpp
|
||||
kbfxthemesdata.cpp
|
||||
kbfxfontchooser.cpp
|
||||
kbfxplasmapixmapprovider.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxcommonsrc})
|
||||
|
||||
ADD_LIBRARY(kbfxcommon SHARED ${libkbfxcommonsrc})
|
||||
SET_TARGET_PROPERTIES(kbfxcommon
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxcommon PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxcommon
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxcommon ${LIB_INSTALL_DIR})
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxcommonsrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxcommon SHARED ${libkbfxcommonsrc})
|
||||
TARGET_LINK_LIBRARIES(kbfxcommon
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxcommon ${LIB_INSTALL_DIR})
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxcommon DESTINATION ${LIB_INSTALL_DIR})
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/common)
|
@ -0,0 +1,862 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxconfig.h"
|
||||
|
||||
KbfxConfig::KbfxConfig()
|
||||
{
|
||||
/* set default configuration values */
|
||||
|
||||
/* KBFX internal settings */
|
||||
KbfxThemeRcDestination = KGlobal::dirs()->saveLocation ( "data", QString ( "kbfx/themerc/" ), TRUE );
|
||||
KbfxRcPath = KGlobal::dirs()->findResource ( "config", "kbfxrc" );
|
||||
m_KbfxDeleteOldConf = FALSE;
|
||||
QString _unspecified = tr2i18n ( "Not Specified" );
|
||||
QString path = locate ( "data", "kbfx/skins/default/bg.png" );
|
||||
path.remove ( "default/bg.png" );
|
||||
|
||||
kdDebug() << "Configuration path skins: " + path << endl;
|
||||
|
||||
/* KBFX general settings */
|
||||
m_KbfxGeneralVersionDefault = APPLICATION_INTERNAL_VERSION;
|
||||
m_KbfxThemesVersion = "version-2";
|
||||
|
||||
m_KbfxHistoryDefault = "";
|
||||
|
||||
/* theme properties */
|
||||
m_SpinxThemeNameDefault = "default";
|
||||
m_SpinxThemeBasePathDefault = path;
|
||||
m_UserSpinxThemeBasePathDefault = path;
|
||||
|
||||
m_KbfxMenuTypeDefault = "spinx";
|
||||
m_ToolBarResizeDefault = FALSE;
|
||||
m_KbfxWatcherDefault = TRUE;
|
||||
m_KbfxShowOldThemesDefault = FALSE;
|
||||
|
||||
/* user(dude) image properties */
|
||||
m_SpinxDudeBlinkDefault = FALSE;
|
||||
KUser *user = new KUser();
|
||||
m_SpinxDudeImageDefault = locate ( "data", user->homeDir () + "/.face.icon" );
|
||||
delete user;
|
||||
|
||||
/* tooltip properties */
|
||||
m_ToolTipDefault = FALSE;
|
||||
m_ToolTipAnimationDefault = TRUE;
|
||||
m_ToolTipTextDefault = "Application menu";
|
||||
m_ToolTipAvatarDefault = path + "default/butterfly.png";
|
||||
m_SpinxTooltipDudeboxDefault = path + "default/tooltip_dudebox.png";
|
||||
m_SpinxTooltipMaskDefault = path + "default/tooltip_mask.png";
|
||||
m_SpinxTooltipWindowDefault = path + "default/tooltip_window.png";
|
||||
m_SpinxTooltipLogoDefault = path + "default/tooltip_logo.png";
|
||||
|
||||
/* KBFX plugins */
|
||||
m_pluginsLeftDefault="Applications";
|
||||
m_pluginsRightDefault="Settings";
|
||||
|
||||
/* specific theme KBFX settings */
|
||||
|
||||
/* KBFX panel button */
|
||||
m_KbfxNormalButtonPathDefault = path + "default/normal.png";
|
||||
m_KbfxHoverButtonPathDefault = path + "default/hover.png";
|
||||
m_KbfxPressedButtonPathDefault = path + "default/pressed.png";
|
||||
|
||||
/* face properties */
|
||||
m_facePos_xDefault = -1;
|
||||
m_facePos_yDefault = -1;
|
||||
m_faceIconXDefault = 27;
|
||||
m_faceIconYDefault = 8;
|
||||
m_faceIconHDefault = 64;
|
||||
m_faceIconWDefault = 65;
|
||||
m_userNamePos_xDefault = 130;
|
||||
m_userNamePos_yDefault = 32;
|
||||
m_faceBoxHideTextDefault = FALSE;
|
||||
|
||||
/* top bar properties */
|
||||
m_topBar_xDefault = 0;
|
||||
m_topBar_yDefault = 0;
|
||||
m_topBar_hDefault = 95;
|
||||
m_topBar_wDefault = 504; //108+190+74;
|
||||
|
||||
/* bottom bar properties */
|
||||
m_botBar_xDefault = 0;
|
||||
m_botBar_yDefault = 428;
|
||||
m_botBar_hDefault = 38;
|
||||
m_botBar_wDefault = 504; //108+190+74;
|
||||
|
||||
/* scroll bar properties */
|
||||
m_scrollBarBotYDefault = 95;
|
||||
m_scrollBarBotXDefault = 108;
|
||||
m_scrollBarTopXDefault = 108;
|
||||
m_scrollBarTopYDefault = 95;
|
||||
|
||||
/* listbox properties */
|
||||
m_listBox_xDefault = 0;
|
||||
m_listBox_yDefault = m_topBar_hDefault;
|
||||
m_listBox_wDefault = 132;
|
||||
m_listBox_hDefault = 275;
|
||||
|
||||
/* search box properties */
|
||||
m_searchBox_hDefault = 22;
|
||||
m_searchBox_wDefault = 240;
|
||||
m_searchBox_xDefault = 130;
|
||||
m_searchBox_yDefault = 48;
|
||||
m_searchBox_staticDefault = TRUE;
|
||||
|
||||
/* item view properties */
|
||||
m_itemView_hDefault = 380;
|
||||
m_itemView_wDefault = 240;
|
||||
m_itemView_xDefault = 132;
|
||||
m_itemView_yDefault = m_topBar_hDefault;
|
||||
|
||||
/* toolbar properties */
|
||||
m_toolBarButtonNormalSizeDefault = 48;
|
||||
m_toolBarButtonExpandSizeDefault = 48;
|
||||
|
||||
/* KBFX misc properties */
|
||||
m_userMenuHeightDefault = 513;
|
||||
m_userMenuWidthDefault = 504;
|
||||
m_startHiddenDefault = FALSE;
|
||||
m_fadeTimeDefault = 75;
|
||||
m_noCommentsDefault = FALSE;
|
||||
m_commentMargineDefault = 66;
|
||||
m_iconSizeDefault = 32;
|
||||
|
||||
/* set default fonts values */
|
||||
m_fontTooltipColorDefault = QColor ( 0,0,0 );
|
||||
m_fontTooltipFontDefault = QFont ( "Arial", 8, QFont::Normal );
|
||||
m_fontAppNameColorDefault = QColor ( 0,0,0 );
|
||||
m_fontAppNameFontDefault = QFont ( "Arial", 8, QFont::Normal );
|
||||
m_fontAppCommentColorDefault = QColor ( 128,125,0 );
|
||||
m_fontAppCommentFontDefault = QFont ( "Arial", 8, QFont::Normal );
|
||||
m_fontIndexColorDefault = QColor ( 0,0,0 );
|
||||
m_fontIndexFontDefault = QFont ( "Arial", 8, QFont::Normal );
|
||||
m_userNameColorDefault = QColor ( 255,255,255 );
|
||||
m_userNameFontDefault = QFont ( "Arial", 10, QFont::Bold );
|
||||
m_sepNameColorDefault = QColor ( 0,0,0 );
|
||||
m_sepNameFontDefault = QFont ( "Arial", 8, QFont::Bold );
|
||||
m_pluginNameColorDefault = QColor ( 0,0,0 );
|
||||
m_pluginNameFontDefault = QFont ( "Arial", 8, QFont::Normal );
|
||||
m_lineColorDefault = QColor ( 255,220,125 );
|
||||
m_fontHoverBoldDefault = FALSE;
|
||||
|
||||
/* set default theme info values */
|
||||
m_InfoVersionDefault = _unspecified;
|
||||
m_InfoAuthorDefault = _unspecified;
|
||||
m_InfoEmailDefault = _unspecified;
|
||||
m_InfoUrlDefault = _unspecified;
|
||||
|
||||
read();
|
||||
}
|
||||
|
||||
KbfxConfig& ConfigInit()
|
||||
{
|
||||
static KbfxConfig _config;
|
||||
return _config;
|
||||
}
|
||||
|
||||
void KbfxConfig::setDefault()
|
||||
{
|
||||
/* set default configuration */
|
||||
m_KbfxHistory = m_KbfxHistoryDefault;
|
||||
|
||||
m_SpinxThemeName = m_SpinxThemeNameDefault;
|
||||
m_SpinxThemeBasePath = m_SpinxThemeBasePathDefault;
|
||||
m_UserSpinxThemeBasePath = m_UserSpinxThemeBasePathDefault;
|
||||
|
||||
m_KbfxMenuType = m_KbfxMenuTypeDefault;
|
||||
m_ToolBarResize = m_ToolBarResizeDefault;
|
||||
m_KbfxWatcher = m_KbfxWatcherDefault;
|
||||
m_KbfxShowOldThemes = m_KbfxShowOldThemesDefault;
|
||||
|
||||
m_SpinxDudeBlink = m_SpinxDudeBlinkDefault;
|
||||
m_SpinxDudeImage = m_SpinxDudeImageDefault;
|
||||
|
||||
m_ToolTip = m_ToolTipDefault;
|
||||
m_ToolTipAnimation = m_ToolTipAnimationDefault;
|
||||
m_ToolTipText = m_ToolTipTextDefault;
|
||||
|
||||
m_pluginsLeft = m_pluginsLeftDefault;
|
||||
m_pluginsRight = m_pluginsRightDefault;
|
||||
}
|
||||
|
||||
void KbfxConfig::setThemeInfoDefault()
|
||||
{
|
||||
/* set default configuration */
|
||||
m_InfoVersion = m_InfoVersionDefault;
|
||||
m_InfoAuthor = m_InfoAuthorDefault;
|
||||
m_InfoEmail = m_InfoEmailDefault;
|
||||
m_InfoUrl = m_InfoUrlDefault;
|
||||
}
|
||||
|
||||
void KbfxConfig::setThemeDefault()
|
||||
{
|
||||
/* set default theme layout configuration */
|
||||
m_KbfxNormalButtonPath = m_KbfxNormalButtonPathDefault;
|
||||
m_KbfxHoverButtonPath = m_KbfxHoverButtonPathDefault;
|
||||
m_KbfxPressedButtonPath = m_KbfxPressedButtonPathDefault;
|
||||
|
||||
m_ToolTipAvatar = m_ToolTipAvatarDefault;
|
||||
m_SpinxTooltipDudebox = m_SpinxTooltipDudeboxDefault;
|
||||
m_SpinxTooltipMask = m_SpinxTooltipMaskDefault;
|
||||
m_SpinxTooltipWindow = m_SpinxTooltipWindowDefault;
|
||||
m_SpinxTooltipLogo = m_SpinxTooltipLogoDefault;
|
||||
|
||||
m_facePos_x = m_facePos_xDefault;
|
||||
m_facePos_y = m_facePos_yDefault;
|
||||
m_faceIconX = m_faceIconXDefault;
|
||||
m_faceIconY = m_faceIconYDefault;
|
||||
m_faceIconH = m_faceIconHDefault;
|
||||
m_faceIconW = m_faceIconWDefault;
|
||||
m_userNamePos_x = m_userNamePos_xDefault;
|
||||
m_userNamePos_y = m_userNamePos_yDefault;
|
||||
m_faceBoxHideText = m_faceBoxHideTextDefault;
|
||||
|
||||
m_topBar_x = m_topBar_xDefault;
|
||||
m_topBar_y = m_topBar_yDefault;
|
||||
m_topBar_h = m_topBar_hDefault;
|
||||
m_topBar_w = m_topBar_wDefault;
|
||||
|
||||
m_botBar_x = m_botBar_xDefault;
|
||||
m_botBar_y = m_botBar_yDefault;
|
||||
m_botBar_h = m_botBar_hDefault;
|
||||
m_botBar_w = m_botBar_wDefault;
|
||||
|
||||
m_scrollBarBotY = m_scrollBarBotYDefault;
|
||||
m_scrollBarBotX = m_scrollBarBotXDefault;
|
||||
m_scrollBarTopX = m_scrollBarTopXDefault;
|
||||
m_scrollBarTopY = m_scrollBarTopYDefault;
|
||||
|
||||
m_listBox_x = m_listBox_xDefault;
|
||||
m_listBox_y = m_listBox_yDefault;
|
||||
m_listBox_w = m_listBox_wDefault;
|
||||
m_listBox_h = m_listBox_hDefault;
|
||||
|
||||
m_searchBox_h = m_searchBox_hDefault;
|
||||
m_searchBox_w = m_searchBox_wDefault;
|
||||
m_searchBox_x = m_searchBox_xDefault;
|
||||
m_searchBox_y = m_searchBox_yDefault;
|
||||
m_searchBox_static = m_searchBox_staticDefault;
|
||||
|
||||
m_itemView_h = m_itemView_hDefault;
|
||||
m_itemView_w = m_itemView_wDefault;
|
||||
m_itemView_x = m_itemView_xDefault;
|
||||
m_itemView_y = m_itemView_yDefault;
|
||||
|
||||
m_toolBarButtonNormalSize = m_toolBarButtonNormalSizeDefault;
|
||||
m_toolBarButtonExpandSize = m_toolBarButtonExpandSizeDefault;
|
||||
|
||||
m_userMenuHeight = m_userMenuHeightDefault;
|
||||
m_userMenuWidth = m_userMenuWidthDefault;
|
||||
m_startHidden = m_startHiddenDefault;
|
||||
m_fadeTime = m_fadeTimeDefault;
|
||||
m_noComments = m_noCommentsDefault;
|
||||
m_commentMargine = m_commentMargineDefault;
|
||||
m_iconSize = m_iconSizeDefault;
|
||||
}
|
||||
|
||||
void KbfxConfig::setFontsDefault()
|
||||
{
|
||||
/* set default fonts values */
|
||||
m_fontTooltipColor = m_fontTooltipColorDefault;
|
||||
m_fontTooltipFont = m_fontTooltipFontDefault;
|
||||
m_fontAppNameColor = m_fontAppNameColorDefault;
|
||||
m_fontAppNameFont = m_fontAppNameFontDefault;
|
||||
m_fontAppCommentColor = m_fontAppCommentColorDefault;
|
||||
m_fontAppCommentFont = m_fontAppCommentFontDefault;
|
||||
m_fontIndexColor = m_fontIndexColorDefault;
|
||||
m_fontIndexFont = m_fontIndexFontDefault;
|
||||
m_userNameColor = m_userNameColorDefault;
|
||||
m_userNameFont = m_userNameFontDefault;
|
||||
m_sepNameColor = m_sepNameColorDefault;
|
||||
m_sepNameFont = m_sepNameFontDefault;
|
||||
m_pluginNameColor = m_pluginNameColorDefault;
|
||||
m_pluginNameFont = m_pluginNameFontDefault;
|
||||
m_lineColor = m_lineColorDefault;
|
||||
m_fontHoverBold = m_fontHoverBoldDefault;
|
||||
}
|
||||
|
||||
void KbfxConfig::readThemeInfo ( QString &themePath, QString &themeName )
|
||||
{
|
||||
setThemeInfoDefault();
|
||||
|
||||
QFileInfo * info_theme = new QFileInfo ( themePath + themeName + "/" + m_KbfxThemesVersion );
|
||||
KConfig * infoconfig = 0;
|
||||
|
||||
if ( info_theme->exists() == TRUE )
|
||||
{
|
||||
infoconfig = new KConfig ( info_theme->absFilePath() );
|
||||
infoconfig->setGroup ( "ThemeGeneral" );
|
||||
m_InfoVersion = infoconfig->readEntry ( "ThemeVersion", m_InfoVersionDefault );
|
||||
m_InfoAuthor = infoconfig->readEntry ( "AuthorName", m_InfoAuthorDefault );
|
||||
m_InfoEmail = infoconfig->readEntry ( "AuthorEmail", m_InfoEmailDefault );
|
||||
m_InfoUrl = infoconfig->readEntry ( "Homepage", m_InfoUrlDefault );
|
||||
}
|
||||
|
||||
/*
|
||||
kdDebug() << " m_InfoVersion: " << m_InfoVersion
|
||||
<< endl << " m_InfoAuthor: " << m_InfoAuthor
|
||||
<< endl << " m_InfoEmail: " << m_InfoEmail
|
||||
<< endl << " m_InfoUrl: " << m_InfoUrl
|
||||
<< endl;
|
||||
*/
|
||||
|
||||
delete info_theme;
|
||||
delete infoconfig;
|
||||
}
|
||||
|
||||
void KbfxConfig::read()
|
||||
{
|
||||
/* read general configuration */
|
||||
KConfigSkeleton *confskel = new KConfigSkeleton ( QString::fromLatin1 ( "kbfxrc" ) );
|
||||
|
||||
KConfig *conf = confskel->config();
|
||||
|
||||
QString __default = KGlobal::iconLoader()->iconPath ( "kbfx", ( int ) KIcon::Desktop, FALSE );
|
||||
|
||||
conf->setGroup ( "KbfxGeneral" );
|
||||
m_KbfxGeneralVersion = conf->readNumEntry ( "Version", 0 );
|
||||
m_ToolBarResize = conf->readBoolEntry ( "ToolBarResize", m_ToolBarResizeDefault );
|
||||
m_KbfxMenuType = conf->readEntry ( "MenuType", m_KbfxMenuTypeDefault );
|
||||
m_KbfxWatcher = conf->readBoolEntry ( "KbfxWatcher", m_KbfxWatcherDefault );
|
||||
m_KbfxShowOldThemes = conf->readBoolEntry ( "KbfxShowOld", m_KbfxShowOldThemesDefault );
|
||||
|
||||
conf->setGroup ( "SpinxTheme" );
|
||||
m_UserSpinxThemeBasePath = conf->readEntry ( "UserThemePath", m_UserSpinxThemeBasePathDefault );
|
||||
/* if a new version use default theme */
|
||||
if ( m_KbfxGeneralVersion < m_KbfxGeneralVersionDefault )
|
||||
{
|
||||
m_SpinxThemeName = m_SpinxThemeNameDefault;
|
||||
m_SpinxThemeBasePath = m_SpinxThemeBasePathDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SpinxThemeName = conf->readEntry ( "ThemeName", m_SpinxThemeNameDefault );
|
||||
m_SpinxThemeBasePath = conf->readEntry ( "ThemePath", m_SpinxThemeBasePathDefault );
|
||||
}
|
||||
|
||||
conf->setGroup ( "UserImage" );
|
||||
m_SpinxDudeBlink = conf->readBoolEntry ( "DudeBlink", m_SpinxDudeBlinkDefault );
|
||||
|
||||
conf->setGroup ( "ToolTip" );
|
||||
m_ToolTip = conf->readBoolEntry ( "EnableToolTip", m_ToolTipDefault );
|
||||
m_ToolTipAnimation = conf->readBoolEntry ( "AnimatedTooltip", m_ToolTipAnimationDefault );
|
||||
m_ToolTipText = conf->readEntry ( "ToolTipText", m_ToolTipTextDefault );
|
||||
|
||||
conf->setGroup ( "Plugins" );
|
||||
m_pluginsLeft = conf->readListEntry ( "LoadedPluginsLeft", m_pluginsLeftDefault );
|
||||
m_pluginsRight = conf->readListEntry ( "LoadedPluginsRight", m_pluginsRightDefault );
|
||||
|
||||
conf->setGroup ( "Runtime" );
|
||||
m_KbfxHistory = conf->readEntry ( "History", m_KbfxHistoryDefault );
|
||||
|
||||
/*
|
||||
kdDebug() << " m_KbfxGeneralVersion: " << m_KbfxGeneralVersion
|
||||
<< endl << " m_KbfxMenuType: " << m_KbfxMenuType
|
||||
<< endl << " m_KbfxWatcher: " << m_KbfxWatcher
|
||||
<< endl << " m_KbfxShowOldThemes: " << m_KbfxShowOldThemes
|
||||
<< endl << " m_ToolBarResize: " << m_ToolBarResize
|
||||
<< endl << " m_UserSpinxThemeBasePath : " << m_UserSpinxThemeBasePath
|
||||
<< endl << " m_SpinxThemeName: " << m_SpinxThemeName
|
||||
<< endl << " m_SpinxThemeBasePath: " << m_SpinxThemeBasePath
|
||||
<< endl << " m_SpinxDudeBlink: " << m_SpinxDudeBlink
|
||||
<< endl << " m_ToolTip: " << m_ToolTip
|
||||
<< endl << " m_ToolTipAnimation: " << m_ToolTipAnimation
|
||||
<< endl << " m_ToolTipText: " << m_ToolTipText
|
||||
<< endl << " m_KbfxHoverButtonPath: " << m_KbfxHoverButtonPath
|
||||
<< endl << " m_KbfxPressedButtonPath: " << m_KbfxPressedButtonPath
|
||||
<< endl << " m_pluginsLeft: " << m_pluginsLeft
|
||||
<< endl << " m_pluginsRight: " << m_pluginsRight
|
||||
<< endl << " m_KbfxHistory: " << m_KbfxHistory
|
||||
<< endl;
|
||||
*/
|
||||
|
||||
delete confskel;
|
||||
|
||||
readFontrc ( m_SpinxThemeBasePath, m_SpinxThemeName );
|
||||
readThemerc ( m_SpinxThemeBasePath, m_SpinxThemeName );
|
||||
|
||||
if ( m_KbfxGeneralVersion < m_KbfxGeneralVersionDefault )
|
||||
{
|
||||
m_KbfxGeneralVersion = m_KbfxGeneralVersionDefault;
|
||||
m_KbfxDeleteOldConf = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxConfig::readFontrc ( QString & themePath, QString & themeName, bool user_rc )
|
||||
{
|
||||
setFontsDefault();
|
||||
|
||||
/* if a new version use default theme fonts */
|
||||
if ( m_KbfxGeneralVersion < m_KbfxGeneralVersionDefault )
|
||||
{
|
||||
themePath = m_SpinxThemeBasePathDefault;
|
||||
themeName = m_SpinxThemeNameDefault;
|
||||
}
|
||||
/* get some font settings from theme file or from theme section */
|
||||
QString _abs_path = "";
|
||||
QFileInfo * info = new QFileInfo ( themePath + themeName + "/kbfxfontrc" );
|
||||
QFileInfo * info_theme = new QFileInfo ( KbfxThemeRcDestination + "/" + themeName + "_fontrc" );
|
||||
KConfig * fontconfig = 0;
|
||||
|
||||
/* if theme kbfxfontrc exists, make its configuration as default values - prefer users' configuration */
|
||||
if ( info_theme->exists() == TRUE || info->exists() == TRUE )
|
||||
{
|
||||
if ( info_theme->exists() == TRUE && m_KbfxGeneralVersion >= m_KbfxGeneralVersionDefault && user_rc )
|
||||
{
|
||||
_abs_path = info_theme->absFilePath();
|
||||
}
|
||||
else if ( info->exists() == TRUE || m_KbfxGeneralVersion < m_KbfxGeneralVersionDefault )
|
||||
{
|
||||
_abs_path = info->absFilePath();
|
||||
}
|
||||
fontconfig = new KConfig ( _abs_path );
|
||||
|
||||
fontconfig->setGroup ( "Fonts" );
|
||||
m_fontTooltipColor = fontconfig->readColorEntry ( "TooltipText", &m_fontTooltipColorDefault );
|
||||
m_fontTooltipFont = fontconfig->readFontEntry ( "TooltipTextFont", &m_fontTooltipFontDefault );
|
||||
m_fontAppNameColor = fontconfig->readColorEntry ( "ApplicationText", &m_fontAppNameColorDefault );
|
||||
m_fontAppNameFont = fontconfig->readFontEntry ( "ApplicationTextFont", &m_fontAppNameFontDefault );
|
||||
m_fontAppCommentColor = fontconfig->readColorEntry ( "CommentText", &m_fontAppCommentColorDefault );
|
||||
m_fontAppCommentFont = fontconfig->readFontEntry ( "CommentTextFont", &m_fontAppCommentFontDefault );
|
||||
m_fontIndexColor = fontconfig->readColorEntry ( "GroupText", &m_fontIndexColorDefault );
|
||||
m_fontIndexFont = fontconfig->readFontEntry ( "GroupTextFont", &m_fontIndexFontDefault );
|
||||
m_userNameColor = fontconfig->readColorEntry ( "UserName", &m_userNameColorDefault );
|
||||
m_userNameFont = fontconfig->readFontEntry ( "UserNameFont", &m_userNameFontDefault );
|
||||
m_sepNameColor = fontconfig->readColorEntry ( "SeparatorColor", &m_sepNameColorDefault );
|
||||
m_sepNameFont = fontconfig->readFontEntry ( "SeparatorFont", &m_sepNameFontDefault );
|
||||
m_pluginNameColor = fontconfig->readColorEntry ( "PluginColor", &m_pluginNameColorDefault );
|
||||
m_pluginNameFont = fontconfig->readFontEntry ( "PluginFont", &m_pluginNameFontDefault );
|
||||
m_lineColor = fontconfig->readColorEntry ( "LineColor", &m_lineColorDefault );
|
||||
m_fontHoverBold = fontconfig->readBoolEntry ( "HoverBold",m_fontHoverBoldDefault );
|
||||
kdDebug() << "Read default font settings for theme: "
|
||||
<< themeName
|
||||
<< " from file: "
|
||||
<< _abs_path
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
kdDebug() << "Left Default Font Values for theme: "
|
||||
<< themeName
|
||||
<< endl;
|
||||
}
|
||||
|
||||
/*
|
||||
kdDebug() << "Font Values:" << endl
|
||||
<< m_fontTooltipColor << endl
|
||||
<< m_fontTooltipFont << endl
|
||||
<< m_fontAppNameColor << endl
|
||||
<< m_fontAppNameFont << endl
|
||||
<< m_fontAppCommentColor << endl
|
||||
<< m_fontAppCommentFont << endl
|
||||
<< m_fontIndexColor << endl
|
||||
<< m_fontIndexFont << endl
|
||||
<< m_userNameColor << endl
|
||||
<< m_userNameFont << endl
|
||||
<< m_sepNameColor << endl
|
||||
<< m_sepNameFont << endl
|
||||
<< m_pluginNameColor << endl
|
||||
<< m_pluginNameFont << endl
|
||||
<< m_fontHoverBold << endl
|
||||
<< m_lineColor << endl
|
||||
;
|
||||
*/
|
||||
|
||||
delete info;
|
||||
delete info_theme;
|
||||
delete fontconfig;
|
||||
}
|
||||
|
||||
void KbfxConfig::readThemerc ( QString &themePath, QString &themeName, bool user_rc )
|
||||
{
|
||||
/* if a new version use default theme layout */
|
||||
if ( m_KbfxGeneralVersion < m_KbfxGeneralVersionDefault )
|
||||
{
|
||||
themePath = m_SpinxThemeBasePathDefault;
|
||||
themeName = m_SpinxThemeNameDefault;
|
||||
}
|
||||
|
||||
/* load theme's on and off buttons if any */
|
||||
KbfxOnImg = QPixmap::QPixmap ( KbfxPlasmaPixmapProvider::PixmapPath ( "on", themePath, themeName ) );
|
||||
KbfxOffImg = QPixmap::QPixmap ( KbfxPlasmaPixmapProvider::PixmapPath ( "off", themePath, themeName ) );
|
||||
|
||||
/* use theme's default dude image if any */
|
||||
KConfigSkeleton *confskel = new KConfigSkeleton ( QString::fromLatin1 ( "kbfxrc" ) );
|
||||
KConfig *conf = confskel->config();
|
||||
QString __default = KGlobal::iconLoader()->iconPath ( "kbfx", ( int ) KIcon::Desktop, FALSE );
|
||||
|
||||
if ( m_SpinxDudeImageDefault == QString::null || !KStandardDirs::exists ( m_SpinxDudeImageDefault ) )
|
||||
{
|
||||
m_SpinxDudeImageDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "menu_top_image_person", themePath, themeName );
|
||||
}
|
||||
conf->setGroup ( "UserImage" );
|
||||
m_SpinxDudeImage = conf->readEntry ( "DudeImage", m_SpinxDudeImageDefault );
|
||||
delete confskel;
|
||||
|
||||
/* load theme's default buttons if any */
|
||||
m_KbfxNormalButtonPathDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "normal", themePath, themeName );
|
||||
m_KbfxHoverButtonPathDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "hover", themePath, themeName );
|
||||
m_KbfxPressedButtonPathDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "pressed", themePath, themeName );
|
||||
|
||||
/* load theme's default tooltip images if any */
|
||||
m_ToolTipAvatarDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "butterfly", themePath, themeName );
|
||||
m_SpinxTooltipDudeboxDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "tooltip_dudebox", themePath, themeName );
|
||||
m_SpinxTooltipMaskDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "tooltip_mask", themePath, themeName );
|
||||
m_SpinxTooltipWindowDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "tooltip_window", themePath, themeName );
|
||||
m_SpinxTooltipLogoDefault = KbfxPlasmaPixmapProvider::PixmapPath ( "tooltip_logo", themePath, themeName );
|
||||
|
||||
setThemeDefault();
|
||||
|
||||
/* get some theme layout settings from theme file or from theme section */
|
||||
QString _abs_path = "";
|
||||
QFileInfo * info = new QFileInfo ( themePath + themeName + "/kbfxlayoutrc" );
|
||||
QFileInfo * info_theme = new QFileInfo ( KbfxThemeRcDestination + "/" + themeName + "_layoutrc" );
|
||||
KConfig *layoutconfig = 0;
|
||||
|
||||
/* if theme kbfxlayoutrc exists, make its configuration as default values - prefer users' configuration */
|
||||
if ( info_theme->exists() == TRUE || info->exists() == TRUE )
|
||||
{
|
||||
if ( info_theme->exists() == TRUE && m_KbfxGeneralVersion >= m_KbfxGeneralVersionDefault && user_rc )
|
||||
{
|
||||
_abs_path = info_theme->absFilePath();
|
||||
}
|
||||
else if ( info->exists() == TRUE || m_KbfxGeneralVersion < m_KbfxGeneralVersionDefault )
|
||||
{
|
||||
_abs_path = info->absFilePath();
|
||||
}
|
||||
|
||||
layoutconfig = new KConfig ( _abs_path );
|
||||
|
||||
layoutconfig->setGroup ( "KbfxButton" );
|
||||
m_KbfxNormalButtonPath = layoutconfig->readEntry ( "Normal", m_KbfxNormalButtonPathDefault );
|
||||
m_KbfxHoverButtonPath = layoutconfig->readEntry ( "Hover", m_KbfxHoverButtonPathDefault );
|
||||
m_KbfxPressedButtonPath = layoutconfig->readEntry ( "Press", m_KbfxPressedButtonPathDefault );
|
||||
m_fadeTime = layoutconfig->readNumEntry ( "FadeTime", m_fadeTimeDefault );
|
||||
|
||||
layoutconfig->setGroup ( "ToolTip" );
|
||||
m_ToolTipAvatar = layoutconfig->readEntry ( "Avatar", m_ToolTipAvatarDefault );
|
||||
m_SpinxTooltipDudebox = layoutconfig->readEntry ( "Dudebox", m_SpinxTooltipDudeboxDefault );
|
||||
m_SpinxTooltipMask = layoutconfig->readEntry ( "Mask", m_SpinxTooltipMaskDefault );
|
||||
m_SpinxTooltipWindow = layoutconfig->readEntry ( "Window", m_SpinxTooltipWindowDefault );
|
||||
m_SpinxTooltipLogo = layoutconfig->readEntry ( "Logo", m_SpinxTooltipLogoDefault );
|
||||
|
||||
layoutconfig->setGroup ( "TopBar" );
|
||||
m_facePos_x = layoutconfig->readNumEntry ( "DudeX", m_facePos_xDefault );
|
||||
m_facePos_y = layoutconfig->readNumEntry ( "DudeY", m_facePos_yDefault );
|
||||
m_faceIconX = layoutconfig->readNumEntry ( "FaceX",m_faceIconXDefault );
|
||||
m_faceIconY = layoutconfig->readNumEntry ( "FaceY",m_faceIconYDefault );
|
||||
m_faceIconH = layoutconfig->readNumEntry ( "FaceH",m_faceIconHDefault );
|
||||
m_faceIconW = layoutconfig->readNumEntry ( "FaceW",m_faceIconWDefault );
|
||||
m_userNamePos_x = layoutconfig->readNumEntry ( "UserNameX", m_userNamePos_xDefault );
|
||||
m_userNamePos_y = layoutconfig->readNumEntry ( "UserNameY", m_userNamePos_yDefault );
|
||||
m_faceBoxHideText= layoutconfig->readBoolEntry ( "DisableUserName", m_faceBoxHideTextDefault );
|
||||
m_topBar_h = layoutconfig->readNumEntry ( "Height", m_topBar_hDefault );
|
||||
m_topBar_w = layoutconfig->readNumEntry ( "Width", m_topBar_wDefault );
|
||||
m_topBar_x = layoutconfig->readNumEntry ( "X", m_topBar_xDefault );
|
||||
m_topBar_y = layoutconfig->readNumEntry ( "Y", m_topBar_yDefault );
|
||||
|
||||
layoutconfig->setGroup ( "BottomBar" );
|
||||
m_botBar_h = layoutconfig->readNumEntry ( "Height", m_botBar_hDefault );
|
||||
m_botBar_w = layoutconfig->readNumEntry ( "Width", m_botBar_wDefault );
|
||||
m_botBar_x = layoutconfig->readNumEntry ( "X", m_botBar_xDefault );
|
||||
m_botBar_y = layoutconfig->readNumEntry ( "Y", m_botBar_yDefault );
|
||||
|
||||
layoutconfig->setGroup ( "Scrollbars" );
|
||||
m_scrollBarBotX = layoutconfig->readNumEntry ( "ScrollBarBotX", m_scrollBarBotXDefault );
|
||||
m_scrollBarBotY = layoutconfig->readNumEntry ( "ScrollBarBotY", m_scrollBarBotYDefault );
|
||||
m_scrollBarTopX = layoutconfig->readNumEntry ( "ScrollBarTopX", m_scrollBarTopXDefault );
|
||||
m_scrollBarTopY = layoutconfig->readNumEntry ( "ScrollBarTopY", m_scrollBarTopYDefault );
|
||||
|
||||
layoutconfig->setGroup ( "ListBox" );
|
||||
m_listBox_h = layoutconfig->readNumEntry ( "Height", m_listBox_hDefault );
|
||||
m_listBox_w = layoutconfig->readNumEntry ( "Width", m_listBox_wDefault );
|
||||
m_listBox_x = layoutconfig->readNumEntry ( "X", m_listBox_xDefault );
|
||||
m_listBox_y = layoutconfig->readNumEntry ( "Y", m_listBox_yDefault );
|
||||
|
||||
layoutconfig->setGroup ( "SearchBox" );
|
||||
m_searchBox_h = layoutconfig->readNumEntry ( "Height", m_searchBox_hDefault );
|
||||
m_searchBox_w = layoutconfig->readNumEntry ( "Width", m_searchBox_wDefault );
|
||||
m_searchBox_x = layoutconfig->readNumEntry ( "X", m_searchBox_xDefault );
|
||||
m_searchBox_y = layoutconfig->readNumEntry ( "Y", m_searchBox_yDefault );
|
||||
m_searchBox_static = layoutconfig->readBoolEntry ( "FixedPos", m_searchBox_staticDefault );
|
||||
|
||||
layoutconfig->setGroup ( "ItemView" );
|
||||
m_itemView_h = layoutconfig->readNumEntry ( "Height", m_itemView_hDefault );
|
||||
m_itemView_w = layoutconfig->readNumEntry ( "Width", m_itemView_wDefault );
|
||||
m_itemView_x = layoutconfig->readNumEntry ( "X", m_itemView_xDefault );
|
||||
m_itemView_y = layoutconfig->readNumEntry ( "Y", m_itemView_yDefault );
|
||||
|
||||
layoutconfig->setGroup ( "ToolBar" );
|
||||
m_toolBarButtonNormalSize = layoutconfig->readNumEntry ( "ButtonNormalSize", m_toolBarButtonNormalSizeDefault );
|
||||
m_toolBarButtonExpandSize = layoutconfig->readNumEntry ( "ButtonPressedSize", m_toolBarButtonExpandSizeDefault );
|
||||
|
||||
layoutconfig->setGroup ( "MainMenu" );
|
||||
m_userMenuHeight = layoutconfig->readNumEntry ( "UserMenuHeight",m_userMenuHeightDefault );
|
||||
m_userMenuWidth = layoutconfig->readNumEntry ( "UserMenuWidth",m_userMenuWidthDefault );
|
||||
m_startHidden = layoutconfig->readBoolEntry ( "ContractedMenu", m_startHiddenDefault );
|
||||
|
||||
layoutconfig->setGroup ( "ItemProperties" );
|
||||
m_noComments = layoutconfig->readBoolEntry ( "NoComments",m_noCommentsDefault );
|
||||
m_commentMargine = layoutconfig->readNumEntry ( "CommentMargin",m_commentMargineDefault );
|
||||
m_iconSize = layoutconfig->readNumEntry ( "IconSize",m_iconSizeDefault );
|
||||
|
||||
kdDebug() << "Read default layout settings for theme: "
|
||||
<< themeName
|
||||
<< " from file: "
|
||||
<< _abs_path
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
kdDebug() << "Left Default Layout Values for theme: "
|
||||
<< themeName
|
||||
<< endl;
|
||||
}
|
||||
|
||||
/*
|
||||
kdDebug() << " m_KbfxNormalButtonPath: " << m_KbfxNormalButtonPath
|
||||
<< endl << " m_KbfxHoverButtonPath: " << m_KbfxHoverButtonPath
|
||||
<< endl << " m_KbfxPressedButtonPath: " << m_KbfxPressedButtonPath
|
||||
<< endl << " m_fadeTime: " << m_fadeTime
|
||||
<< endl << " m_SpinxDudeImage: " << m_SpinxDudeImage
|
||||
<< endl << " m_ToolTipAvatar: " << m_ToolTipAvatar
|
||||
<< endl << " m_SpinxTooltipDudebox: " << m_SpinxTooltipDudebox
|
||||
<< endl << " m_SpinxTooltipMask: " << m_SpinxTooltipMask
|
||||
<< endl << " m_SpinxTooltipWindow: " << m_SpinxTooltipWindow
|
||||
<< endl << " m_SpinxTooltipLogo: " << m_SpinxTooltipLogo
|
||||
<< endl << " m_facePos_x: " << m_facePos_x
|
||||
<< endl << " m_facePos_y: " << m_facePos_y
|
||||
<< endl << " m_faceIconX: " << m_faceIconX
|
||||
<< endl << " m_faceIconY: " << m_faceIconY
|
||||
<< endl << " m_faceIconH: " << m_faceIconH
|
||||
<< endl << " m_faceIconW: " << m_faceIconW
|
||||
<< endl << " m_userNamePos_x: " << m_userNamePos_x
|
||||
<< endl << " m_userNamePos_y: " << m_userNamePos_y
|
||||
<< endl << " m_faceBoxHideText: " << m_faceBoxHideText
|
||||
<< endl << " m_topBar_x: " << m_topBar_x
|
||||
<< endl << " m_topBar_y: " << m_topBar_y
|
||||
<< endl << " m_topBar_h: " << m_topBar_h
|
||||
<< endl << " m_topBar_w: " << m_topBar_w
|
||||
<< endl << " m_botBar_x: " << m_botBar_x
|
||||
<< endl << " m_botBar_y: " << m_botBar_y
|
||||
<< endl << " m_botBar_h: " << m_botBar_h
|
||||
<< endl << " m_botBar_w: " << m_botBar_w
|
||||
<< endl << " m_scrollBarBotY: " << m_scrollBarBotY
|
||||
<< endl << " m_scrollBarBotX: " << m_scrollBarBotX
|
||||
<< endl << " m_scrollBarTopX: " << m_scrollBarTopX
|
||||
<< endl << " m_scrollBarTopY: " << m_scrollBarTopY
|
||||
<< endl << " m_listBox_x: " << m_listBox_x
|
||||
<< endl << " m_listBox_y: " << m_listBox_y
|
||||
<< endl << " m_listBox_w: " << m_listBox_w
|
||||
<< endl << " m_listBox_h: " << m_listBox_h
|
||||
<< endl << " m_searchBox_h: " << m_searchBox_h
|
||||
<< endl << " m_searchBox_w: " << m_searchBox_w
|
||||
<< endl << " m_searchBox_x: " << m_searchBox_x
|
||||
<< endl << " m_searchBox_y: " << m_searchBox_y
|
||||
<< endl << " m_searchBox_static: " << m_searchBox_static
|
||||
<< endl << " m_itemView_h: " << m_itemView_h
|
||||
<< endl << " m_itemView_w: " << m_itemView_w
|
||||
<< endl << " m_itemView_x: " << m_itemView_x
|
||||
<< endl << " m_itemView_y: " << m_itemView_y
|
||||
<< endl << " m_toolBarButtonNormalSize: " << m_toolBarButtonNormalSize
|
||||
<< endl << " m_toolBarButtonExpandSize: " << m_toolBarButtonExpandSize
|
||||
<< endl << " m_userMenuHeight: " << m_userMenuHeight
|
||||
<< endl << " m_userMenuWidth: " << m_userMenuHeight
|
||||
<< endl << " m_startHidden: " << m_startHidden
|
||||
<< endl << " m_noComments: " << m_noComments
|
||||
<< endl << " m_commentMargine: " << m_commentMargine
|
||||
<< endl << " m_iconSize: " << m_iconSize
|
||||
<< endl;
|
||||
*/
|
||||
|
||||
checkValues();
|
||||
|
||||
delete info;
|
||||
delete info_theme;
|
||||
delete layoutconfig;
|
||||
}
|
||||
|
||||
void KbfxConfig::write()
|
||||
{
|
||||
if ( m_KbfxDeleteOldConf && KbfxRcPath != QString::null )
|
||||
{
|
||||
QFile::remove ( KbfxRcPath );
|
||||
kdDebug() << "Deleting general RC file: " << KbfxRcPath << endl;
|
||||
}
|
||||
|
||||
KConfigSkeleton *confskel = new KConfigSkeleton ( QString::fromLatin1 ( "kbfxrc" ) );
|
||||
|
||||
/* write general KBFX configuration options */
|
||||
KConfig *conf = confskel->config();
|
||||
|
||||
conf->setGroup ( "KDE Action Restrictions" );
|
||||
conf->writeEntry ( "warn_unwritable_config", FALSE );
|
||||
|
||||
conf->setGroup ( "KbfxGeneral" );
|
||||
conf->writeEntry ( "Version", m_KbfxGeneralVersion );
|
||||
conf->writeEntry ( "MenuType", m_KbfxMenuType );
|
||||
conf->writeEntry ( "ToolBarResize", m_ToolBarResize );
|
||||
conf->writeEntry ( "KbfxWatcher", m_KbfxWatcher );
|
||||
conf->writeEntry ( "KbfxShowOld", m_KbfxShowOldThemes );
|
||||
|
||||
conf->setGroup ( "SpinxTheme" );
|
||||
conf->writeEntry ( "UserThemePath", m_UserSpinxThemeBasePath );
|
||||
conf->writeEntry ( "ThemeName", m_SpinxThemeName );
|
||||
conf->writeEntry ( "ThemePath", m_SpinxThemeBasePath );
|
||||
|
||||
conf->setGroup ( "UserImage" );
|
||||
conf->writeEntry ( "DudeBlink", m_SpinxDudeBlink );
|
||||
conf->writeEntry ( "DudeImage", m_SpinxDudeImage );
|
||||
|
||||
conf->setGroup ( "ToolTip" );
|
||||
conf->writeEntry ( "EnableToolTip", m_ToolTip );
|
||||
conf->writeEntry ( "AnimatedTooltip", m_ToolTipAnimation );
|
||||
conf->writeEntry ( "ToolTipText", m_ToolTipText );
|
||||
|
||||
conf->setGroup ( "Plugins" );
|
||||
conf->writeEntry ( "LoadedPluginsLeft", m_pluginsLeft );
|
||||
conf->writeEntry ( "LoadedPluginsRight", m_pluginsRight );
|
||||
|
||||
conf->setGroup ( "Runtime" );
|
||||
conf->writeEntry ( "History", m_KbfxHistory );
|
||||
|
||||
conf->sync();
|
||||
|
||||
delete confskel;
|
||||
}
|
||||
|
||||
void KbfxConfig::writeFontrc ( QString & themeName )
|
||||
{
|
||||
/* write fonts KBFX configuration from theme name */
|
||||
KConfig *fontconfig = new KConfig ( KbfxThemeRcDestination + "/" + themeName + "_fontrc" );
|
||||
|
||||
fontconfig->setGroup ( "Fonts" );
|
||||
fontconfig->writeEntry ( "TooltipText", m_fontTooltipColor );
|
||||
fontconfig->writeEntry ( "TooltipTextFont", m_fontTooltipFont );
|
||||
fontconfig->writeEntry ( "ApplicationText", m_fontAppNameColor );
|
||||
fontconfig->writeEntry ( "ApplicationTextFont", m_fontAppNameFont );
|
||||
fontconfig->writeEntry ( "CommentText", m_fontAppCommentColor );
|
||||
fontconfig->writeEntry ( "CommentTextFont", m_fontAppCommentFont );
|
||||
fontconfig->writeEntry ( "GroupText", m_fontIndexColor );
|
||||
fontconfig->writeEntry ( "GroupTextFont", m_fontIndexFont );
|
||||
fontconfig->writeEntry ( "UserName", m_userNameColor );
|
||||
fontconfig->writeEntry ( "UserNameFont", m_userNameFont );
|
||||
fontconfig->writeEntry ( "SeparatorColor", m_sepNameColor );
|
||||
fontconfig->writeEntry ( "SeparatorFont", m_sepNameFont );
|
||||
fontconfig->writeEntry ( "PluginColor", m_pluginNameColor );
|
||||
fontconfig->writeEntry ( "PluginFont", m_pluginNameFont );
|
||||
fontconfig->writeEntry ( "LineColor", m_lineColor );
|
||||
fontconfig->writeEntry ( "HoverBold",m_fontHoverBold );
|
||||
fontconfig->sync();
|
||||
|
||||
delete fontconfig;
|
||||
}
|
||||
|
||||
void KbfxConfig::writeThemerc ( QString & themeName )
|
||||
{
|
||||
checkValues();
|
||||
|
||||
/* write layout theme configuration from theme name */
|
||||
KConfig *layoutconfig = new KConfig ( KbfxThemeRcDestination + "/" + themeName + "_layoutrc" );
|
||||
|
||||
layoutconfig->setGroup ( "KbfxButton" );
|
||||
layoutconfig->writeEntry ( "Normal", m_KbfxNormalButtonPath );
|
||||
layoutconfig->writeEntry ( "Hover", m_KbfxHoverButtonPath );
|
||||
layoutconfig->writeEntry ( "Press", m_KbfxPressedButtonPath );
|
||||
layoutconfig->writeEntry ( "FadeTime", m_fadeTime );
|
||||
|
||||
layoutconfig->setGroup ( "ToolTip" );
|
||||
layoutconfig->writeEntry ( "Avatar", m_ToolTipAvatar );
|
||||
layoutconfig->writeEntry ( "Dudebox", m_SpinxTooltipDudebox );
|
||||
layoutconfig->writeEntry ( "Mask", m_SpinxTooltipMask );
|
||||
layoutconfig->writeEntry ( "Window", m_SpinxTooltipWindow );
|
||||
layoutconfig->writeEntry ( "Logo", m_SpinxTooltipLogo );
|
||||
|
||||
layoutconfig->setGroup ( "TopBar" );
|
||||
layoutconfig->writeEntry ( "DudeX", m_facePos_x );
|
||||
layoutconfig->writeEntry ( "DudeY", m_facePos_y );
|
||||
layoutconfig->writeEntry ( "FaceX",m_faceIconX );
|
||||
layoutconfig->writeEntry ( "FaceY",m_faceIconY );
|
||||
layoutconfig->writeEntry ( "FaceH",m_faceIconH );
|
||||
layoutconfig->writeEntry ( "FaceW",m_faceIconW );
|
||||
layoutconfig->writeEntry ( "UserNameX", m_userNamePos_x );
|
||||
layoutconfig->writeEntry ( "UserNameY", m_userNamePos_y );
|
||||
layoutconfig->writeEntry ( "DisableUserName", m_faceBoxHideText );
|
||||
layoutconfig->writeEntry ( "Height", m_topBar_h );
|
||||
layoutconfig->writeEntry ( "Width", m_topBar_w );
|
||||
layoutconfig->writeEntry ( "X", m_topBar_x );
|
||||
layoutconfig->writeEntry ( "Y", m_topBar_y );
|
||||
|
||||
layoutconfig->setGroup ( "BottomBar" );
|
||||
layoutconfig->writeEntry ( "Height", m_botBar_h );
|
||||
layoutconfig->writeEntry ( "Width", m_botBar_w );
|
||||
layoutconfig->writeEntry ( "X", m_botBar_x );
|
||||
layoutconfig->writeEntry ( "Y", m_botBar_y );
|
||||
|
||||
layoutconfig->setGroup ( "Scrollbars" );
|
||||
layoutconfig->writeEntry ( "ScrollBarBotX", m_scrollBarBotX );
|
||||
layoutconfig->writeEntry ( "ScrollBarBotY", m_scrollBarBotY );
|
||||
layoutconfig->writeEntry ( "ScrollBarTopX", m_scrollBarTopX );
|
||||
layoutconfig->writeEntry ( "ScrollBarTopY", m_scrollBarTopY );
|
||||
|
||||
layoutconfig->setGroup ( "ListBox" );
|
||||
layoutconfig->writeEntry ( "Height", m_listBox_h );
|
||||
layoutconfig->writeEntry ( "Width", m_listBox_w );
|
||||
layoutconfig->writeEntry ( "X", m_listBox_x );
|
||||
layoutconfig->writeEntry ( "Y", m_listBox_y );
|
||||
|
||||
layoutconfig->setGroup ( "SearchBox" );
|
||||
layoutconfig->writeEntry ( "Height", m_searchBox_h );
|
||||
layoutconfig->writeEntry ( "Width", m_searchBox_w );
|
||||
layoutconfig->writeEntry ( "X", m_searchBox_x );
|
||||
layoutconfig->writeEntry ( "Y", m_searchBox_y );
|
||||
layoutconfig->writeEntry ( "FixedPos", m_searchBox_static );
|
||||
|
||||
layoutconfig->setGroup ( "ItemView" );
|
||||
layoutconfig->writeEntry ( "Height", m_itemView_h );
|
||||
layoutconfig->writeEntry ( "Width", m_itemView_w );
|
||||
layoutconfig->writeEntry ( "X", m_itemView_x );
|
||||
layoutconfig->writeEntry ( "Y", m_itemView_y );
|
||||
|
||||
layoutconfig->setGroup ( "ToolBar" );
|
||||
layoutconfig->writeEntry ( "ButtonNormalSize", m_toolBarButtonNormalSize );
|
||||
layoutconfig->writeEntry ( "ButtonPressedSize", m_toolBarButtonExpandSize );
|
||||
|
||||
layoutconfig->setGroup ( "MainMenu" );
|
||||
layoutconfig->writeEntry ( "UserMenuHeight",m_userMenuHeight );
|
||||
layoutconfig->writeEntry ( "UserMenuWidth",m_userMenuWidth );
|
||||
layoutconfig->writeEntry ( "ContractedMenu", m_startHidden );
|
||||
|
||||
layoutconfig->setGroup ( "ItemProperties" );
|
||||
layoutconfig->writeEntry ( "NoComments",m_noComments );
|
||||
layoutconfig->writeEntry ( "CommentMargin",m_commentMargine );
|
||||
layoutconfig->writeEntry ( "IconSize",m_iconSize );
|
||||
|
||||
layoutconfig->sync();
|
||||
|
||||
delete layoutconfig;
|
||||
}
|
||||
|
||||
void KbfxConfig::checkValues()
|
||||
{
|
||||
/* Protect some of the values */
|
||||
m_fadeTime = ( m_fadeTime == 0 ) ? m_fadeTime: ( m_fadeTime < 20 ) ? 20: ( m_fadeTime > 1000 ) ? 1000: m_fadeTime;
|
||||
}
|
@ -0,0 +1,295 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_CONFIG_H
|
||||
#define KBFX_CONFIG_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qfile.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qfont.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kconfigskeleton.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kuser.h>
|
||||
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
class KbfxConfig
|
||||
{
|
||||
public:
|
||||
void read();
|
||||
void readFontrc ( QString &themePath, QString &themeName, bool user_rc=TRUE );
|
||||
void readThemerc ( QString &themePath, QString &themeName, bool user_rc=TRUE );
|
||||
void readThemeInfo ( QString &themePath, QString &themeName );
|
||||
void setDefault();
|
||||
void setThemeDefault();
|
||||
void setFontsDefault();
|
||||
void setThemeInfoDefault();
|
||||
void write();
|
||||
void writeFontrc ( QString &themeName );
|
||||
void writeThemerc ( QString &themeName );
|
||||
void checkValues();
|
||||
|
||||
/* Theme info resources */
|
||||
QString m_InfoVersion;
|
||||
QString m_InfoVersionDefault;
|
||||
QString m_InfoAuthor;
|
||||
QString m_InfoAuthorDefault;
|
||||
QString m_InfoEmail;
|
||||
QString m_InfoEmailDefault;
|
||||
QString m_InfoUrl;
|
||||
QString m_InfoUrlDefault;
|
||||
|
||||
/* kbfx_menu_button config items list */
|
||||
QString m_KbfxThemesVersion;
|
||||
QString KbfxThemeRcDestination;
|
||||
QString KbfxRcPath;
|
||||
QPixmap KbfxOnImg;
|
||||
QPixmap KbfxOffImg;
|
||||
int m_KbfxGeneralVersion;
|
||||
int m_KbfxGeneralVersionDefault;
|
||||
QString m_KbfxNormalButtonPath;
|
||||
QString m_KbfxNormalButtonPathDefault;
|
||||
QString m_KbfxHoverButtonPath;
|
||||
QString m_KbfxHoverButtonPathDefault;
|
||||
QString m_KbfxPressedButtonPath;
|
||||
QString m_KbfxPressedButtonPathDefault;
|
||||
QString m_KbfxMouseOverAnimationPath;
|
||||
QString m_KbfxMouseOverAnimationPathDefault;
|
||||
QColor m_KbfxButtonColor;
|
||||
QColor m_KbfxButtonColorDefault;
|
||||
int m_KbfxButtonSize;
|
||||
int m_KbfxButtonSizeDefault;
|
||||
bool m_KbfxButtonGlow;
|
||||
bool m_KbfxButtonGlowDefault;
|
||||
bool m_KbfxButtonKikerResize;
|
||||
bool m_KbfxButtonKikerResizeDefault;
|
||||
QString m_KbfxMenuType;
|
||||
QString m_KbfxMenuTypeDefault;
|
||||
|
||||
/* spinx config items list */
|
||||
QString m_SpinxThemeBasePath;
|
||||
QString m_SpinxThemeBasePathDefault;
|
||||
QString m_UserSpinxThemeBasePath;
|
||||
QString m_UserSpinxThemeBasePathDefault;
|
||||
bool m_SpinxDudeBlink;
|
||||
bool m_SpinxDudeBlinkDefault;
|
||||
QString m_SpinxDudeImage;
|
||||
QString m_SpinxDudeImageDefault;
|
||||
QString m_SpinxThemeName;
|
||||
QString m_SpinxThemeNameDefault;
|
||||
bool m_ToolBarResize;
|
||||
bool m_ToolBarResizeDefault;
|
||||
bool m_KbfxWatcher;
|
||||
bool m_KbfxWatcherDefault;
|
||||
bool m_KbfxShowOldThemes;
|
||||
bool m_KbfxShowOldThemesDefault;
|
||||
|
||||
|
||||
/* tooltip options list */
|
||||
bool m_ToolTipAnimation;
|
||||
bool m_ToolTipAnimationDefault;
|
||||
bool m_ToolTip;
|
||||
bool m_ToolTipDefault;
|
||||
QString m_ToolTipText;
|
||||
QString m_ToolTipTextDefault;
|
||||
QString m_ToolTipAvatar;
|
||||
QString m_ToolTipAvatarDefault;
|
||||
QString m_SpinxTooltipDudebox;
|
||||
QString m_SpinxTooltipDudeboxDefault;
|
||||
QString m_SpinxTooltipMask;
|
||||
QString m_SpinxTooltipMaskDefault;
|
||||
QString m_SpinxTooltipWindow;
|
||||
QString m_SpinxTooltipWindowDefault;
|
||||
QString m_SpinxTooltipLogo;
|
||||
QString m_SpinxTooltipLogoDefault;
|
||||
|
||||
QString m_KbfxHistory;
|
||||
QString m_KbfxHistoryDefault;
|
||||
|
||||
/* font settings */
|
||||
QColor m_fontTooltipColor;
|
||||
QColor m_fontTooltipColorDefault;
|
||||
QFont m_fontTooltipFont;
|
||||
QFont m_fontTooltipFontDefault;
|
||||
QColor m_fontAppNameColor;
|
||||
QColor m_fontAppNameColorDefault;
|
||||
QFont m_fontAppNameFont;
|
||||
QFont m_fontAppNameFontDefault;
|
||||
QColor m_fontAppCommentColor;
|
||||
QColor m_fontAppCommentColorDefault;
|
||||
QFont m_fontAppCommentFont;
|
||||
QFont m_fontAppCommentFontDefault;
|
||||
QColor m_lineColor;
|
||||
QColor m_lineColorDefault;
|
||||
QColor m_fontIndexColor;
|
||||
QColor m_fontIndexColorDefault;
|
||||
QFont m_fontIndexFont;
|
||||
QFont m_fontIndexFontDefault;
|
||||
QColor m_userImageColor;
|
||||
QColor m_userImageColorDefault;
|
||||
QColor m_userNameColor;
|
||||
QColor m_userNameColorDefault;
|
||||
QFont m_userNameFont;
|
||||
QFont m_userNameFontDefault;
|
||||
QColor m_sepNameColor;
|
||||
QColor m_sepNameColorDefault;
|
||||
QFont m_sepNameFont;
|
||||
QFont m_sepNameFontDefault;
|
||||
QColor m_pluginNameColor;
|
||||
QColor m_pluginNameColorDefault;
|
||||
QFont m_pluginNameFont;
|
||||
QFont m_pluginNameFontDefault;
|
||||
bool m_fontHoverBold;
|
||||
bool m_fontHoverBoldDefault;
|
||||
|
||||
/* history */
|
||||
QStringList m_pluginsLeft;
|
||||
QStringList m_pluginsLeftDefault;
|
||||
QStringList m_pluginsRight;
|
||||
QStringList m_pluginsRightDefault;
|
||||
|
||||
/* layout */
|
||||
int m_facePos_x;
|
||||
int m_facePos_xDefault;
|
||||
int m_facePos_y;
|
||||
int m_facePos_yDefault;
|
||||
int m_userNamePos_x;
|
||||
int m_userNamePos_xDefault;
|
||||
int m_userNamePos_y;
|
||||
int m_userNamePos_yDefault;
|
||||
bool m_faceBoxHideText;
|
||||
bool m_faceBoxHideTextDefault;
|
||||
int m_userMenuHeight;
|
||||
int m_userMenuHeightDefault;
|
||||
int m_userMenuWidth;
|
||||
int m_userMenuWidthDefault;
|
||||
|
||||
int m_topBar_x;
|
||||
int m_topBar_xDefault;
|
||||
int m_topBar_y;
|
||||
int m_topBar_yDefault;
|
||||
int m_topBar_h;
|
||||
int m_topBar_hDefault;
|
||||
int m_topBar_w;
|
||||
int m_topBar_wDefault;
|
||||
|
||||
int m_botBar_x;
|
||||
int m_botBar_xDefault;
|
||||
int m_botBar_y;
|
||||
int m_botBar_yDefault;
|
||||
int m_botBar_h;
|
||||
int m_botBar_hDefault;
|
||||
int m_botBar_w;
|
||||
int m_botBar_wDefault;
|
||||
|
||||
int m_scrollBarTopX;
|
||||
int m_scrollBarTopXDefault;
|
||||
int m_scrollBarTopY;
|
||||
int m_scrollBarTopYDefault;
|
||||
int m_scrollBarBotX;
|
||||
int m_scrollBarBotXDefault;
|
||||
int m_scrollBarBotY;
|
||||
int m_scrollBarBotYDefault;
|
||||
|
||||
int m_listBox_x;
|
||||
int m_listBox_xDefault;
|
||||
int m_listBox_y;
|
||||
int m_listBox_yDefault;
|
||||
int m_listBox_w;
|
||||
int m_listBox_wDefault;
|
||||
int m_listBox_h;
|
||||
int m_listBox_hDefault;
|
||||
|
||||
int m_searchBox_x;
|
||||
int m_searchBox_xDefault;
|
||||
int m_searchBox_y;
|
||||
int m_searchBox_yDefault;
|
||||
int m_searchBox_w;
|
||||
int m_searchBox_wDefault;
|
||||
int m_searchBox_h;
|
||||
int m_searchBox_hDefault;
|
||||
bool m_searchBox_static;
|
||||
bool m_searchBox_staticDefault;
|
||||
|
||||
int m_itemView_x;
|
||||
int m_itemView_xDefault;
|
||||
int m_itemView_y;
|
||||
int m_itemView_yDefault;
|
||||
int m_itemView_h;
|
||||
int m_itemView_hDefault;
|
||||
int m_itemView_w;
|
||||
int m_itemView_wDefault;
|
||||
|
||||
int m_fadeTime;
|
||||
int m_fadeTimeDefault;
|
||||
|
||||
/* toolbar */
|
||||
int m_toolBarButtonNormalSizeDefault;
|
||||
int m_toolBarButtonNormalSize;
|
||||
int m_toolBarButtonExpandSizeDefault;
|
||||
int m_toolBarButtonExpandSize;
|
||||
|
||||
/* Face Icon */
|
||||
int m_faceIconX;
|
||||
int m_faceIconXDefault;
|
||||
int m_faceIconY;
|
||||
int m_faceIconYDefault;
|
||||
int m_faceIconH;
|
||||
int m_faceIconHDefault;
|
||||
int m_faceIconW;
|
||||
int m_faceIconWDefault;
|
||||
|
||||
/* element controll */
|
||||
int m_iconSize;
|
||||
int m_iconSizeDefault;
|
||||
bool m_noComments;
|
||||
bool m_noCommentsDefault;
|
||||
int m_commentMargine;
|
||||
int m_commentMargineDefault;
|
||||
/* states */
|
||||
bool m_startHidden;
|
||||
bool m_startHiddenDefault;
|
||||
|
||||
bool m_KbfxDeleteOldConf;
|
||||
|
||||
private:
|
||||
KbfxConfig();
|
||||
KbfxConfig ( const KbfxConfig& );
|
||||
|
||||
friend KbfxConfig& ConfigInit();
|
||||
};
|
||||
|
||||
KbfxConfig & ConfigInit();
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,79 @@
|
||||
//**************************************************************************
|
||||
// Copyright (C) 2004, 2005 by Petri Damstén
|
||||
// petri.damsten@iki.fi
|
||||
//
|
||||
// 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) any later version.
|
||||
//
|
||||
// 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 "kbfxfontchooser.h"
|
||||
|
||||
KBFXFontChooser::KBFXFontChooser ( QWidget *parent, const char *name )
|
||||
: QWidget ( parent, name )
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout ( this, 0, KDialog::spacingHint() );
|
||||
|
||||
m_label = new QLabel ( this, "fontLabel" );
|
||||
m_label->setSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Fixed, TRUE);
|
||||
// m_label->setFrameShape ( QFrame::StyledPanel );
|
||||
// m_label->setFrameShadow ( QFrame::Sunken );
|
||||
|
||||
layout->addWidget ( m_label );
|
||||
|
||||
m_button = new QPushButton ( this, "fontButton" );
|
||||
m_label->setMaximumHeight ( m_button -> height() );
|
||||
m_label->setMinimumHeight ( m_button -> height() );
|
||||
QString fontText = i18n ( "Font..." );
|
||||
// m_button->setSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Minimum, TRUE);
|
||||
m_button->setText ( fontText );
|
||||
QIconSet iconSet = SmallIconSet ( QString::fromLatin1 ( "fonts" ) );
|
||||
QPixmap pixmap = iconSet.pixmap ( QIconSet::Small, QIconSet::Normal );
|
||||
m_button->setIconSet ( iconSet );
|
||||
m_button->setFixedWidth ( m_button->fontMetrics().width ( fontText ) +
|
||||
3 * KDialog::spacingHint() + pixmap.width() );
|
||||
layout->addWidget ( m_button );
|
||||
|
||||
connect ( m_button, SIGNAL ( clicked() ), this, SLOT ( buttonClicked() ) );
|
||||
|
||||
updateFontLabel();
|
||||
|
||||
setFocusProxy ( m_button );
|
||||
}
|
||||
|
||||
KBFXFontChooser::~KBFXFontChooser()
|
||||
{}
|
||||
|
||||
void KBFXFontChooser::setFont ( const QFont& font )
|
||||
{
|
||||
m_font = font;
|
||||
updateFontLabel();
|
||||
}
|
||||
|
||||
void KBFXFontChooser::updateFontLabel()
|
||||
{
|
||||
QString s = QString ( "%1 (%2pt) " ).arg ( m_font.family() ).arg ( m_font.pointSize() );
|
||||
m_label->setFont ( m_font );
|
||||
m_label->setText ( s );
|
||||
m_label->setAlignment ( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
emit FontChanged();
|
||||
}
|
||||
|
||||
void KBFXFontChooser::buttonClicked()
|
||||
{
|
||||
KFontDialog::getFont ( m_font );
|
||||
updateFontLabel();
|
||||
}
|
||||
|
||||
#include "kbfxfontchooser.moc"
|
@ -0,0 +1,70 @@
|
||||
//**************************************************************************
|
||||
// Copyright (C) 2004, 2005 by Petri Damstén
|
||||
// petri.damsten@iki.fi
|
||||
//
|
||||
// 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) any later version.
|
||||
//
|
||||
// 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 KBFX_FONT_CHOOSER_H
|
||||
#define KBFX_FONT_CHOOSER_H
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <kfontdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kiconloader.h>
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qfont.h>
|
||||
#include <qsizepolicy.h>
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QFont;
|
||||
|
||||
/**
|
||||
@author Petri Damsten <petri.damsten@iki.fi>
|
||||
*/
|
||||
|
||||
class KBFXFontChooser : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY ( QFont font READ font WRITE setFont )
|
||||
public:
|
||||
KBFXFontChooser ( QWidget *parent = 0, const char *name = 0 );
|
||||
~KBFXFontChooser();
|
||||
|
||||
QFont font() const { return m_font; };
|
||||
|
||||
public slots:
|
||||
void setFont ( const QFont& font );
|
||||
|
||||
protected:
|
||||
void updateFontLabel();
|
||||
|
||||
protected slots:
|
||||
void buttonClicked();
|
||||
|
||||
private:
|
||||
QFont m_font;
|
||||
QLabel* m_label;
|
||||
QPushButton* m_button;
|
||||
|
||||
signals:
|
||||
void FontChanged();
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxkiodownload.h"
|
||||
|
||||
KbfxKioDownload::KbfxKioDownload ( QObject *parent, const char *name )
|
||||
: QObject ( parent, name )
|
||||
{
|
||||
m_KbfxBrowserError = 0;
|
||||
m_KbfxBrowserErrorText = "No error";
|
||||
m_KbfxBrowserTmpFile = tmpF.name();
|
||||
|
||||
kdDebug() << "Created temp file for download transfer: "
|
||||
<< m_KbfxBrowserTmpFile
|
||||
<< endl;
|
||||
}
|
||||
|
||||
KbfxKioDownload::~KbfxKioDownload()
|
||||
{}
|
||||
|
||||
void KbfxKioDownload::KbfxKioDownloadStart ( QString &url )
|
||||
{
|
||||
KIO::Job *download_job = KIO::file_copy ( KURL ( url ),
|
||||
KURL ( m_KbfxBrowserTmpFile ),
|
||||
-1,
|
||||
TRUE );
|
||||
connect ( download_job, SIGNAL ( result ( KIO::Job* ) ),
|
||||
this, SLOT ( KbfxBrowserResult ( KIO::Job * ) ) );
|
||||
}
|
||||
|
||||
void KbfxKioDownload::KbfxBrowserResult ( KIO::Job *download_job )
|
||||
{
|
||||
m_KbfxBrowserError = download_job->error();
|
||||
|
||||
if ( m_KbfxBrowserError )
|
||||
{
|
||||
KbfxKioDownloadEnd();
|
||||
m_KbfxBrowserErrorText = download_job->errorString();
|
||||
}
|
||||
else m_KbfxBrowserErrorText = "No error";
|
||||
|
||||
kdDebug() << "Download transfer error: "
|
||||
<< m_KbfxBrowserError
|
||||
<< " - "
|
||||
<< m_KbfxBrowserErrorText
|
||||
<< endl;
|
||||
|
||||
emit KbfxKioDownloadReady();
|
||||
}
|
||||
|
||||
void KbfxKioDownload::KbfxKioDownloadEnd()
|
||||
{
|
||||
kdDebug() << "Deleting temp file for download transfer: "
|
||||
<< tmpF.name()
|
||||
<<endl;
|
||||
|
||||
tmpF.unlink();
|
||||
deleteLater();
|
||||
}
|
||||
#include "kbfxkiodownload.moc"
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_KIO_DOWNLOAD_H
|
||||
#define KBFX_KIO_DOWNLOAD_H
|
||||
|
||||
#include <kio/job.h>
|
||||
#include <ktempfile.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
/**
|
||||
* @author PhobosK <phobosk@mail.kbfx.org>
|
||||
*/
|
||||
class KbfxKioDownload : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxKioDownload ( QObject * parent = 0, const char * name = 0 );
|
||||
~KbfxKioDownload();
|
||||
|
||||
/* KbfxKioDownload invocation - pass an url as QString */
|
||||
void KbfxKioDownloadStart ( QString &url );
|
||||
|
||||
/* return temp file name for the download */
|
||||
QString KbfxBrowserTmpFile() {return m_KbfxBrowserTmpFile;}
|
||||
|
||||
/* return error number occured during download
|
||||
* see definition in global.h
|
||||
*/
|
||||
int KbfxBrowserError() {return m_KbfxBrowserError;}
|
||||
|
||||
/* return error text occured during download */
|
||||
QString KbfxBrowserErrorText() {return m_KbfxBrowserErrorText;}
|
||||
|
||||
protected:
|
||||
QString m_KbfxBrowserTmpFile;
|
||||
int m_KbfxBrowserError;
|
||||
QString m_KbfxBrowserErrorText;
|
||||
|
||||
private:
|
||||
KTempFile tmpF;
|
||||
|
||||
public slots:
|
||||
/* call when you are ready to delete the temp file for the download */
|
||||
virtual void KbfxKioDownloadEnd();
|
||||
|
||||
private slots:
|
||||
/* current job is done here */
|
||||
virtual void KbfxBrowserResult ( KIO::Job * );
|
||||
|
||||
signals:
|
||||
/* emitted when the download is ready */
|
||||
void KbfxKioDownloadReady();
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxpixmaplabel.h"
|
||||
|
||||
KbfxPixmapLabel::KbfxPixmapLabel ( QWidget *parent, const char *name, WFlags fl )
|
||||
: QLabel ( parent, name, fl )
|
||||
{
|
||||
// setFrameShape(QLabel::WinPanel);
|
||||
// setFrameShadow(QLabel::Sunken);
|
||||
setFrameShape ( QLabel::LineEditPanel );
|
||||
setFrameShadow ( QLabel::Plain );
|
||||
setScaledContents ( FALSE );
|
||||
setAlignment ( int ( QLabel::WordBreak | QLabel::AlignCenter ) );
|
||||
setMouseTracking ( TRUE );
|
||||
}
|
||||
|
||||
KbfxPixmapLabel::~KbfxPixmapLabel()
|
||||
{
|
||||
}
|
||||
|
||||
/* normalize label */
|
||||
void KbfxPixmapLabel::normalize ()
|
||||
{
|
||||
setFrameShape ( QLabel::NoFrame );
|
||||
setFrameShadow ( QLabel::Plain );
|
||||
setScaledContents ( FALSE );
|
||||
setAlignment ( int ( QLabel::WordBreak | QLabel::AlignCenter ) );
|
||||
}
|
||||
|
||||
/* processing drag events over label */
|
||||
void KbfxPixmapLabel::dragEnterEvent ( QDragEnterEvent *mouseDragEnterEvent )
|
||||
{
|
||||
kdDebug() << "Accepting drag..." << endl;
|
||||
mouseDragEnterEvent->accept ( QTextDrag::canDecode ( mouseDragEnterEvent ) );
|
||||
}
|
||||
|
||||
/* processing drop events over label */
|
||||
void KbfxPixmapLabel::dropEvent ( QDropEvent *mouseDropEvent )
|
||||
{
|
||||
QString text;
|
||||
|
||||
if ( QTextDrag::decode ( mouseDropEvent,text ) )
|
||||
{
|
||||
if ( text.startsWith ( "file://" ) ) text.remove ( "file://" );
|
||||
|
||||
kdDebug() << "Dropping drag..." << text << endl;
|
||||
|
||||
emit targetDrop ( text );
|
||||
}
|
||||
}
|
||||
|
||||
/* processing mouse click events over label */
|
||||
void KbfxPixmapLabel::mousePressEvent ( QMouseEvent * e )
|
||||
{
|
||||
e->accept();
|
||||
ButtonState _btn = e->button();
|
||||
kdDebug() << "Mouse Clicked: " << _btn << endl;
|
||||
emit clicked();
|
||||
emit mouseClicked ();
|
||||
emit mouseClicked ( _btn );
|
||||
}
|
||||
|
||||
/* processing mouse double click events over label */
|
||||
void KbfxPixmapLabel::mouseDoubleClickEvent ( QMouseEvent * e )
|
||||
{
|
||||
e->accept();
|
||||
ButtonState _btn = e->button();
|
||||
kdDebug() << "Mouse Double Clicked: " << _btn << endl;
|
||||
emit mouseDoubleClicked ();
|
||||
emit mouseDoubleClicked ( _btn );
|
||||
}
|
||||
|
||||
#include "kbfxpixmaplabel.moc"
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PIXMAP_LABEL_H
|
||||
#define KBFX_PIXMAP_LABEL_H
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <kdebug.h>
|
||||
#include <qdragobject.h>
|
||||
#include <qtooltip.h>
|
||||
|
||||
class KbfxPixmapLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxPixmapLabel ( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
|
||||
~KbfxPixmapLabel ();
|
||||
|
||||
void dragEnterEvent ( QDragEnterEvent *mouseDragEnterEvent );
|
||||
void dropEvent ( QDropEvent *mouseDropEvent );
|
||||
void mousePressEvent ( QMouseEvent * e );
|
||||
void mouseDoubleClickEvent ( QMouseEvent * e );
|
||||
void normalize ();
|
||||
|
||||
signals:
|
||||
void targetDrop ( const QString & );
|
||||
void clicked();
|
||||
void mouseClicked ();
|
||||
void mouseClicked ( const ButtonState & );
|
||||
void mouseDoubleClicked ();
|
||||
void mouseDoubleClicked ( const ButtonState & );
|
||||
};
|
||||
|
||||
#endif // KBFX_PIXMAP_LABEL_H
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmapixmapprovider.h"
|
||||
|
||||
int
|
||||
KbfxPlasmaPixmapProvider::addPixmap ( QString pixmapname )
|
||||
{
|
||||
QString lFileName = PixmapPath( pixmapname );
|
||||
QPixmap * lPixmapPtr = 0;
|
||||
|
||||
if ( ( lPixmapPtr = QPixmapCache::find ( pixmapname ) ) == NULL )
|
||||
{
|
||||
lPixmapPtr = new QPixmap ( lFileName );
|
||||
QPixmapCache::insert ( pixmapname,lPixmapPtr );
|
||||
return ( lPixmapPtr->height() *lPixmapPtr->width() *lPixmapPtr->depth() ) /8;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString
|
||||
KbfxPlasmaPixmapProvider::PixmapPath ( QString pixmapName )
|
||||
{
|
||||
QString lFileName = ConfigInit ().m_SpinxThemeBasePath + ConfigInit ().m_SpinxThemeName + "/" + pixmapName + ".png";
|
||||
|
||||
if ( QPixmap::QPixmap ( lFileName ).isNull() )
|
||||
lFileName = locate ( "data", "kbfx/skins/default/" + pixmapName + ".png" );
|
||||
|
||||
return lFileName;
|
||||
}
|
||||
|
||||
QString
|
||||
KbfxPlasmaPixmapProvider::PixmapPath ( QString pixmapName, QString themePath, QString themeName )
|
||||
{
|
||||
QString lFileName = themePath + themeName + "/" + pixmapName + ".png";
|
||||
|
||||
if ( QPixmap::QPixmap ( lFileName ).isNull() )
|
||||
lFileName = locate ( "data", "kbfx/skins/default/" + pixmapName + ".png" );
|
||||
|
||||
return lFileName;
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxPlasmaPixmapProvider::PixmapPathCheck ( QString pixmapPath )
|
||||
{
|
||||
if ( QPixmap::QPixmap ( pixmapPath ).isNull() )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaPixmapProvider::deletePixmap ( const QString & key )
|
||||
{
|
||||
QPixmapCache::remove ( key );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaPixmapProvider::rebuildCache()
|
||||
{
|
||||
QPixmapCache::clear ();
|
||||
buildCache();
|
||||
}
|
||||
|
||||
void KbfxPlasmaPixmapProvider::buildCache()
|
||||
{
|
||||
//m_skinElements.append("topbg");
|
||||
QPixmapCache::setCacheLimit ( 1024*5 );
|
||||
static QStringList m_skinElements;
|
||||
m_skinElements
|
||||
<<"appfind"
|
||||
<<"bg"
|
||||
<<"botbg"
|
||||
<<"butterfly"
|
||||
<<"dudebox"
|
||||
<<"find"
|
||||
<<"hover"
|
||||
<<"indexseparator"
|
||||
<<"listboxbg"
|
||||
<<"lock"
|
||||
<<"lockhover"
|
||||
<<"logout"
|
||||
<<"logouthover"
|
||||
<<"mask"
|
||||
<<"menu_top"
|
||||
<<"menu_top_image_person"
|
||||
<<"middleboxbg"
|
||||
<<"normal"
|
||||
<<"off"
|
||||
<<"on"
|
||||
<<"pressed"
|
||||
<<"preview"
|
||||
<<"rhshovertile"
|
||||
<<"rhstile"
|
||||
<<"scrollnormal"
|
||||
<<"separator"
|
||||
<<"tabbg"
|
||||
<<"tilehover"
|
||||
<<"tilenormal"
|
||||
<<"topbg"
|
||||
<<"appviewbg"
|
||||
;
|
||||
|
||||
for ( QStringList::Iterator it = m_skinElements.begin(); it != m_skinElements.end(); ++it )
|
||||
{
|
||||
QPixmapCache::setCacheLimit ( KbfxPlasmaPixmapProvider::addPixmap ( *it ) +QPixmapCache::cacheLimit() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
QPixmap *
|
||||
KbfxPlasmaPixmapProvider::pixmap ( const QString & key )
|
||||
{
|
||||
QPixmap* pp;
|
||||
QPixmap p;
|
||||
if ( ( pp=QPixmapCache::find ( key ) ) )
|
||||
{
|
||||
return pp;
|
||||
}
|
||||
else
|
||||
{
|
||||
addPixmap ( key );
|
||||
return pixmap ( key );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_PIXMAP_PROVIDER_H
|
||||
#define KBFX_PLASMA_PIXMAP_PROVIDER_H
|
||||
|
||||
|
||||
#include <qfileinfo.h>
|
||||
#include <qpixmapcache.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
|
||||
class KbfxPlasmaPixmapProvider
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
KbfxPlasmaPixmapProvider()
|
||||
{}
|
||||
~KbfxPlasmaPixmapProvider() {}
|
||||
|
||||
static int addPixmap ( QString );
|
||||
static void deletePixmap ( const QString & );
|
||||
static void rebuildCache();
|
||||
static void buildCache();
|
||||
static QPixmap* pixmap ( const QString & );
|
||||
static QString PixmapPath ( QString, QString, QString );
|
||||
static QString PixmapPath ( QString );
|
||||
static bool PixmapPathCheck ( QString );
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxpushbutton.h"
|
||||
|
||||
KbfxPushButton::KbfxPushButton ( QWidget *parent, const char *name )
|
||||
: KPushButton ( parent, name )
|
||||
{
|
||||
setText ( "P R E V I E W" );
|
||||
setToggleButton ( TRUE );
|
||||
setFocusPolicy ( QWidget::NoFocus );
|
||||
}
|
||||
|
||||
KbfxPushButton::~KbfxPushButton()
|
||||
{
|
||||
}
|
||||
|
||||
/* process hover events */
|
||||
void KbfxPushButton::enterEvent ( QEvent * )
|
||||
{
|
||||
if ( this->state() == 0 ) this->setPixmap ( ConfigInit().m_KbfxHoverButtonPath );
|
||||
}
|
||||
|
||||
void KbfxPushButton::leaveEvent ( QEvent * )
|
||||
{
|
||||
if ( this->state() == 2 ) this->setPixmap ( ConfigInit().m_KbfxPressedButtonPath );
|
||||
if ( this->state() == 0 ) this->setPixmap ( ConfigInit().m_KbfxNormalButtonPath );
|
||||
}
|
||||
|
||||
#include "kbfxpushbutton.moc"
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PUSH_BUTTON_H
|
||||
#define KBFX_PUSH_BUTTON_H
|
||||
|
||||
#include <kpushbutton.h>
|
||||
|
||||
#include "kbfxconfig.h"
|
||||
|
||||
class KbfxPushButton: public KPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxPushButton ( QWidget *parent = 0, const char *name = 0 );
|
||||
~KbfxPushButton();
|
||||
|
||||
void enterEvent ( QEvent * );
|
||||
void leaveEvent ( QEvent * );
|
||||
};
|
||||
|
||||
#endif // KBFX_PUSH_BUTTON_H
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxthemesdata.h"
|
||||
|
||||
KbfxThemesData::KbfxThemesData()
|
||||
{}
|
||||
|
||||
KbfxThemesData::~KbfxThemesData()
|
||||
{
|
||||
m_themesMap.clear();
|
||||
}
|
||||
|
||||
ThemesMap KbfxThemesData::setThemeList ( QString path )
|
||||
{
|
||||
QString m_KbfxThemesVersion = ConfigInit().m_KbfxThemesVersion;
|
||||
bool m_KbfxShowOldThemes = ConfigInit().m_KbfxShowOldThemes;
|
||||
QFileInfo *fi=0, *f=0;
|
||||
|
||||
m_themesMap.clear();
|
||||
|
||||
KStandardDirs *tmp = new KStandardDirs();
|
||||
|
||||
/* search themes in KDE Resource Folders and append user selected folder */
|
||||
QStringList skinsFolders = tmp->findDirs ( "data", "kbfx/skins" );
|
||||
if ( tmp->exists ( path ) )
|
||||
{
|
||||
skinsFolders.append ( path );
|
||||
}
|
||||
else
|
||||
{
|
||||
kdDebug() << "KbfxThemesData: Path doesn't exist! :" << path << endl;
|
||||
}
|
||||
|
||||
for ( QStringList::Iterator skinsIt = skinsFolders.begin(); skinsIt != skinsFolders.end(); ++skinsIt )
|
||||
{
|
||||
QDir d ( *skinsIt );
|
||||
d.setFilter ( QDir::Dirs );
|
||||
|
||||
const QFileInfoList *list = d.entryInfoList();
|
||||
QFileInfoListIterator it ( *list );
|
||||
|
||||
while ( ( fi = it.current() ) != 0 )
|
||||
{
|
||||
if ( !fi->fileName().startsWith ( "." ) )
|
||||
{
|
||||
f = new QFileInfo ( d, fi->fileName() + "/" + m_KbfxThemesVersion );
|
||||
if ( m_KbfxShowOldThemes )
|
||||
{
|
||||
m_themesMap[fi->fileName() ] = ( fi->dirPath ( TRUE ) ).append ( "/" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( f->exists () )
|
||||
m_themesMap[fi->fileName() ] = ( fi->dirPath ( TRUE ) ).append ( "/" );
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
/* kdDebug() << "Available Themes - "
|
||||
* << m_themesMap.keys()
|
||||
* << m_themesMap.values()
|
||||
* << endl;
|
||||
*/
|
||||
|
||||
delete fi;
|
||||
delete f;
|
||||
delete tmp;
|
||||
return m_themesMap;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_THEMES_DATA_H
|
||||
#define KBFX_THEMES_DATA_H
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <qstringlist.h>
|
||||
#include <kio/netaccess.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <qmap.h>
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
|
||||
#include "kbfxconfig.h"
|
||||
|
||||
typedef QMap<QString, QString> ThemesMap;
|
||||
|
||||
/**
|
||||
* @author PhobosK <phobosk@mail.kbfx.org>
|
||||
*/
|
||||
class KbfxThemesData
|
||||
{
|
||||
public:
|
||||
KbfxThemesData();
|
||||
~KbfxThemesData();
|
||||
|
||||
ThemesMap setThemeList ( QString path );
|
||||
|
||||
private:
|
||||
ThemesMap m_themesMap;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,48 @@
|
||||
SET(libkbfxdatasrc
|
||||
kbfxdatagroup.cpp
|
||||
kbfxdatagrouplist.cpp
|
||||
kbfxdatasource.cpp
|
||||
kbfxdatastack.cpp
|
||||
kbfxplasmadataplugin.cpp
|
||||
kbfxplasmapluginloader.cpp
|
||||
kbfxplugin.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxdatasrc})
|
||||
|
||||
ADD_LIBRARY(kbfxdata SHARED ${libkbfxdatasrc})
|
||||
SET_TARGET_PROPERTIES(kbfxdata
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxdata PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxdata
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxdata ${LIB_INSTALL_DIR})
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxdatasrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxdata SHARED ${libkbfxdatasrc})
|
||||
TARGET_LINK_LIBRARIES(kbfxdata
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxdata ${LIB_INSTALL_DIR})
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxdata DESTINATION ${LIB_INSTALL_DIR})
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/data)
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxdatagroup.h"
|
||||
|
||||
KbfxDataGroup::KbfxDataGroup()
|
||||
{
|
||||
m_name = "Uknown Group";
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
KbfxDataGroup::~KbfxDataGroup()
|
||||
{
|
||||
Data::Iterator it;
|
||||
for ( it = m_data.begin();it!=m_data.end();++it )
|
||||
{
|
||||
delete it.data();
|
||||
m_data.remove ( it );
|
||||
//delete *it;
|
||||
}
|
||||
m_data.clear();
|
||||
}
|
||||
|
||||
KbfxDataSource::DataSourceList
|
||||
KbfxDataGroup::lookup ( QString str )
|
||||
{
|
||||
//static KbfxDataGroup * _matching = new KbfxDataGroup();
|
||||
KbfxDataSource::DataSourceList _matching;
|
||||
Data::Iterator it;
|
||||
for ( it = m_data.begin();it!=m_data.end();++it )
|
||||
{
|
||||
if ( ( *it )->lookup ( str ) == true )
|
||||
{
|
||||
_matching.prepend ( * ( *it ) );
|
||||
}
|
||||
}
|
||||
|
||||
return _matching;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxDataGroup::addItem ( KbfxDataSource * item )
|
||||
{
|
||||
if ( item == 0 )
|
||||
return ;
|
||||
m_data[item->name() ] = item;
|
||||
m_index[m_count] = item;
|
||||
m_count++;
|
||||
|
||||
// qDebug("KbfxDataGroup.cpp::addItem("+item->name()+")");
|
||||
}
|
||||
|
||||
KbfxDataSource*
|
||||
KbfxDataGroup::itemAt(int index)
|
||||
{
|
||||
if ( index < 0 || index > m_count)
|
||||
return new KbfxDataSource();
|
||||
else
|
||||
return m_index[index];
|
||||
}
|
||||
|
||||
|
||||
KbfxDataSource *
|
||||
KbfxDataGroup::getItem ( QString name )
|
||||
{
|
||||
return m_data[name];
|
||||
}
|
||||
|
||||
KbfxDataGroup::Data
|
||||
KbfxDataGroup::getData()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_DATA_GROUP_H
|
||||
#define KBFX_DATA_GROUP_H
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qstringlist.h>
|
||||
#include "kbfxdatasource.h"
|
||||
|
||||
class KbfxDataGroup
|
||||
{
|
||||
|
||||
public:
|
||||
typedef QMap<QString,KbfxDataSource*> Data;
|
||||
typedef QMap<int,KbfxDataSource*> Index;
|
||||
|
||||
/**
|
||||
* Construts a new data group and initialzes the group
|
||||
* @return Constructs a new Datagroup
|
||||
*/
|
||||
KbfxDataGroup();
|
||||
/**
|
||||
* De-allocates and frees the meomery when destroyed
|
||||
* @return
|
||||
*/
|
||||
~KbfxDataGroup();
|
||||
/**
|
||||
* Adds a new DataSource to the Group
|
||||
* null pointers and invalid datasources are handled
|
||||
* internally no manal checking is needed
|
||||
* @param item A pointer to a datasource valid or invalid
|
||||
*/
|
||||
void addItem ( KbfxDataSource * item );
|
||||
/**
|
||||
* Sets a proper Name to the group. The default will be set to
|
||||
* "Unknown Group" . it is recomended that a name is always set
|
||||
* @param name The name that should be give to the group
|
||||
*/
|
||||
void setName ( QString name ) {m_name = name;}
|
||||
/**
|
||||
* To access a datasource give the name of the datasource
|
||||
* @param The name othe datasource
|
||||
* @return pointer to a valid datasource
|
||||
*/
|
||||
KbfxDataSource * getItem ( QString );
|
||||
/**
|
||||
* use this to get all the items inside the datagroup
|
||||
* @return a copy of the data Map (QMap<QString,KbfxDataSource*>)
|
||||
*/
|
||||
Data getData();
|
||||
/**
|
||||
* searches and returns the list of matching datasources
|
||||
* @param keyword to search for
|
||||
* @return list of matching datasources
|
||||
*/
|
||||
KbfxDataSource::DataSourceList lookup ( QString );
|
||||
/**
|
||||
* The name of the group
|
||||
* @return Name of the group
|
||||
*/
|
||||
QString name() {return m_name;}
|
||||
/**
|
||||
* The number of datasources inside the datagroup
|
||||
* @return number of datasources
|
||||
*/
|
||||
int count() {return m_count;}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
KbfxDataSource * itemAt(int index);
|
||||
|
||||
private:
|
||||
Data m_data;
|
||||
QString m_name;
|
||||
int m_count;
|
||||
Index m_index;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxdatagrouplist.h"
|
||||
|
||||
KbfxDataGroupList::KbfxDataGroupList()
|
||||
{
|
||||
m_name="Unset";
|
||||
m_iconPath= "";
|
||||
m_count = 0;
|
||||
//m_groupList.setAutoDelete(true);
|
||||
}
|
||||
|
||||
KbfxDataGroupList::~KbfxDataGroupList()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
KbfxDataGroupList::addGroup ( KbfxDataGroup * group )
|
||||
{
|
||||
|
||||
|
||||
for ( int i =0; i < ( int ) m_groupList.count();i++ )
|
||||
{
|
||||
// qDebug("Curent loop + "+m_groupList.at(i)->name()+"adding "+group->name());
|
||||
if ( m_groupList.at ( i ) == group )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
//above is to save from bad plugins
|
||||
|
||||
m_groupList.append ( group );
|
||||
m_count++;
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_DATA_GROUP_LIST_H
|
||||
#define KBFX_DATA_GROUP_LIST_H
|
||||
|
||||
#include <qptrlist.h>
|
||||
#include "kbfxdatagroup.h"
|
||||
|
||||
class KbfxDataGroupList
|
||||
{
|
||||
public:
|
||||
typedef QPtrList<KbfxDataGroup> GroupList;
|
||||
KbfxDataGroupList();
|
||||
~KbfxDataGroupList();
|
||||
//in
|
||||
void addGroup ( KbfxDataGroup * group );
|
||||
void setName ( QString name ) { m_name = name;}
|
||||
void setIcon ( QString path ) { m_iconPath = path;}
|
||||
//out
|
||||
QString name() {return m_name;}
|
||||
GroupList getGroup() { return m_groupList;}
|
||||
QString iconPath() { return m_iconPath;}
|
||||
|
||||
int count() {return m_count;}
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_iconPath;
|
||||
GroupList m_groupList;
|
||||
int m_count;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxdatasource.h"
|
||||
#include <kdesktopfile.h>
|
||||
#include <kapplication.h>
|
||||
#include <krun.h>
|
||||
|
||||
KbfxDataSource::KbfxDataSource()
|
||||
{
|
||||
m_type = NONDESKTOP;
|
||||
m_keyWords="";
|
||||
m_command="";
|
||||
m_desktopPath="none";
|
||||
m_contentPath = "none";
|
||||
}
|
||||
|
||||
KbfxDataSource::~KbfxDataSource()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxDataSource::lookup ( QString str )
|
||||
{
|
||||
if ( str.isNull() )
|
||||
return false;
|
||||
|
||||
QString _searchStr = m_text+m_comment+m_description+m_keyWords;
|
||||
|
||||
|
||||
if ( _searchStr.contains ( str,false ) > 0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxDataSource::loadDesktopFile()
|
||||
{
|
||||
KDesktopFile * file = new KDesktopFile ( m_desktopPath );
|
||||
m_text = file->readName();
|
||||
m_comment= file->readComment();
|
||||
m_iconPath = file->readIcon();
|
||||
m_command = file->readEntry ( "Exec","none" );
|
||||
m_description = file->readGenericName () +file->readEntry ( "Categories","Application" );
|
||||
|
||||
setContentPath ( m_desktopPath );
|
||||
delete file;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxDataSource::exec()
|
||||
{
|
||||
|
||||
if ( type() == KbfxDataSource::DESKTOP )
|
||||
{
|
||||
QCString dcop;
|
||||
int pid;
|
||||
QString m_error;
|
||||
KApplication::startServiceByDesktopPath ( desktopFile(),
|
||||
QString::null, &m_error,&dcop,&pid,"",true );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
KRun::runCommand ( m_command );
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_DATA_SOURCE_H
|
||||
#define KBFX_DATA_SOURCE_H
|
||||
|
||||
#include <qvaluelist.h>
|
||||
#include <qstring.h>
|
||||
|
||||
class KbfxDataSource
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
typedef enum
|
||||
{ DESKTOP = 0, NONDESKTOP } Type;
|
||||
typedef QValueList < KbfxDataSource > DataSourceList;
|
||||
/**
|
||||
* Constructs a new DataSource. Data source is a simple class that holds
|
||||
* a .desktop file and also you can include a custom commmand that can be
|
||||
* exectuted
|
||||
* @return a pointer to a new data source
|
||||
*/
|
||||
KbfxDataSource ();
|
||||
virtual ~ KbfxDataSource ();
|
||||
|
||||
/**
|
||||
* Sets the name of a data source and should not be used if your dara is
|
||||
* a desktop file use KbfxDataSource::setDesktopPath() functions instead
|
||||
* @param name should be the name of the data source
|
||||
*/
|
||||
void setName ( QString name )
|
||||
{
|
||||
m_text = name;
|
||||
}
|
||||
/**
|
||||
* Sets the desktop file of for the data source. Note that u do not have to check
|
||||
* parameters such as if the the desktop is kiosk allowed. the this function internally
|
||||
* abstracts such functions.
|
||||
* @param path should be the absolute path of a valid desktop file
|
||||
*/
|
||||
void setDesktopPath ( QString path )
|
||||
{
|
||||
m_desktopPath = path;
|
||||
m_type = DESKTOP;
|
||||
loadDesktopFile ();
|
||||
}
|
||||
|
||||
virtual void setCommand ( QString cmd )
|
||||
{
|
||||
m_command = cmd;
|
||||
}
|
||||
|
||||
|
||||
void setContentPath ( QString path )
|
||||
{
|
||||
m_contentPath = path;
|
||||
}
|
||||
QString contentPath ()
|
||||
{
|
||||
return m_contentPath;
|
||||
}
|
||||
|
||||
virtual void setType ( Type t )
|
||||
{
|
||||
m_type = t;
|
||||
}
|
||||
|
||||
virtual void exec ();
|
||||
|
||||
void setComment ( QString comment )
|
||||
{
|
||||
m_comment = comment;
|
||||
};
|
||||
|
||||
void setDescription ( QString desc )
|
||||
{
|
||||
m_description = desc;
|
||||
}
|
||||
|
||||
void setIconPath ( QString path )
|
||||
{
|
||||
m_iconPath = path;
|
||||
}
|
||||
|
||||
QString desktopFile ()
|
||||
{
|
||||
return m_desktopPath;
|
||||
}
|
||||
//out
|
||||
QString name ()
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
QString icon ()
|
||||
{
|
||||
return m_iconPath;
|
||||
};
|
||||
QString command ()
|
||||
{
|
||||
return m_command;
|
||||
}
|
||||
Type type ()
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
/**
|
||||
* Use this function to get the comment of the a data soruce. this
|
||||
* functio will NOT return NULL so no checking needed
|
||||
* @return the comment of the data source or empty string
|
||||
*/
|
||||
QString comment ()
|
||||
{
|
||||
return m_comment;
|
||||
}
|
||||
bool lookup ( QString str );
|
||||
private:
|
||||
//TODO
|
||||
//MOve to private D
|
||||
void loadDesktopFile ();
|
||||
QString m_text;
|
||||
QString m_desktopPath;
|
||||
QString m_command;
|
||||
QString m_iconPath;
|
||||
QString m_comment;
|
||||
QString m_description;
|
||||
QString m_keyWords;
|
||||
Type m_type;
|
||||
QString m_contentPath;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxdatastack.h"
|
||||
|
||||
KbfxDataStack::KbfxDataStack()
|
||||
{
|
||||
m_nameList.append ( "" );
|
||||
m_name = "Unset";
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
KbfxDataStack::~KbfxDataStack()
|
||||
{
|
||||
//TODO: empty the list
|
||||
}
|
||||
|
||||
void
|
||||
KbfxDataStack::addGroupList ( KbfxDataGroupList * list )
|
||||
{
|
||||
m_stack[list->name() ]=list;
|
||||
m_nameList.append ( list->name() );
|
||||
m_dict[list->name() ]=m_count;
|
||||
|
||||
KbfxPlasmaCanvasStackData stackinfo;
|
||||
stackinfo.name = list->name();
|
||||
stackinfo.icon = list->iconPath();
|
||||
m_dataDict[m_count] = stackinfo;
|
||||
|
||||
m_count++;
|
||||
|
||||
}
|
||||
QStringList
|
||||
KbfxDataStack::getStackIndex()
|
||||
{
|
||||
return m_nameList;
|
||||
}
|
||||
|
||||
KbfxDataGroupList *
|
||||
KbfxDataStack::getStack ( QString name )
|
||||
{
|
||||
|
||||
|
||||
if ( m_nameList.contains ( name ) >0 )
|
||||
return m_stack[name];
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
KbfxDataStack::getSubGroupName ( uint id )
|
||||
{
|
||||
|
||||
Dict::Iterator it;
|
||||
for ( it=m_dict.begin();it!=m_dict.end();++it )
|
||||
{
|
||||
if ( it.data() == id )
|
||||
return it.key();
|
||||
|
||||
}
|
||||
return QString ( "Empty" );
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_DATA_STACK_H
|
||||
#define KBFX_DATA_STACK_H
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include "kbfxdatagrouplist.h"
|
||||
#include "kbfxplasmacanvasstackdata.h" //TODO:change the name here
|
||||
|
||||
class KbfxDataStack
|
||||
{
|
||||
|
||||
public:
|
||||
typedef QMap<QString,KbfxDataGroupList*> StackMap;
|
||||
typedef QMap<QString,uint> Dict;
|
||||
typedef QMap<int,KbfxPlasmaCanvasStackData> DataDict;
|
||||
|
||||
KbfxDataStack();
|
||||
~KbfxDataStack();
|
||||
void setName ( QString name ) { m_name=name;}
|
||||
void addGroupList ( KbfxDataGroupList * list );
|
||||
//out
|
||||
KbfxDataGroupList * getGroupList ( QString name );
|
||||
QStringList getStackIndex();
|
||||
KbfxDataGroupList * getStack ( QString name );
|
||||
|
||||
Dict getDict() {return m_dict;}
|
||||
DataDict getDataDict() { return m_dataDict;}
|
||||
QString name() {return m_name;}
|
||||
uint getIndex ( QString name ) { return m_dict[name];}
|
||||
QString getSubGroupName ( uint id );
|
||||
int count() {return m_count;}
|
||||
private:
|
||||
StackMap m_stack;
|
||||
QStringList m_nameList;
|
||||
QString m_name;
|
||||
Dict m_dict;
|
||||
DataDict m_dataDict;
|
||||
uint m_count;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmadataplugin.h"
|
||||
|
||||
KbfxPlasmaCanvasStack * view()
|
||||
{
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasstack.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
KbfxPlasmaCanvasStack * view();
|
||||
}
|
||||
|
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <config.h>
|
||||
|
||||
#include "kbfxplasmapluginloader.h"
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
KbfxPlasmaPluginLoader::KbfxPlasmaPluginLoader()
|
||||
{
|
||||
m_plugin = 0;
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaPluginLoader::init()
|
||||
{
|
||||
|
||||
QString libprefix = locate ( "lib","libkbfxdata.so" );
|
||||
libprefix.remove ( "libkbfxdata.so" );
|
||||
// QString libprefix = KBFX_LIB_INSTALL_DIR ;
|
||||
kdDebug() << "KBFX plugins lib is: " << libprefix << endl;
|
||||
QDir * _dir = new QDir ( libprefix+"/kbfx/plugins/" );
|
||||
QStringList plugins;
|
||||
_dir->setFilter ( QDir::Files );
|
||||
_dir->setNameFilter ( "*.so" );
|
||||
if ( !_dir->exists() )
|
||||
{
|
||||
kdDebug() << "Invalid Plugin Prefix: " << libprefix << "/kbfx/plugins/" << endl;
|
||||
delete _dir;
|
||||
return ;//QStringList("No Plugins found: Error in default Paths.Contact Package Manager");
|
||||
}
|
||||
|
||||
const QFileInfoList *list = _dir->entryInfoList();
|
||||
QFileInfoListIterator it ( *list );
|
||||
QFileInfo *fi=0;
|
||||
int _index =0;
|
||||
while ( ( fi = it.current() ) != 0 )
|
||||
{
|
||||
QString * path = new QString ( libprefix+"/kbfx/plugins/"+fi->fileName() );
|
||||
QLibrary * _l = new QLibrary ( *path );
|
||||
|
||||
typedef QString ( *getName ) ();
|
||||
getName nameFunc;
|
||||
nameFunc = ( getName ) _l->resolve ( "name" );
|
||||
if ( nameFunc )
|
||||
{
|
||||
pluginMap() [nameFunc() ] = new KbfxPlugin ( nameFunc(),*path,_index++ );
|
||||
}
|
||||
++it;
|
||||
_l->unload();
|
||||
delete _l;
|
||||
delete path;
|
||||
}
|
||||
|
||||
delete _dir;
|
||||
}
|
||||
|
||||
|
||||
KbfxPlasmaPluginLoader::~KbfxPlasmaPluginLoader()
|
||||
{
|
||||
// if(m_plugin!=0)
|
||||
// delete m_plugin;
|
||||
|
||||
// PluginMap::Iterator it;
|
||||
// for ( it = pluginMap().begin(); it != pluginMap().end(); ++it ) {
|
||||
// delete it.data();
|
||||
// pluginMap().remove(it);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
KbfxDataStack *
|
||||
KbfxPlasmaPluginLoader::getView ( QString name )
|
||||
{
|
||||
PluginMap::Iterator it;
|
||||
for ( it = pluginMap().begin(); it != pluginMap().end(); ++it )
|
||||
{
|
||||
pluginMap().remove ( it );
|
||||
}
|
||||
init();
|
||||
KbfxDataStack * stack = pluginMap() [name]->data();
|
||||
|
||||
if (stack == 0 ) {
|
||||
return new KbfxDataStack();
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
KbfxDataGroup *
|
||||
KbfxPlasmaPluginLoader::search ( QString pname,QString keyword )
|
||||
{
|
||||
if ( pname == NULL )
|
||||
return NULL;
|
||||
|
||||
KbfxDataGroup * group = pluginMap() [pname]->search ( keyword );
|
||||
if ( group == NULL )
|
||||
{
|
||||
kdDebug() << "KbfxPlasmaaPluginLoader:109:Null pointer" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return group;
|
||||
|
||||
}
|
||||
|
||||
|
||||
KbfxPlasmaPluginLoader::PluginMap&
|
||||
KbfxPlasmaPluginLoader::pluginMap()
|
||||
{
|
||||
static PluginMap * map = 0;
|
||||
if ( !map )
|
||||
map = new PluginMap();
|
||||
return *map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QStringList
|
||||
KbfxPlasmaPluginLoader::scanPlugins()
|
||||
{
|
||||
|
||||
init();
|
||||
QStringList plugins;
|
||||
PluginMap::Iterator it;
|
||||
|
||||
for ( it = pluginMap().begin(); it != pluginMap().end();++it )
|
||||
{
|
||||
if ( it.data()->status() == false )
|
||||
plugins.append ( it.data()->name() );
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
|
||||
#include "kbfxplasmapluginloader.moc"
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_PLUGIN_LOADER_H
|
||||
#define KBFX_PLASMA_PLUGIN_LOADER_H
|
||||
|
||||
#include <qlibrary.h>
|
||||
#include "kbfxplasmacanvasstack.h"
|
||||
#include "kbfxdatastack.h"
|
||||
#include "kbfxplugin.h"
|
||||
#include <qcanvas.h>
|
||||
|
||||
class KbfxPlasmaPluginLoader:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef QMap<QString,KbfxPlugin*> PluginMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
KbfxPlasmaPluginLoader();
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
~KbfxPlasmaPluginLoader();
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
KbfxDataStack * getView ( QString name );
|
||||
/*
|
||||
look for all installed Plugins. returns a list of installed plugins
|
||||
*/
|
||||
static QStringList scanPlugins();
|
||||
|
||||
/**
|
||||
* Calls the search function of a given plugin and returns the result
|
||||
* @param pluginName The name of the plugin to call
|
||||
* @param keyword the keyword to pass to the plugin
|
||||
* @return a valid KbfxDataGroup or -1
|
||||
*/
|
||||
static KbfxDataGroup * search ( QString pluginName,QString keyword );
|
||||
|
||||
protected:
|
||||
static void init();
|
||||
|
||||
private:
|
||||
|
||||
QLibrary * m_plugin;
|
||||
static PluginMap& pluginMap();
|
||||
QString m_prefix;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplugin.h"
|
||||
|
||||
KbfxPlugin::KbfxPlugin ( QString name,QString lib,uint id )
|
||||
{
|
||||
m_name = name;
|
||||
m_libName = lib;
|
||||
m_id = id;
|
||||
m_loaded = false;
|
||||
}
|
||||
|
||||
KbfxPlugin::KbfxPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
KbfxPlugin::~KbfxPlugin()
|
||||
{
|
||||
// delete [] m_name;
|
||||
// delete [] m_libName;
|
||||
}
|
||||
|
||||
QString
|
||||
KbfxPlugin::name()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString
|
||||
KbfxPlugin::libName()
|
||||
{
|
||||
return m_libName;
|
||||
}
|
||||
|
||||
uint
|
||||
KbfxPlugin::id()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxPlugin::status()
|
||||
{
|
||||
return m_loaded;
|
||||
}
|
||||
|
||||
KbfxDataStack *
|
||||
KbfxPlugin::data()
|
||||
{
|
||||
typedef KbfxDataStack * ( *KbfxPluginView ) ();
|
||||
KbfxDataStack * m_stack =0;
|
||||
KbfxPluginView m_hook;
|
||||
QLibrary * m_plugin = new QLibrary ( m_libName );
|
||||
|
||||
if ( m_plugin == NULL )
|
||||
return new KbfxDataStack();
|
||||
|
||||
m_hook = ( KbfxPluginView ) m_plugin->resolve ( "view" );
|
||||
m_stack = m_hook();
|
||||
m_plugin->unload();
|
||||
delete m_plugin;
|
||||
|
||||
if ( m_stack != NULL )
|
||||
return m_stack;
|
||||
else
|
||||
return new KbfxDataStack();
|
||||
}
|
||||
|
||||
KbfxDataGroup *
|
||||
KbfxPlugin::search ( QString keyword )
|
||||
{
|
||||
if ( keyword == 0 )
|
||||
return NULL;//new KbfxDataGroup();
|
||||
|
||||
if ( keyword.isNull() )
|
||||
return NULL;//KbfxDataGroup();
|
||||
|
||||
|
||||
typedef KbfxDataGroup * ( *KbfxPluginSearch ) ( QString key );
|
||||
KbfxDataGroup * m_group =0;
|
||||
KbfxPluginSearch m_hook;
|
||||
QLibrary * m_plugin = new QLibrary ( m_libName );
|
||||
m_hook = ( KbfxPluginSearch ) m_plugin->resolve ( "search" );
|
||||
m_group = m_hook ( keyword );
|
||||
m_plugin->unload();
|
||||
delete m_plugin;
|
||||
if ( m_group != NULL )
|
||||
{
|
||||
// qDebug("KbfxPlugin():search():103:return Valid Group "+m_group->name());
|
||||
return m_group;
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
|
||||
#include "kbfxplugin.moc"
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLUGIN_H
|
||||
#define KBFX_PLUGIN_H
|
||||
//#include "kbfxplasmacanvasstack.h"
|
||||
#include "kbfxdatastack.h"
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <qlibrary.h>
|
||||
/**
|
||||
This class reprecentes a plugin
|
||||
written for kbfx menu this
|
||||
will be passed between the life time
|
||||
of the menu
|
||||
**/
|
||||
|
||||
|
||||
class KbfxPlugin:public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
KbfxPlugin();
|
||||
KbfxPlugin ( QString Name,QString lib,uint id );
|
||||
~KbfxPlugin();
|
||||
|
||||
void setStatus ( bool );
|
||||
|
||||
QString name();
|
||||
QString libName();
|
||||
uint id();
|
||||
bool status();
|
||||
// KbfxPlasmaCanvasStack * data();
|
||||
KbfxDataStack * data();
|
||||
KbfxDataGroup * search ( QString keyword );
|
||||
|
||||
// KbfxDataStack * data();
|
||||
|
||||
public slots:
|
||||
void reload() {}
|
||||
signals:
|
||||
void loadComplete();
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_libName;
|
||||
uint m_id;
|
||||
// KbfxPlasmaCanvasStack * m_data;
|
||||
KbfxDataStack m_data_R;
|
||||
// QCanvas * m_canvas;
|
||||
bool m_loaded;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,14 @@
|
||||
--- kbfx-0.4.9.3-20070117.orig/CMakeLists.txt 2007-01-17 23:31:10.000000000 +0800
|
||||
+++ kbfx-0.4.9.3-20070117/CMakeLists.txt 2007-01-18 23:30:43.000000000 +0800
|
||||
@@ -8,7 +8,10 @@
|
||||
# Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)
|
||||
# RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
# MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)
|
||||
-SET(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
+if (NOT CMAKE_BUILD_TYPE)
|
||||
+ SET(CMAKE_BUILD_TYPE RelWithDebInfo
|
||||
+ CACHE STRING "Specify build type: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
+endif (NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_COLOR_MAKEFILE ON CACHE STRING "Enable/Disable color output during build." FORCE)
|
||||
#SET(CMAKE_VERBOSE_MAKEFILE OFF CACHE STRING "Enable/Disable cmake debug output during build." FORCE)
|
||||
|
@ -0,0 +1,44 @@
|
||||
SET(libkbfxplasmadatastubsrc
|
||||
kbfxplasmadataplugin.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxplasmadatastubsrc})
|
||||
|
||||
ADD_LIBRARY(kbfxplasmadatastub SHARED ${libkbfxplasmadatastubsrc})
|
||||
SET_TARGET_PROPERTIES(kbfxplasmadatastub
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxplasmadatastub PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmadatastub
|
||||
kbfxdata
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxplasmadatastub ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxplasmadatastubsrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxplasmadatastub SHARED ${libkbfxplasmadatastubsrc})
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmadatastub
|
||||
kbfxdata
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxplasmadatastub ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxplasmadatastub DESTINATION ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins)
|
@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <dcopref.h>
|
||||
#include <kapplication.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <krun.h>
|
||||
#include <kservice.h>
|
||||
#include <kservicegroup.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
|
||||
#include <kbfxplasmadataplugin-common.h>
|
||||
|
||||
|
||||
void
|
||||
browseApp ( KServiceGroup::Ptr service, KbfxDataGroupList * glist,
|
||||
KbfxDataGroup * appGroup )
|
||||
{
|
||||
if ( !service || !service->isValid () )
|
||||
return;
|
||||
|
||||
|
||||
KServiceGroup::List list = service->entries ( true, true, false, true );
|
||||
|
||||
|
||||
if ( service->noDisplay () == true )
|
||||
return;
|
||||
|
||||
/*
|
||||
if (list.count () <= 0)
|
||||
return;
|
||||
*/
|
||||
|
||||
appGroup = new KbfxDataGroup ();
|
||||
appGroup->setName ( service->caption () );
|
||||
|
||||
for ( KServiceGroup::List::ConstIterator it = list.begin ();
|
||||
it != list.end (); it++ )
|
||||
{
|
||||
KSycocaEntry *p = ( *it );
|
||||
if ( p->isType ( KST_KService ) )
|
||||
{
|
||||
KService *s = static_cast < KService * > ( p );
|
||||
KbfxDataSource *data = new KbfxDataSource ();
|
||||
data->setDesktopPath ( s->desktopEntryPath () );
|
||||
appGroup->addItem ( data );
|
||||
}
|
||||
else if ( p->isType ( KST_KServiceGroup ) )
|
||||
{
|
||||
KServiceGroup *g = static_cast < KServiceGroup * > ( p );
|
||||
if ( g->childCount () > 0 )
|
||||
{
|
||||
glist->addGroup ( appGroup );
|
||||
appGroup = new KbfxDataGroup ();
|
||||
appGroup->setName ( g->caption () );
|
||||
browseApp ( g, glist, appGroup );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
glist->addGroup ( appGroup );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KbfxDataStack *
|
||||
view ()
|
||||
{
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
KbfxDataGroupList *glist = new KbfxDataGroupList ();
|
||||
KbfxDataStack *gstack = new KbfxDataStack ();
|
||||
|
||||
KServiceGroup::Ptr service = KServiceGroup::group ( "/" );
|
||||
if ( service == NULL)
|
||||
{
|
||||
int messageBoxUserResReturn = KMessageBox::questionYesNo ( 0,
|
||||
tr2i18n ( "<p align='center'>There is a problem in KDE Menu services!<br>KBFX can try to autorepair this problem.<br>Should KBFX autorepair this problem?</p>" ),
|
||||
tr2i18n ( "Problem in KDE Menu Services" ),
|
||||
tr2i18n ( "Do Autorepair" ),
|
||||
tr2i18n ( "Do NOT Autorepair" ) );
|
||||
if ( messageBoxUserResReturn == KMessageBox::Yes )
|
||||
{
|
||||
KRun::runCommand ( "kbuildsycoca" );
|
||||
// if ( ! ConfigInit().m_KbfxWatcher )
|
||||
// {
|
||||
DCOPRef m_kickerPanel("kicker", "kicker");
|
||||
m_kickerPanel.call("restart()");
|
||||
// }
|
||||
}
|
||||
return new KbfxDataStack();
|
||||
}
|
||||
|
||||
service->setShowEmptyMenu ( false );
|
||||
|
||||
glist->setName ( "Applications" );
|
||||
appGroup->setName ( service->caption () );
|
||||
|
||||
KServiceGroup::List list = service->entries ( true, true, false, false );
|
||||
|
||||
if ( list.count() <= 0)
|
||||
{
|
||||
return new KbfxDataStack();
|
||||
}
|
||||
|
||||
|
||||
for ( KServiceGroup::List::ConstIterator it = list.begin ();
|
||||
it != list.end (); it++ )
|
||||
{
|
||||
KSycocaEntry *p = ( *it );
|
||||
if ( p->isType ( KST_KService ) )
|
||||
{}
|
||||
else if ( p->isType ( KST_KServiceGroup ) )
|
||||
{
|
||||
KServiceGroup *g = static_cast < KServiceGroup * > ( p );
|
||||
g->setShowEmptyMenu ( false );
|
||||
|
||||
if ( g->childCount () > 0 )
|
||||
{
|
||||
glist = new KbfxDataGroupList ();
|
||||
glist->setName ( g->caption () );
|
||||
glist->setIcon ( g->icon () );
|
||||
browseApp ( g, glist, appGroup );
|
||||
gstack->addGroupList ( glist );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
gstack->setName ( "Applications" );
|
||||
|
||||
|
||||
return gstack;
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
name ()
|
||||
{
|
||||
return QString ( "Applications" );
|
||||
}
|
||||
|
||||
QString
|
||||
type ()
|
||||
{
|
||||
return QString ( "Stub Type" );
|
||||
}
|
||||
|
||||
|
||||
uint
|
||||
id ()
|
||||
{
|
||||
return 1; //TODO see what can be done... manybe rand()?
|
||||
}
|
||||
|
||||
#include <ktrader.h>
|
||||
|
||||
KbfxDataGroup *
|
||||
search ( QString _keyword )
|
||||
{
|
||||
|
||||
|
||||
KbfxDataGroup *g = new KbfxDataGroup ();
|
||||
g->setName ( "Applications" );
|
||||
|
||||
|
||||
KTrader::OfferList offers = KTrader::self ()->query ( "Application" );
|
||||
|
||||
int *count = new int;
|
||||
*count = 0;
|
||||
QValueListIterator < KService::Ptr > s = offers.begin ();
|
||||
|
||||
for ( ; s != offers.end (); ++s )
|
||||
{
|
||||
if ( s == NULL )
|
||||
continue;
|
||||
if ( (*s)->noDisplay () == true )
|
||||
continue;
|
||||
|
||||
QString *sPtr = new QString ();
|
||||
|
||||
( *sPtr ) = ( *s )->name () + ( *s )->genericName () + ( *s )->comment ();
|
||||
if ( ( !sPtr->isNull () ) && sPtr->contains ( _keyword, false ) > 0 )
|
||||
{
|
||||
KbfxDataSource *data = new KbfxDataSource ();
|
||||
data->setName ( ( *s )->name () );
|
||||
data->setDesktopPath ( ( *s )->desktopEntryPath () );
|
||||
|
||||
g->addItem ( data );
|
||||
( *count ) ++;
|
||||
if ( ( *count ) == 10 )
|
||||
break;
|
||||
|
||||
}
|
||||
if ( sPtr != 0 )
|
||||
delete sPtr;
|
||||
}
|
||||
delete count;
|
||||
return g;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins)
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_DATA_PLUGIN_COMMON_H
|
||||
#define KBFX_PLASMA_DATA_PLUGIN_COMMON_H
|
||||
|
||||
#include "kbfxdatastack.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// static QString check = "Static Check for Plugin";
|
||||
KbfxDataStack * view();
|
||||
QString name(); //Name of the Plugin My Music .if TOM Create..Configure ..
|
||||
QString type(); //Type of the plugin ex: Application : Amork : kio ..etc
|
||||
uint id(); //A id for menus
|
||||
KbfxDataGroup * search ( QString str );
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
SET(libkbfxplasmadataplasmoidsrc
|
||||
kbfxplasmadatapluginplosmoid.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxplasmadataplasmoidsrc})
|
||||
|
||||
ADD_LIBRARY(kbfxplasmadataplasmoid SHARED ${libkbfxplasmadataplasmoidsrc} )
|
||||
SET_TARGET_PROPERTIES(kbfxplasmadataplasmoid
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxplasmadataplasmoid PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmadataplasmoid
|
||||
kbfxdata
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxplasmadataplasmoid ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxplasmadataplasmoidsrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxplasmadataplasmoid SHARED ${libkbfxplasmadataplasmoidsrc} )
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmadataplasmoid
|
||||
kbfxdata
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxplasmadataplasmoid ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxplasmadataplasmoid DESTINATION ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins)
|
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <kapplication.h>
|
||||
#include <kservice.h>
|
||||
#include <kservicegroup.h>
|
||||
#include <kdebug.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <kbfxplasmadataplugin-common.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KbfxDataStack *
|
||||
view ()
|
||||
{
|
||||
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
KbfxDataGroupList *glist = new KbfxDataGroupList ();
|
||||
KbfxDataStack *gstack = new KbfxDataStack ();
|
||||
|
||||
|
||||
glist->setName ( "Browse" );
|
||||
glist->setIcon ( "plasmagik" );
|
||||
appGroup->setName ( "Plasmoids" );
|
||||
|
||||
QString path = locate ( "data", "kicker/applets/lockout.desktop" );
|
||||
path.remove ( "lockout.desktop" );
|
||||
|
||||
|
||||
|
||||
QDir d ( path );
|
||||
d.setFilter ( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
|
||||
d.setSorting ( QDir::Size | QDir::Reversed );
|
||||
d.setNameFilter ( "*.desktop" );
|
||||
|
||||
const QFileInfoList *list = d.entryInfoList ();
|
||||
QFileInfoListIterator it ( *list );
|
||||
QFileInfo *fi;
|
||||
while ( ( fi = it.current () ) != 0 )
|
||||
{
|
||||
|
||||
KDesktopFile *desktop = new KDesktopFile ( fi->filePath () );
|
||||
|
||||
KbfxDataSource *src = new KbfxDataSource ();
|
||||
|
||||
src->setName ( desktop->readName () );
|
||||
src->setContentPath ( fi->filePath () );
|
||||
src->setIconPath ( desktop->readIcon () );
|
||||
src->setCommand ( "dcop kicker Panel addApplet " + fi->filePath () );
|
||||
appGroup->addItem ( src );
|
||||
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
|
||||
gstack->setName ( "Plasmoids" );
|
||||
|
||||
glist->addGroup ( appGroup );
|
||||
gstack->addGroupList ( glist );
|
||||
return gstack;
|
||||
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
name ()
|
||||
{
|
||||
return QString ( "Plasmoids" );
|
||||
}
|
||||
|
||||
QString
|
||||
type ()
|
||||
{
|
||||
return QString ( "Stub Type" );
|
||||
}
|
||||
|
||||
|
||||
uint
|
||||
id ()
|
||||
{
|
||||
return 1; //TODO see what can be done... manybe rand()?
|
||||
}
|
||||
|
||||
|
||||
#include <ktrader.h>
|
||||
|
||||
KbfxDataGroup *
|
||||
search ( QString _keyword )
|
||||
{
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
|
||||
|
||||
QString path = locate ( "data", "kicker/applets/lockout.desktop" );
|
||||
path.remove ( "lockout.desktop" );
|
||||
|
||||
|
||||
|
||||
QDir d ( path );
|
||||
d.setFilter ( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
|
||||
d.setSorting ( QDir::Size | QDir::Reversed );
|
||||
d.setNameFilter ( "*.desktop" );
|
||||
|
||||
const QFileInfoList *list = d.entryInfoList ();
|
||||
QFileInfoListIterator it ( *list );
|
||||
QFileInfo *fi;
|
||||
|
||||
while ( ( fi = it.current () ) != 0 )
|
||||
{
|
||||
if ( fi->fileName ().contains ( _keyword ) > 0 )
|
||||
{
|
||||
KDesktopFile *desktop = new KDesktopFile ( fi->filePath () );
|
||||
|
||||
KbfxDataSource *src = new KbfxDataSource ();
|
||||
|
||||
src->setName ( desktop->readName () );
|
||||
src->setContentPath ( fi->filePath () );
|
||||
src->setIconPath ( desktop->readIcon () );
|
||||
src->setCommand ( "dcop kicker Panel addApplet " + fi->filePath () );
|
||||
appGroup->addItem ( src );
|
||||
}
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
|
||||
return appGroup;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
SET(libkbfxplasmarecentstuffsrc
|
||||
kbfxplasmarecentstuff.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxplasmarecentstuffsrc})
|
||||
|
||||
ADD_LIBRARY(kbfxplasmarecentstuff SHARED ${libkbfxplasmarecentstuffsrc} )
|
||||
SET_TARGET_PROPERTIES(kbfxplasmarecentstuff
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxplasmarecentstuff PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmarecentstuff
|
||||
kbfxdata
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxplasmarecentstuff ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxplasmarecentstuffsrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxplasmarecentstuff SHARED ${libkbfxplasmarecentstuffsrc} )
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmarecentstuff
|
||||
kbfxdata
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxplasmarecentstuff ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxplasmarecentstuff DESTINATION ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins)
|
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <kapplication.h>
|
||||
#include <kservice.h>
|
||||
#include <kservicegroup.h>
|
||||
#include <kdebug.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <kbfxplasmadataplugin-common.h>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
KbfxDataStack *
|
||||
view ()
|
||||
{
|
||||
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
KbfxDataGroupList *glist = new KbfxDataGroupList ();
|
||||
KbfxDataStack *gstack = new KbfxDataStack ();
|
||||
|
||||
|
||||
glist->setName ( "List" );
|
||||
glist->setIcon ( "newstuff" );
|
||||
appGroup->setName ( "RecentStuff" );
|
||||
|
||||
QString path =
|
||||
KStandardDirs ().localkdedir () + "/share/apps/RecentDocuments/";
|
||||
|
||||
|
||||
|
||||
QDir d ( path );
|
||||
d.setFilter ( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
|
||||
d.setSorting ( QDir::Size | QDir::Reversed );
|
||||
d.setNameFilter ( "*.desktop" );
|
||||
|
||||
const QFileInfoList *list = d.entryInfoList ();
|
||||
QFileInfoListIterator it ( *list );
|
||||
QFileInfo *fi;
|
||||
|
||||
while ( ( fi = it.current () ) != 0 )
|
||||
{
|
||||
|
||||
KDesktopFile *desktop = new KDesktopFile ( fi->filePath () );
|
||||
|
||||
KbfxDataSource *src = new KbfxDataSource ();
|
||||
|
||||
src->setName ( desktop->readName () );
|
||||
src->setContentPath ( fi->filePath () );
|
||||
src->setIconPath ( desktop->readIcon () );
|
||||
src->setCommand ( "kfmclient exec " + desktop->readEntry ( "URL" ) );
|
||||
|
||||
appGroup->addItem ( src );
|
||||
|
||||
delete desktop;
|
||||
++it;
|
||||
}
|
||||
|
||||
|
||||
gstack->setName ( "RecentStuff" );
|
||||
|
||||
glist->addGroup ( appGroup );
|
||||
gstack->addGroupList ( glist );
|
||||
return gstack;
|
||||
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
name ()
|
||||
{
|
||||
return QString ( "RecentStuff" );
|
||||
}
|
||||
|
||||
QString
|
||||
type ()
|
||||
{
|
||||
return QString ( "Stub Type" );
|
||||
}
|
||||
|
||||
|
||||
uint
|
||||
id ()
|
||||
{
|
||||
return 1; //TODO see what can be done... manybe rand()?
|
||||
}
|
||||
|
||||
|
||||
#include <ktrader.h>
|
||||
|
||||
KbfxDataGroup *
|
||||
search ( QString _keyword )
|
||||
{
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
// KbfxDataGroupList *glist = new KbfxDataGroupList ();
|
||||
// KbfxDataStack *gstack = new KbfxDataStack ();
|
||||
|
||||
|
||||
|
||||
QString path =
|
||||
KStandardDirs ().localkdedir () + "/share/apps/RecentDocuments/";
|
||||
|
||||
QDir d ( path );
|
||||
d.setFilter ( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
|
||||
d.setSorting ( QDir::Size | QDir::Reversed );
|
||||
d.setNameFilter ( "*.desktop" );
|
||||
|
||||
const QFileInfoList *list = d.entryInfoList ();
|
||||
QFileInfoListIterator it ( *list );
|
||||
QFileInfo *fi;
|
||||
|
||||
while ( ( fi = it.current () ) != 0 )
|
||||
{
|
||||
if ( fi->fileName ().contains ( _keyword ) > 0 )
|
||||
{
|
||||
KDesktopFile *desktop = new KDesktopFile ( fi->filePath () );
|
||||
|
||||
KbfxDataSource *src = new KbfxDataSource ();
|
||||
|
||||
src->setName ( desktop->readName () );
|
||||
src->setContentPath ( fi->filePath () );
|
||||
src->setIconPath ( desktop->readIcon () );
|
||||
src->setCommand ( "kfmclient exec " + desktop->readEntry ( "URL" ) );
|
||||
appGroup->addItem ( src );
|
||||
delete desktop;
|
||||
}
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
return appGroup;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
SET(libkbfxplasmadatasettingssrc
|
||||
kbfxplasmadatapluginsettings.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxplasmadatasettingssrc})
|
||||
|
||||
ADD_LIBRARY(kbfxplasmadatasettings SHARED ${libkbfxplasmadatasettingssrc})
|
||||
SET_TARGET_PROPERTIES(kbfxplasmadatasettings
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxplasmadatasettings PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmadatasettings
|
||||
kbfxdata
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxplasmadatasettings ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxplasmadatasettingssrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxplasmadatasettings SHARED ${libkbfxplasmadatasettingssrc})
|
||||
TARGET_LINK_LIBRARIES(kbfxplasmadatasettings
|
||||
kbfxdata
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxplasmadatasettings ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxplasmadatasettings DESTINATION ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins)
|
@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <dcopref.h>
|
||||
#include <kapplication.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <krun.h>
|
||||
#include <kservice.h>
|
||||
#include <kservicegroup.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
|
||||
#include <kbfxplasmadataplugin-common.h>
|
||||
|
||||
|
||||
void
|
||||
browseApp ( KServiceGroup::Ptr service, KbfxDataGroupList * glist,
|
||||
KbfxDataGroup * appGroup )
|
||||
{
|
||||
if ( !service || !service->isValid () )
|
||||
return;
|
||||
|
||||
|
||||
KServiceGroup::List list = service->entries ( true, true, false, true );
|
||||
|
||||
/*
|
||||
if (service->noDisplay () == true)
|
||||
return;
|
||||
|
||||
|
||||
if (list.count () <= 0)
|
||||
return;
|
||||
*/
|
||||
|
||||
appGroup = new KbfxDataGroup ();
|
||||
appGroup->setName ( service->caption () );
|
||||
|
||||
for ( KServiceGroup::List::ConstIterator it = list.begin ();
|
||||
it != list.end (); it++ )
|
||||
{
|
||||
KSycocaEntry *p = ( *it );
|
||||
if ( p->isType ( KST_KService ) )
|
||||
{
|
||||
KService *s = static_cast < KService * > ( p );
|
||||
KbfxDataSource *data = new KbfxDataSource ();
|
||||
data->setDesktopPath ( s->desktopEntryPath () );
|
||||
appGroup->addItem ( data );
|
||||
}
|
||||
else if ( p->isType ( KST_KServiceGroup ) )
|
||||
{
|
||||
KServiceGroup *g = static_cast < KServiceGroup * > ( p );
|
||||
if ( g->childCount () > 0 )
|
||||
{
|
||||
glist->addGroup ( appGroup );
|
||||
appGroup = new KbfxDataGroup ();
|
||||
appGroup->setName ( g->caption () );
|
||||
browseApp ( g, glist, appGroup );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//if(appGroup->count() >0)
|
||||
glist->addGroup ( appGroup );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KbfxDataStack *
|
||||
view ()
|
||||
{
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
KbfxDataGroupList *glist = new KbfxDataGroupList ();
|
||||
KbfxDataStack *gstack = new KbfxDataStack ();
|
||||
|
||||
KServiceGroup::Ptr service = KServiceGroup::baseGroup ( "settings" );//KServiceGroup::group ("/");
|
||||
if ( service == NULL)
|
||||
{
|
||||
int messageBoxUserResReturn = KMessageBox::questionYesNo ( 0,
|
||||
tr2i18n ( "<p align='center'>There is a problem in KDE Menu services!<br>KBFX can try to autorepair this problem.<br>Should KBFX autorepair this problem?</p>" ),
|
||||
tr2i18n ( "Problem in KDE Menu Services" ),
|
||||
tr2i18n ( "Do Autorepair" ),
|
||||
tr2i18n ( "Do NOT Autorepair" ) );
|
||||
if ( messageBoxUserResReturn == KMessageBox::Yes )
|
||||
{
|
||||
KRun::runCommand ( "kbuildsycoca" );
|
||||
// if ( ! ConfigInit().m_KbfxWatcher )
|
||||
// {
|
||||
DCOPRef m_kickerPanel("kicker", "kicker");
|
||||
m_kickerPanel.call("restart()");
|
||||
// }
|
||||
}
|
||||
return new KbfxDataStack();
|
||||
}
|
||||
|
||||
service->setShowEmptyMenu ( false );
|
||||
|
||||
glist->setName ( "Settings" );
|
||||
appGroup->setName ( service->caption () );
|
||||
|
||||
|
||||
KServiceGroup::List list = service->entries ( true, true, false, false );
|
||||
|
||||
if ( list.count() <= 0)
|
||||
{
|
||||
return new KbfxDataStack();
|
||||
}
|
||||
|
||||
for ( KServiceGroup::List::ConstIterator it = list.begin ();
|
||||
it != list.end (); it++ )
|
||||
{
|
||||
KSycocaEntry *p = ( *it );
|
||||
if ( p->isType ( KST_KService ) )
|
||||
{}
|
||||
else if ( p->isType ( KST_KServiceGroup ) )
|
||||
{
|
||||
KServiceGroup *g = static_cast < KServiceGroup * > ( p );
|
||||
g->setShowEmptyMenu ( false );
|
||||
|
||||
if ( g->childCount () > 0 )
|
||||
{
|
||||
glist = new KbfxDataGroupList ();
|
||||
glist->setName ( g->caption () );
|
||||
glist->setIcon ( g->icon () );
|
||||
browseApp ( g, glist, appGroup );
|
||||
gstack->addGroupList ( glist );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
gstack->setName ( "Settings" );
|
||||
|
||||
|
||||
return gstack;
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
name ()
|
||||
{
|
||||
return QString ( "Settings" );
|
||||
}
|
||||
|
||||
QString
|
||||
type ()
|
||||
{
|
||||
return QString ( "Stub Type" );
|
||||
}
|
||||
|
||||
uint
|
||||
id ()
|
||||
{
|
||||
return 1; //TODO see what can be done... manybe rand()?
|
||||
}
|
||||
|
||||
|
||||
|
||||
KbfxDataGroup *
|
||||
search ( QString _keyword )
|
||||
{
|
||||
_keyword = _keyword;
|
||||
return new KbfxDataGroup();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
SET(libkbfxstrigiclientsrc
|
||||
kbfxstrigiplugin.cpp
|
||||
)
|
||||
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_AUTOMOC(${libkbfxstrigiclientsrc})
|
||||
|
||||
ADD_LIBRARY(kbfxstrigiclient SHARED ${libkbfxstrigiclientsrc})
|
||||
SET_TARGET_PROPERTIES(kbfxstrigiclient
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxstrigiclient PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxstrigiclient
|
||||
kbfxdata
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_KIO_LIBRARY}
|
||||
${KDE3_UI_LIBRARY}
|
||||
${KDE3_KHTML_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
${STRIGICLIENT_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxstrigiclient ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ELSE (NOT USE_KDE4)
|
||||
KDE4_AUTOMOC(${libkbfxstrigiclientsrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxstrigiclient SHARED ${libkbfxstrigiclientsrc})
|
||||
TARGET_LINK_LIBRARIES(kbfxstrigiclient
|
||||
kbfxdata
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KHTML_LIBS}
|
||||
${M_LIBRARY}
|
||||
${STRIGICLIENT_LIBRARY}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxstrigiclient ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxstrigiclient DESTINATION ${LIB_INSTALL_DIR}/kbfx/plugins)
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins)
|
@ -0,0 +1,225 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <kapplication.h>
|
||||
#include <kservice.h>
|
||||
#include <kservicegroup.h>
|
||||
#include <kdebug.h>
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <kurl.h>
|
||||
|
||||
#include "kbfxstrigiplugin.h"
|
||||
|
||||
|
||||
|
||||
bool
|
||||
stopDaemon ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
startDaemon ()
|
||||
{
|
||||
stopDaemon ();
|
||||
|
||||
// TODO: add the actual code to start the daemon process
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
init ()
|
||||
{}
|
||||
|
||||
void
|
||||
poll ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
KbfxDataStack *
|
||||
view ()
|
||||
{
|
||||
KbfxDataGroup *appGroup = new KbfxDataGroup ();
|
||||
KbfxDataGroupList *glist = new KbfxDataGroupList ();
|
||||
KbfxDataStack *gstack = new KbfxDataStack ();
|
||||
|
||||
init ();
|
||||
glist->setName ( "Configure" );
|
||||
appGroup->setName ( "Strigi Options" );
|
||||
KbfxDataSource *m_source = new KbfxDataSource ();
|
||||
m_source->setName ( "Start Indexing" );
|
||||
m_source->setCommand ( "kfmclient exec strigi:/status/startindexing" );
|
||||
m_source->setComment ( "Starts Building an Index" );
|
||||
m_source->setIconPath ( "enhanced_browsing.png" );
|
||||
appGroup->addItem ( m_source );
|
||||
|
||||
m_source = new KbfxDataSource ();
|
||||
m_source->setName ( "Stop Indexing" );
|
||||
m_source->setCommand ( "kfmclient exec strigi:/status/stopindexing" );
|
||||
m_source->setComment ( "Stop Index Building Process" );
|
||||
m_source->setIconPath ( "enhanced_browsing.png" );
|
||||
appGroup->addItem ( m_source );
|
||||
m_source = new KbfxDataSource ();
|
||||
m_source->setName ( "Stop Daemon" );
|
||||
m_source->setCommand ( "kfmclient exec strigi:/status/stop" );
|
||||
m_source->setComment ( "Stop Search Engine" );
|
||||
m_source->setIconPath ( "enhanced_browsing.png" );
|
||||
appGroup->addItem ( m_source );
|
||||
|
||||
m_source = new KbfxDataSource ();
|
||||
m_source->setName ( "Advanced Searching" );
|
||||
m_source->setCommand ( "kfmclient exec strigi:/" );
|
||||
m_source->setComment ( "Detailed Search Results" );
|
||||
m_source->setIconPath ( "enhanced_browsing.png" );
|
||||
appGroup->addItem ( m_source );
|
||||
m_source = new KbfxDataSource ();
|
||||
m_source->setName ( "Start Daemon" );
|
||||
m_source->setCommand ( "kfmclient exec strigi:/status/start" );
|
||||
m_source->setComment ( "Start Search Engine" );
|
||||
m_source->setIconPath ( "enhanced_browsing.png" );
|
||||
appGroup->addItem ( m_source );
|
||||
|
||||
glist->addGroup ( appGroup );
|
||||
gstack->addGroupList ( glist );
|
||||
gstack->setName ( "Strigi" );
|
||||
|
||||
return gstack;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
name ()
|
||||
{
|
||||
return QString ( "Strigi" );
|
||||
}
|
||||
|
||||
QString
|
||||
type ()
|
||||
{
|
||||
return QString ( "Stub Type" );
|
||||
}
|
||||
|
||||
|
||||
uint
|
||||
id ()
|
||||
{
|
||||
return 1; //TODO see what can be done... maybe rand()?
|
||||
}
|
||||
|
||||
|
||||
|
||||
KbfxDataGroup *
|
||||
search ( QString _keyword )
|
||||
{
|
||||
|
||||
KbfxDataGroup *datagroup = new KbfxDataGroup ();
|
||||
datagroup->setName ( "Strigi" );
|
||||
|
||||
QString socketpath = QDir::homeDirPath () + "/.strigi/socket";
|
||||
startDaemon ();
|
||||
kdDebug() << socketpath << endl;
|
||||
AsyncSocketClient socket;
|
||||
ClientInterface::Hits hits;
|
||||
|
||||
|
||||
socket.setSocketPath ( ( const char * ) socketpath.utf8 () );
|
||||
bool ok = socket.query ( _keyword.ascii (), 5, 0 );
|
||||
|
||||
if ( ok == true )
|
||||
{
|
||||
while ( !socket.statusChanged () )
|
||||
{
|
||||
struct timespec sleeptime;
|
||||
sleeptime.tv_sec = 0;
|
||||
sleeptime.tv_nsec = 1;
|
||||
nanosleep ( &sleeptime, 0 );
|
||||
}
|
||||
hits = socket.getHits ();
|
||||
|
||||
jstreams::IndexedDocument hit;
|
||||
// int last = ( hits.hits.size () > 5 ) ? 5 : hits.hits.size ();
|
||||
|
||||
|
||||
for ( uint i = 0; i < socket.getHits ().hits.size (); ++i )
|
||||
{
|
||||
jstreams::IndexedDocument hit = hits.hits[i];
|
||||
KbfxDataSource *data = new KbfxDataSource ();
|
||||
|
||||
QString name;
|
||||
std::map < std::string, std::string >::const_iterator it =
|
||||
hits.hits[i].properties.find ( "title" );
|
||||
|
||||
QString filename ( hits.hits[i].uri.c_str () );
|
||||
|
||||
if ( filename.contains ( ".tar." ) > 0 )
|
||||
{
|
||||
filename = "tar:" + filename;
|
||||
kdDebug() << filename << endl;
|
||||
}
|
||||
|
||||
if ( it != hits.hits[i].properties.end () )
|
||||
{
|
||||
name = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint pos = hits.hits[i].uri.rfind ( '/' );
|
||||
if ( pos == std::string::npos )
|
||||
{
|
||||
name = hits.hits[i].uri;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = hits.hits[i].uri.substr ( pos + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data->setName ( name );
|
||||
|
||||
|
||||
|
||||
data->setCommand ( "kfmclient exec " + filename );
|
||||
|
||||
|
||||
|
||||
QString iconname =
|
||||
KMimeType::mimeType ( hits.hits[i].mimetype.c_str () )->
|
||||
icon ( QString::null, 0 );
|
||||
data->setIconPath ( iconname );
|
||||
datagroup->addItem ( data );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KbfxDataSource *data = new KbfxDataSource ();
|
||||
data->setName ( "Start Strigi" );
|
||||
data->setComment ( "Strigi Daemon down" );
|
||||
data->setCommand ( "strigidaemon &" );
|
||||
}
|
||||
|
||||
return datagroup;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_STRIGI_PLUGIN_H
|
||||
#define KBFX_STRIGI_PLUGIN_H
|
||||
|
||||
//#include "kbfxplasmacanvasstack.h"
|
||||
//#include "kbfxplasmacanvasitemwrapper.h"
|
||||
#include "kbfxdatastack.h"
|
||||
#include <asyncsocketclient.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kmimetype.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
KbfxDataStack * view();
|
||||
QString name(); //Name of the Plugin My Music .if TOM Create..Configure ..
|
||||
QString type(); //Type of the plugin ex: Application : Amork : kio ..etc
|
||||
uint id(); //A id for menus
|
||||
KbfxDataGroup * search ( QString str );
|
||||
// KbfxPlasmaCanvasGroup * search(QString _keyword,QCanvas * canvas); //search and return a group
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
ADD_POFILES("kbfxconfigapp")
|
@ -0,0 +1,4 @@
|
||||
FILE(GLOB PNGFILES *.png kbfxlayoutrc kbfxfontrc version-2 )
|
||||
|
||||
INSTALL(FILES ${PNGFILES}
|
||||
DESTINATION ${DATA_INSTALL_DIR}/kbfx/skins/2panels)
|
After Width: | Height: | Size: 29 KiB |
@ -0,0 +1,15 @@
|
||||
[Fonts]
|
||||
ApplicationText=0,0,0
|
||||
ApplicationTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
CommentText=47,63,85
|
||||
CommentTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
GroupText=0,0,0
|
||||
GroupTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
HoverBold=false
|
||||
LineColor=47,63,85
|
||||
PluginColor=47,63,85
|
||||
PluginFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
SeparatorColor=47,63,85
|
||||
SeparatorFont=Arial,8,-1,5,75,0,0,0,0,0
|
||||
UserName=255,255,255
|
||||
UserNameFont=Arial,10,-1,5,75,0,0,0,0,0
|
@ -0,0 +1,66 @@
|
||||
[BottomBar]
|
||||
Height=38
|
||||
Width=410
|
||||
X=0
|
||||
Y=428
|
||||
|
||||
[ItemProperties]
|
||||
CommentMargin=66
|
||||
IconSize=32
|
||||
NoComments=false
|
||||
|
||||
[ItemView]
|
||||
Height=467
|
||||
Width=256
|
||||
X=0
|
||||
Y=95
|
||||
|
||||
[KbfxButton]
|
||||
FadeTime=75
|
||||
|
||||
[ListBox]
|
||||
Height=100
|
||||
Width=154
|
||||
X=256
|
||||
Y=95
|
||||
|
||||
[MainMenu]
|
||||
ContractedMenu=false
|
||||
UserMenuHeight=600
|
||||
UserMenuWidth=410
|
||||
|
||||
[Scrollbars]
|
||||
ScrollBarBotX=0
|
||||
ScrollBarBotY=51
|
||||
ScrollBarTopX=0
|
||||
ScrollBarTopY=62
|
||||
|
||||
[SearchBox]
|
||||
FixedPos=true
|
||||
Height=22
|
||||
Width=193
|
||||
X=20
|
||||
Y=570
|
||||
|
||||
[ToolBar]
|
||||
ButtonNormalSize=48
|
||||
ButtonPressedSize=48
|
||||
|
||||
[TopBar]
|
||||
DisableUserName=false
|
||||
DudeX=311
|
||||
DudeY=0
|
||||
FaceH=52
|
||||
FaceW=52
|
||||
FaceX=8
|
||||
FaceY=7
|
||||
Height=95
|
||||
UserNameX=292
|
||||
UserNameY=84
|
||||
Width=410
|
||||
X=0
|
||||
Y=0
|
||||
|
||||
[WaterEffect]
|
||||
EnableWater=false
|
||||
FrameRate=20
|
@ -0,0 +1,5 @@
|
||||
[ThemeGeneral]
|
||||
ThemeVersion=1.0
|
||||
AuthorName=Nookie
|
||||
AuthorEmail=nookie@mail.kbfx.org
|
||||
Homepage=http://www.kbfx.org
|
@ -0,0 +1,4 @@
|
||||
FILE(GLOB PNGFILES *.png kbfxlayoutrc kbfxfontrc version-2 )
|
||||
|
||||
INSTALL(FILES ${PNGFILES}
|
||||
DESTINATION ${DATA_INSTALL_DIR}/kbfx/skins/default)
|
After Width: | Height: | Size: 29 KiB |
@ -0,0 +1,15 @@
|
||||
[Fonts]
|
||||
ApplicationText=0,0,0
|
||||
ApplicationTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
CommentText=128,125,0
|
||||
CommentTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
GroupText=0,0,0
|
||||
GroupTextFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
HoverBold=false
|
||||
LineColor=255,220,125
|
||||
PluginColor=0,0,0
|
||||
PluginFont=Arial,8,-1,5,50,0,0,0,0,0
|
||||
SeparatorColor=0,0,0
|
||||
SeparatorFont=Arial,8,-1,5,75,0,0,0,0,0
|
||||
UserName=255,255,255
|
||||
UserNameFont=Arial,10,-1,5,75,0,0,0,0,0
|
@ -0,0 +1,26 @@
|
||||
[MainMenu]
|
||||
UserMenuHeight=513
|
||||
UserMenuWidth=504
|
||||
|
||||
[BotBar]
|
||||
Height=38
|
||||
Width=504
|
||||
|
||||
[SearchBox]
|
||||
Width=240
|
||||
x=130
|
||||
|
||||
[TopBar]
|
||||
Height=95
|
||||
Width=504
|
||||
DudeY=-1
|
||||
DudeX=-1
|
||||
UserNameX=130
|
||||
UserNameY=32
|
||||
|
||||
[ListBox]
|
||||
Width=132
|
||||
|
||||
[ItemView]
|
||||
Width=240
|
||||
x=132
|
@ -0,0 +1,5 @@
|
||||
[ThemeGeneral]
|
||||
ThemeVersion=1.0
|
||||
AuthorName=Nookie
|
||||
AuthorEmail=nookie@mail.kbfx.org
|
||||
Homepage=http://www.kbfx.org
|
@ -0,0 +1,62 @@
|
||||
SET(libkbfxspinxsrc
|
||||
kbfxbutton.cpp
|
||||
kbfxplasmacanvasabstractitem.cpp
|
||||
kbfxplasmacanvasgroup.cpp
|
||||
kbfxplasmacanvasgroupview.cpp
|
||||
kbfxplasmacanvasitem.cpp
|
||||
kbfxplasmacanvasitem_events.cpp
|
||||
kbfxplasmacanvasitemwrapper.cpp
|
||||
kbfxplasmacanvasstack.cpp
|
||||
kbfxplasmacanvasview.cpp
|
||||
kbfxplasmaindexitem.cpp
|
||||
kbfxplasmaindexview.cpp
|
||||
kbfxspinx.cpp
|
||||
kbfxspinxmenu.cpp
|
||||
kbfxspinxpopup.cpp
|
||||
kbfxspinxscrollbar.cpp
|
||||
kbfxspinxtoolbar.cpp
|
||||
kbfxspinxtoolbutton.cpp
|
||||
kbfxspinxtop.cpp
|
||||
kbfxspinxview.cpp
|
||||
kbfxtooltip.cpp
|
||||
)
|
||||
|
||||
IF (NOT USE_KDE4)
|
||||
KDE3_ADD_DCOP_SKELS(libkbfxspinxsrc kbfxspinx.h)
|
||||
KDE3_AUTOMOC(${libkbfxspinxsrc})
|
||||
|
||||
ADD_LIBRARY(kbfxspinx MODULE ${libkbfxspinxsrc})
|
||||
SET_TARGET_PROPERTIES(kbfxspinx
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
# SET_TARGET_PROPERTIES(kbfxspinx PROPERTIES
|
||||
# SOVERSION ${LIB_MAJOR}
|
||||
# VERSION ${APPLICATION_VERSION})
|
||||
TARGET_LINK_LIBRARIES(kbfxspinx
|
||||
kbfxdata
|
||||
kbfxcommon
|
||||
${QT_AND_KDECORE_LIBS}
|
||||
${KDE3_UI_LIBRARY}
|
||||
)
|
||||
|
||||
KDE3_INSTALL_LIBTOOL_FILE(kbfxspinx ${PLUGIN_INSTALL_DIR})
|
||||
ELSE (NOT USE_KDE4)
|
||||
# TODO: Have to rewrite it for DBUS.
|
||||
# Rewrite the DCOP interface (in src/) to DBUS for KDE4 support.
|
||||
# Should be done in a way to preserve KDE3 compatibility!
|
||||
KDE4_ADD_DCOP_SKELS(libkbfxspinxsrc kbfxspinx.h)
|
||||
KDE4_AUTOMOC(${libkbfxspinxsrc})
|
||||
|
||||
KDE4_ADD_LIBRARY(kbfxspinx MODULE ${libkbfxspinxsrc})
|
||||
TARGET_LINK_LIBRARIES(kbfxspinx
|
||||
kbfxdata
|
||||
kbfxcommon
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
)
|
||||
|
||||
KDE4_INSTALL_LIBTOOL_FILE(kbfxspinx ${PLUGIN_INSTALL_DIR})
|
||||
ENDIF (NOT USE_KDE4)
|
||||
|
||||
INSTALL(TARGETS kbfxspinx DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
INSTALL(FILES kbfxspinx.desktop DESTINATION ${DATA_INSTALL_DIR}/kicker/applets)
|
@ -0,0 +1,417 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <config.h>
|
||||
|
||||
#include "kbfxbutton.h"
|
||||
|
||||
|
||||
bool KbfxButton::m_sizeHeight = TRUE;
|
||||
int KbfxButton::m_size = 0;
|
||||
|
||||
KbfxButton::KbfxButton ( QWidget * parent, const char *name) :
|
||||
QLabel ( parent,name,Qt::WStaticContents | Qt::WNoAutoErase |Qt::WPaintDesktop )
|
||||
{
|
||||
setLineWidth ( 0 );
|
||||
setScaledContents ( false );
|
||||
setAcceptDrops ( true );
|
||||
m_dcopClient = new DCOPClient ();
|
||||
m_dcopClient->attach ();
|
||||
m_fadeTime = ConfigInit().m_fadeTime;
|
||||
|
||||
/* Init normal size first */
|
||||
m_kicker_auto_adjust = TRUE;
|
||||
loadSkins();
|
||||
m_kicker_auto_adjust = ConfigInit().m_ToolBarResize;
|
||||
|
||||
m_toggle = false;
|
||||
QTimer * timer = new QTimer ( this,"Update Timer" );
|
||||
connect ( timer,SIGNAL ( timeout() ),this,SLOT ( update() ) );
|
||||
timer->start ( 25,false );
|
||||
|
||||
fade_timer = new QTimer ( this,"Fade Timer" );
|
||||
connect ( fade_timer,SIGNAL ( timeout() ),this,SLOT ( fade() ) );
|
||||
}
|
||||
|
||||
KbfxButton::~KbfxButton()
|
||||
{
|
||||
}
|
||||
|
||||
void KbfxButton::loadSkins()
|
||||
{
|
||||
QImage _tmpHover, _tmpPressed, _tmpNormal;
|
||||
_tmpHover = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_KbfxHoverButtonPath ) ) ?
|
||||
QImage ( ConfigInit ().m_KbfxHoverButtonPath )
|
||||
: QImage ( ConfigInit ().m_KbfxHoverButtonPathDefault );
|
||||
_tmpPressed = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_KbfxPressedButtonPath ) ) ?
|
||||
QImage ( ConfigInit ().m_KbfxPressedButtonPath )
|
||||
: QImage ( ConfigInit ().m_KbfxPressedButtonPathDefault );
|
||||
_tmpNormal = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_KbfxNormalButtonPath ) ) ?
|
||||
QImage ( ConfigInit ().m_KbfxNormalButtonPath )
|
||||
: QImage ( ConfigInit ().m_KbfxNormalButtonPathDefault );
|
||||
|
||||
QSize _sizeNormal = _tmpNormal.size();
|
||||
_tmpHover = _tmpHover.smoothScale ( _sizeNormal, QImage::ScaleFree );
|
||||
_tmpPressed = _tmpPressed.smoothScale ( _sizeNormal, QImage::ScaleFree );
|
||||
|
||||
|
||||
if ( !m_kicker_auto_adjust )
|
||||
{
|
||||
if ( m_sizeHeight )
|
||||
{
|
||||
_tmpHover = _tmpHover.smoothScale ( _tmpHover.width(), m_size, QImage::ScaleMin );
|
||||
_tmpPressed = _tmpPressed.smoothScale ( _tmpPressed.width(), m_size, QImage::ScaleMin );
|
||||
_tmpNormal = _tmpNormal.smoothScale ( _tmpNormal.width(), m_size, QImage::ScaleMin );
|
||||
}
|
||||
else
|
||||
{
|
||||
_tmpHover = _tmpHover.smoothScale ( m_size, _tmpHover.height(), QImage::ScaleMin );
|
||||
_tmpPressed = _tmpPressed.smoothScale ( m_size, _tmpPressed.height(), QImage::ScaleMin );
|
||||
_tmpNormal = _tmpNormal.smoothScale ( m_size, _tmpNormal.height(), QImage::ScaleMin );
|
||||
}
|
||||
}
|
||||
m_over_skin = QPixmap ( _tmpHover );
|
||||
m_normal_skin = QPixmap ( _tmpNormal );
|
||||
m_pressed_skin = QPixmap ( _tmpPressed );
|
||||
m_current_skin = m_normal_skin;
|
||||
this->resize ( m_current_skin.width(),m_current_skin.height() );
|
||||
this->repaint();
|
||||
}
|
||||
|
||||
QCString KbfxButton::findPanel()
|
||||
{
|
||||
QCString m_AppletPanel = QCString ("kicker");
|
||||
QCStringList objects=m_dcopClient->remoteObjects("kicker");
|
||||
|
||||
for( QCStringList::ConstIterator it = objects.begin();
|
||||
it != objects.end();
|
||||
++it)
|
||||
{
|
||||
if ( (*it).contains ( "Panel" ) > 0 )
|
||||
{
|
||||
DCOPRef _dcop_obj ( "kicker", (*it) );
|
||||
QStringList _dcop_obj_applets =_dcop_obj.call ( "listApplets()" );
|
||||
|
||||
for ( QStringList::Iterator _it = _dcop_obj_applets.begin();
|
||||
_it != _dcop_obj_applets.end();
|
||||
_it++ )
|
||||
{
|
||||
if ( ( *_it ).contains ( "kbfx" ) )
|
||||
{
|
||||
m_AppletPanel = (*it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
kdDebug () << "KBFX resides on panel: " << m_AppletPanel << endl;
|
||||
return m_AppletPanel;
|
||||
}
|
||||
|
||||
void KbfxButton::readjust( bool _how )
|
||||
{
|
||||
/* _how = TRUE is for height, _how = FALSE is for width readjust */
|
||||
QCString _panel = findPanel();
|
||||
int _tmp_size;
|
||||
if ( _how )
|
||||
{
|
||||
_tmp_size = this->height ();
|
||||
kdDebug () << "Readjusting " << _panel << " to height: " << _tmp_size << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tmp_size = this->width ();
|
||||
kdDebug () << "Readjusting " << _panel << " to width: " << _tmp_size << endl;
|
||||
}
|
||||
QByteArray data;
|
||||
QDataStream arg ( data, IO_WriteOnly );
|
||||
arg << _tmp_size ;
|
||||
if ( !m_dcopClient->send ( "kicker", _panel, "setPanelSize(int)", data ) )
|
||||
kdWarning ()
|
||||
<< "Could not send DCOP command to:"
|
||||
<< _panel
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void KbfxButton::enterEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
if ( m_toggle == true )
|
||||
{
|
||||
// m_current_skin = m_pressed_skin; // no fade code
|
||||
m_fadePix = m_pressed_skin;
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_current_skin = m_over_skin; // no fade code
|
||||
m_fadePix = m_over_skin;
|
||||
|
||||
emit showToolTip ();
|
||||
}
|
||||
fade();
|
||||
}
|
||||
|
||||
void KbfxButton::fade ( )
|
||||
{
|
||||
if ( m_fadeTime == 0 )
|
||||
{
|
||||
m_current_skin = m_fadePix;
|
||||
}
|
||||
else
|
||||
{
|
||||
QImage _final = m_fadePix.convertToImage ();
|
||||
QImage _current = m_current_skin.convertToImage ();
|
||||
|
||||
if ( !fade_timer->isActive ())
|
||||
{
|
||||
m_opacity = 0;
|
||||
fade_timer->start( m_fadeTime, false);
|
||||
}
|
||||
if ( m_opacity > 0.9 )
|
||||
fade_timer->stop();
|
||||
m_opacity += 0.1;
|
||||
|
||||
KImageEffect::blend ( _final, _current, m_opacity);
|
||||
m_current_skin = QPixmap ( _current );
|
||||
}
|
||||
this->resize ( m_current_skin.size() );
|
||||
this->update();
|
||||
}
|
||||
|
||||
void KbfxButton::leaveEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
|
||||
if ( m_toggle )
|
||||
{
|
||||
// m_current_skin = m_pressed_skin; // no fade code
|
||||
m_fadePix = m_pressed_skin;
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_current_skin = m_normal_skin; // no fade code
|
||||
m_fadePix = m_normal_skin;
|
||||
}
|
||||
fade();
|
||||
emit leave ();
|
||||
}
|
||||
|
||||
void KbfxButton::toggle()
|
||||
{
|
||||
if (this->hasMouse() ) {
|
||||
m_fadePix = m_over_skin;
|
||||
}else {
|
||||
|
||||
m_fadePix = m_normal_skin;
|
||||
m_toggle = false;
|
||||
}
|
||||
fade();
|
||||
}
|
||||
|
||||
void KbfxButton::toggleKMenu()
|
||||
{
|
||||
// m_current_skin = m_normal_skin;
|
||||
m_fadePix = m_normal_skin;
|
||||
fade();
|
||||
m_toggle = false;
|
||||
}
|
||||
|
||||
void KbfxButton::mousePressEvent ( QMouseEvent * e )
|
||||
{
|
||||
e->accept();
|
||||
if ( e->button() == QMouseEvent::LeftButton )
|
||||
{
|
||||
if ( m_toggle == false )
|
||||
{
|
||||
// m_current_skin = m_pressed_skin; // no fade code
|
||||
m_toggle = true;
|
||||
m_fadePix = m_pressed_skin;
|
||||
fade();
|
||||
emit pressed();
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_current_skin = m_normal_skin; // no fade code
|
||||
m_toggle = false;
|
||||
if (hasMouse() ) {
|
||||
m_fadePix = m_over_skin;
|
||||
}else {
|
||||
|
||||
m_fadePix = m_normal_skin;
|
||||
}
|
||||
|
||||
fade();
|
||||
emit hideMenu();
|
||||
}
|
||||
emit clicked ();
|
||||
}
|
||||
|
||||
if ( e->button() == QMouseEvent::RightButton )
|
||||
{
|
||||
m_fadePix = m_normal_skin;
|
||||
fade();
|
||||
m_toggle = false;
|
||||
|
||||
QPopupMenu *popup = new QPopupMenu();
|
||||
|
||||
popup->insertItem ( SmallIcon ( "remove" ), i18n ( "Remove KBFX from Pannel" ),
|
||||
this, SLOT ( selfDeleter() ) );
|
||||
popup->insertItem ( SmallIcon ( "reload" ),i18n ( "Reload KBFX" ),
|
||||
this, SLOT ( reloadConfig() ) );
|
||||
popup->insertSeparator();
|
||||
popup->insertItem ( SmallIcon ( "kbfxconfigapp" ), i18n ( "Configure KBFX" ),
|
||||
this, SLOT ( openConfigDialog() ) );
|
||||
popup->insertItem ( SmallIcon ( "kmenuedit" ),i18n ( "Edit Applications Menu" ),
|
||||
this, SLOT ( openKmenuEdit() ) );
|
||||
popup->exec ( e->globalPos() );
|
||||
delete popup;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxButton::reloadConfig()
|
||||
{
|
||||
/*
|
||||
DCOPRef m_kickerkbfxDevelnterface ( "kicker","KBFXInterface" );
|
||||
m_kickerkbfxDevelnterface.call ( "notifyConfigChange()" );
|
||||
m_kickerkbfxDevelnterface.call ( "notifyConfigChange()" );
|
||||
*/
|
||||
|
||||
DCOPRef m_kickerPanel("kicker", findPanel());
|
||||
m_kickerPanel.call("restart()");
|
||||
}
|
||||
|
||||
void KbfxButton::selfDeleter()
|
||||
{
|
||||
DCOPRef m_kickerPanel ( "kicker", findPanel() );
|
||||
QStringList returnQStringList =m_kickerPanel.call ( "listApplets()" );
|
||||
int _myIndex = 0;
|
||||
|
||||
QStringList::Iterator it;
|
||||
|
||||
for ( it = returnQStringList.begin();it != returnQStringList.end();it++ )
|
||||
{
|
||||
if ( ( *it ).contains ( "kbfx" ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
_myIndex++;
|
||||
}
|
||||
|
||||
m_kickerPanel.call ( "removeApplet(int)", _myIndex );
|
||||
}
|
||||
|
||||
void KbfxButton::openKmenuEdit()
|
||||
{
|
||||
#ifdef HAVE_MANDRAKE
|
||||
KRun::runCommand ( "menudrake" );
|
||||
#else
|
||||
KRun::runCommand ( "kmenuedit" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void KbfxButton::openConfigDialog()
|
||||
{
|
||||
KRun::runCommand ( "kbfxconfigapp" );
|
||||
}
|
||||
|
||||
void KbfxButton::paintEvent ( QPaintEvent * pe )
|
||||
{
|
||||
|
||||
QPainter p;
|
||||
if ( !m_current_skin.isNull () )
|
||||
{
|
||||
QRect r = QRect ( pe->rect().x(),pe->rect().y(),m_current_skin.width(),m_current_skin.height() );
|
||||
m_buffer = new QPixmap();
|
||||
m_buffer->resize ( r.size() );
|
||||
m_buffer->fill ( this, r.topLeft() );
|
||||
|
||||
p.begin ( m_buffer,this );
|
||||
p.translate ( -r.x(), -r.y() );
|
||||
p.drawPixmap ( r,m_current_skin );
|
||||
p.end ();
|
||||
bitBlt ( this, r.x(), r.y(),m_buffer, 0, 0,m_current_skin.width(), m_current_skin.height() );
|
||||
delete m_buffer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void KbfxButton::dragEnterEvent ( QDragEnterEvent * e )
|
||||
{
|
||||
e->accept ( QUriDrag::canDecode ( e ) );
|
||||
kdDebug() << "Accepting KBFX button drag..." << endl;
|
||||
}
|
||||
|
||||
void KbfxButton::dropEvent ( QDropEvent * e )
|
||||
{
|
||||
QStringList filelist;
|
||||
QString _hover, _normal, _pressed, _tmp;
|
||||
QImage _hover_pix, _normal_pix, _pressed_pix;
|
||||
QUriDrag::decodeLocalFiles ( e, filelist );
|
||||
|
||||
for ( QStringList::Iterator it = filelist.begin(); it != filelist.end(); ++it )
|
||||
{
|
||||
_tmp = ( *it );
|
||||
kdDebug() << "KBFX button dropped file: " << _tmp << endl;
|
||||
if ( _tmp.contains ( "hover", FALSE ) > 0 )
|
||||
{
|
||||
_hover = _tmp;
|
||||
_hover_pix = QImage ( _tmp );
|
||||
}
|
||||
if ( _tmp.contains ( "normal", FALSE ) > 0 )
|
||||
{
|
||||
_normal = _tmp;
|
||||
_normal_pix = QImage ( _tmp );
|
||||
}
|
||||
if ( _tmp.contains ( "pressed", FALSE ) > 0 )
|
||||
{
|
||||
_pressed = _tmp;
|
||||
_pressed_pix = QImage ( _tmp );
|
||||
}
|
||||
}
|
||||
|
||||
kdDebug() << "KBFX button hover: " << _hover << endl
|
||||
<< "KBFX button normal: " << _normal << endl
|
||||
<< "KBFX button pressed: " << _pressed << endl;
|
||||
|
||||
if ( _hover_pix.isNull () ||
|
||||
_normal_pix.isNull () ||
|
||||
_pressed_pix.isNull () )
|
||||
{
|
||||
KMessageBox::error ( 0,
|
||||
tr2i18n ( "Invalid images were dropped!"
|
||||
"\nCannot set the KBFX button to use these images!" ),
|
||||
tr2i18n ( "Error setting KBFX button images" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigInit ().m_KbfxNormalButtonPath = _normal;
|
||||
ConfigInit ().m_KbfxHoverButtonPath = _hover;
|
||||
ConfigInit ().m_KbfxPressedButtonPath = _pressed;
|
||||
ConfigInit().writeThemerc ( ConfigInit().m_SpinxThemeName );
|
||||
|
||||
/* Init normal size first */
|
||||
m_kicker_auto_adjust = TRUE;
|
||||
loadSkins();
|
||||
m_kicker_auto_adjust = ConfigInit().m_ToolBarResize;
|
||||
}
|
||||
|
||||
#include "kbfxbutton.moc"
|
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_BUTTON_H
|
||||
#define KBFX_BUTTON_H
|
||||
|
||||
#include <qdragobject.h>
|
||||
#include <qimage.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <dcopclient.h>
|
||||
#include <dcopref.h>
|
||||
#include <kdebug.h>
|
||||
#include <kimageeffect.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kpopupmenu.h>
|
||||
#include <krun.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
|
||||
class QPixmap;
|
||||
class QLabel;
|
||||
|
||||
class KbfxButton:public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxButton ( QWidget * parent, const char * name = 0 );
|
||||
~KbfxButton();
|
||||
void kbfx_vista_button_setFx ( bool choice );
|
||||
virtual void paintEvent ( QPaintEvent *pe );
|
||||
virtual void enterEvent ( QEvent * e ) ;
|
||||
virtual void leaveEvent ( QEvent * e );
|
||||
virtual void mousePressEvent ( QMouseEvent * e );
|
||||
virtual void dropEvent ( QDropEvent *e );
|
||||
virtual void dragEnterEvent ( QDragEnterEvent *e );
|
||||
static bool m_sizeHeight;
|
||||
static int m_size;
|
||||
QCString findPanel();
|
||||
void readjust( bool );
|
||||
|
||||
public slots:
|
||||
void loadSkins();
|
||||
void toggle();
|
||||
void toggleKMenu();
|
||||
void fade();
|
||||
void reloadConfig();
|
||||
void openKmenuEdit();
|
||||
void selfDeleter();
|
||||
void openConfigDialog();
|
||||
|
||||
signals:
|
||||
void pressed();
|
||||
void hideMenu();
|
||||
void leave ();
|
||||
void clicked ();
|
||||
void showToolTip ();
|
||||
|
||||
protected:
|
||||
QPixmap m_over_skin;
|
||||
QPixmap m_pressed_skin;
|
||||
QPixmap m_release_skin;
|
||||
QPixmap m_normal_skin;
|
||||
QPixmap m_current_skin;
|
||||
|
||||
// mng support ???
|
||||
QPixmap * m_buffer;
|
||||
QTimer * m_anime_timer;
|
||||
QMovie * m_normal_anime;
|
||||
QMovie * m_pressed_anime;
|
||||
QMovie * m_hover_anime;
|
||||
QMovie * m_current_anime;
|
||||
QString m_normal_path;
|
||||
QString m_over_path;
|
||||
QString m_pressed_path;
|
||||
bool m_anime_on;
|
||||
bool m_kicker_auto_adjust;
|
||||
DCOPClient * m_dcopClient;
|
||||
|
||||
/* state of the button */
|
||||
bool m_toggle;
|
||||
QTimer * fade_timer;
|
||||
float m_opacity;
|
||||
QPixmap m_fadePix;
|
||||
int m_fadeTime;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// C++ Implementation: kbfxplasmacanvasabstractitem
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Siraj Razick <siraj@kdemail.net>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#include "kbfxplasmacanvasabstractitem.h"
|
||||
|
||||
|
||||
KbfxPlasmaCanvasAbstractItem::KbfxPlasmaCanvasAbstractItem ( QCanvasPixmapArray * a, QCanvas * canvas )
|
||||
: QCanvasSprite ( a,canvas )
|
||||
{
|
||||
|
||||
m_source=0;
|
||||
}
|
||||
|
||||
|
||||
KbfxPlasmaCanvasAbstractItem::~KbfxPlasmaCanvasAbstractItem()
|
||||
{}
|
||||
|
||||
// void
|
||||
// KbfxPlasmaCanvasAbstractItem::setSelected()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
void KbfxPlasmaCanvasAbstractItem::setCurrent ( bool state )
|
||||
{
|
||||
m_current = state;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
KbfxPlasmaCanvasAbstractItem::isCurrent()
|
||||
{
|
||||
return m_current;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasAbstractItem::mousePressEvent ( QMouseEvent * e )
|
||||
{
|
||||
e = e;
|
||||
}
|
||||
void
|
||||
KbfxPlasmaCanvasAbstractItem::mouseMoveEvent ( QMouseEvent * e )
|
||||
{
|
||||
e = e;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasAbstractItem::enterEvent ( QEvent * e )
|
||||
{
|
||||
e =e ;
|
||||
}
|
||||
|
||||
|
||||
void KbfxPlasmaCanvasAbstractItem::mouseReleaseEvent ( QMouseEvent * e )
|
||||
{
|
||||
e =e ;
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
void KbfxPlasmaCanvasAbstractItem::exec()
|
||||
{
|
||||
if ( m_source == 0 )
|
||||
return;
|
||||
|
||||
|
||||
m_source->exec();
|
||||
}
|
||||
|
||||
|
||||
void KbfxPlasmaCanvasAbstractItem::hideit()
|
||||
{
|
||||
this->hide();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasAbstractItem::draw ( QPainter& pe )
|
||||
{
|
||||
this->drawContent ( &pe );
|
||||
}
|
||||
|
||||
|
||||
void KbfxPlasmaCanvasAbstractItem::setLabelText ( QString s )
|
||||
{
|
||||
s = s;
|
||||
}
|
||||
|
||||
QPixmap
|
||||
KbfxPlasmaCanvasAbstractItem::dragPixmap()
|
||||
{
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasAbstractItem::drawContent ( QPainter * p )
|
||||
{
|
||||
p = p ;
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasabstractitem.moc"
|
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_ABSTRACT_ITEM_H
|
||||
#define KBFX_PLASMA_CANVAS_ABSTRACT_ITEM_H
|
||||
|
||||
#include <qcanvas.h>
|
||||
#include <qpainter.h>
|
||||
#include "kbfxplasmacanvasrtti.h"
|
||||
#include <qtimer.h>
|
||||
#include <kdesktopfile.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kiconloader.h>
|
||||
#include "kbfxdatasource.h"
|
||||
#include <krun.h>
|
||||
|
||||
class KbfxPlasmaCanvasAbstractItem:public QObject,public QCanvasSprite
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef enum {EXECUTABLE=0,SEPARATOR,INDEX,OTHER} Type;
|
||||
// typedef enum {RASTER=0,VECTOR,NATIVE} SkinMode;
|
||||
|
||||
KbfxPlasmaCanvasAbstractItem ( QCanvasPixmapArray * a, QCanvas * canvas );
|
||||
virtual ~KbfxPlasmaCanvasAbstractItem ();
|
||||
|
||||
void setCurrent ( bool );
|
||||
virtual Type type() { return m_type; }
|
||||
virtual void setType ( Type t ) { m_type = t;}
|
||||
|
||||
QString name() { if ( m_source != 0 ) return m_source->name(); else return QString ( "Not Set" );};
|
||||
|
||||
void setSource ( KbfxDataSource src );
|
||||
bool isCurrent();
|
||||
virtual int height() { return m_height;}
|
||||
|
||||
virtual int width() { return m_width;}
|
||||
|
||||
virtual bool lookup ( QString str ) {str = str ; return false;}
|
||||
|
||||
virtual int rtti() const { return CANVASITEM;}
|
||||
|
||||
virtual void draw ( QPainter & pe );
|
||||
|
||||
virtual void drawContent ( QPainter * pe );
|
||||
|
||||
virtual QPixmap dragPixmap();
|
||||
|
||||
|
||||
//Event Handling
|
||||
virtual void mousePressEvent ( QMouseEvent * e );
|
||||
virtual void mouseMoveEvent ( QMouseEvent * e );
|
||||
virtual void enterEvent ( QEvent * e );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * e );
|
||||
|
||||
|
||||
virtual void setLabelText ( QString s );
|
||||
|
||||
public slots:
|
||||
virtual void hideit();
|
||||
virtual void exec();
|
||||
signals:
|
||||
void clicked();
|
||||
void leave();
|
||||
void selected ( KbfxPlasmaCanvasAbstractItem* );
|
||||
|
||||
private:
|
||||
|
||||
// KbfxPlasmaCanvasAbstractItem (const KbfxPlasmaCanvasItem &t);
|
||||
KbfxDataSource * m_source;
|
||||
Type m_type;
|
||||
int m_height;
|
||||
int m_width;
|
||||
bool m_current;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
;//C.G
|
||||
|
||||
#endif //M.I.G
|
||||
|
@ -0,0 +1,330 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasgroup.h"
|
||||
|
||||
KbfxPlasmaCanvasGroup::KbfxPlasmaCanvasGroup ()
|
||||
{
|
||||
|
||||
m_height = 0;
|
||||
m_id = 0;
|
||||
// m_count = 0;
|
||||
m_name = QString ( "Unknown" );
|
||||
// bool m_visible = true;
|
||||
m_shaded = false;
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasGroup::~KbfxPlasmaCanvasGroup ()
|
||||
{
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
//qDebug("Trying to delete Item from Rgoup================");
|
||||
// if(*it)
|
||||
// delete (*it);
|
||||
// itemListMap ().remove (*it);
|
||||
if ( ( *it ) != 0 )
|
||||
if ( deleteItem ( ( *it ) ) == false )
|
||||
{
|
||||
qDebug ( "Deleting failed" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasGroup::ItemListMap & KbfxPlasmaCanvasGroup::itemListMap ()
|
||||
{
|
||||
static ItemListMap *
|
||||
map = 0;
|
||||
if ( !map )
|
||||
map = new ItemListMap ();
|
||||
return *map;
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxPlasmaCanvasGroup::deleteItem ( KbfxPlasmaCanvasAbstractItem * it )
|
||||
{
|
||||
//qDebug("Removing Item from Group");
|
||||
// itemListMap ().remove (it);
|
||||
//delete it;
|
||||
//return true;
|
||||
for ( ItemListIter iti ( m_itemList ); *iti; ++iti )
|
||||
{
|
||||
if ( iti == it )
|
||||
{
|
||||
itemListMap ().remove ( *iti );
|
||||
if ( m_itemList.removeRef ( it ) )
|
||||
{
|
||||
if ( m_itemList.isEmpty () )
|
||||
delete this;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug ( "deleting Item failed" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxPlasmaCanvasGroup::addItem ( KbfxPlasmaCanvasAbstractItem * it )
|
||||
{
|
||||
|
||||
if ( it->name().isEmpty() )
|
||||
{
|
||||
qDebug ( "Adding Failed bcos Name Missing" );
|
||||
return false;
|
||||
}
|
||||
ItemListMap::ConstIterator itn = itemListMap ().find ( it );
|
||||
if ( itn != itemListMap ().end () )
|
||||
{
|
||||
qDebug ( "Adding Failed Due to Item not end" );
|
||||
return false;
|
||||
}
|
||||
for ( ItemListIter itr ( m_itemList ); *itr; ++itr )
|
||||
{
|
||||
if ( ( *itr )->lookup ( it->name() ) == true )
|
||||
{
|
||||
qDebug ( "Adding Failed Due to Item already exisits" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int _x = 0;
|
||||
int _y = this->boundingRect ().height ();
|
||||
KbfxPlasmaCanvasGroup *&group = itemListMap () [it];
|
||||
if ( group )
|
||||
{
|
||||
if ( group == this )
|
||||
return true;
|
||||
group->m_itemList.removeRef ( it );
|
||||
if ( group->m_itemList.isEmpty () )
|
||||
delete group;
|
||||
}
|
||||
m_itemList.prepend ( it );
|
||||
m_height += it->height();
|
||||
m_width = it->width();
|
||||
it->move ( _x, _y );
|
||||
group = this;
|
||||
|
||||
if ( it->type() == KbfxPlasmaCanvasAbstractItem::SEPARATOR )
|
||||
m_sepheight = it->height();
|
||||
m_count++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::move ( int x, int y )
|
||||
{
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
( *it )->move ( ( *it )->x () + x, ( *it )->y () + y );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::moveBy ( int x, int y )
|
||||
{
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
( *it )->move ( x, y );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::hide()
|
||||
{
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
// if(*it)
|
||||
( *it )->hide();
|
||||
}
|
||||
m_visible = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::setGroupName ( QString name )
|
||||
{
|
||||
m_name = name;
|
||||
delete [] name;
|
||||
}
|
||||
|
||||
QString
|
||||
KbfxPlasmaCanvasGroup::name()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::showAll()
|
||||
{
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
if ( ( *it )->type() == KbfxPlasmaCanvasAbstractItem::SEPARATOR || m_shaded == false )
|
||||
( *it )->show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::show()
|
||||
{
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
if ( ( *it )->type() == KbfxPlasmaCanvasAbstractItem::SEPARATOR || m_shaded == false )
|
||||
( *it )->show();
|
||||
}
|
||||
m_visible = true;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::shade ()
|
||||
{
|
||||
if ( m_shaded == false )
|
||||
{
|
||||
emit this->groupShade ( this->groupID() );
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
// (*it)->move ((*it)->x (), 0);
|
||||
if ( ( *it )->type() != KbfxPlasmaCanvasAbstractItem::SEPARATOR )
|
||||
( *it )->hide();
|
||||
}
|
||||
m_shaded = true;
|
||||
return;
|
||||
}
|
||||
else if ( m_shaded == true )
|
||||
{
|
||||
int _shadeby = 0;
|
||||
int _firstItemHeight=0;
|
||||
|
||||
emit this->groupUnShade ( this->groupID() );
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
if ( ( *it )->type() != KbfxPlasmaCanvasAbstractItem::SEPARATOR )
|
||||
{
|
||||
// (*it)->move ((*it)->x (), _shadeby);
|
||||
( *it )->show();
|
||||
_shadeby += ( *it )->height ();
|
||||
}
|
||||
else
|
||||
{
|
||||
_shadeby = ( *it )->height ();
|
||||
_firstItemHeight = _shadeby;
|
||||
|
||||
}
|
||||
}
|
||||
m_shaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::moveUp ( int y )
|
||||
{
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
( *it )->move ( ( *it )->x (), ( ( *it )->y () +m_sepheight ) - y );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroup::moveDown ( int y )
|
||||
{
|
||||
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
{
|
||||
( *it )->move ( ( *it )->x (), ( ( *it )->y () - m_sepheight ) + y );
|
||||
}
|
||||
}
|
||||
|
||||
QRect
|
||||
KbfxPlasmaCanvasGroup::boundingRect ()
|
||||
{
|
||||
if ( this->count () == 0 )
|
||||
return QRect ( 0, 0, 0, 0 );
|
||||
|
||||
QRect r;
|
||||
for ( ItemListIter it ( m_itemList ); *it; ++it )
|
||||
r |= ( *it )->boundingRect ();
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
KbfxPlasmaCanvasGroup::count ()
|
||||
{
|
||||
|
||||
return m_itemList.count();
|
||||
}
|
||||
|
||||
int
|
||||
KbfxPlasmaCanvasGroup::height ()
|
||||
{
|
||||
|
||||
return m_height ;
|
||||
}
|
||||
|
||||
int
|
||||
KbfxPlasmaCanvasGroup::width ()
|
||||
{
|
||||
|
||||
return m_width;
|
||||
}
|
||||
|
||||
|
||||
KbfxPlasmaCanvasGroup *
|
||||
KbfxPlasmaCanvasGroup::groupContaining ( KbfxPlasmaCanvasAbstractItem * item )
|
||||
{
|
||||
ItemListMap::ConstIterator it = itemListMap ().find ( item );
|
||||
if ( it == itemListMap ().end () )
|
||||
return 0;
|
||||
else
|
||||
return *it;
|
||||
}
|
||||
|
||||
uint
|
||||
KbfxPlasmaCanvasGroup::groupID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
|
||||
void KbfxPlasmaCanvasGroup::setGroupID ( uint e_id )
|
||||
{
|
||||
m_id = e_id;
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasgroup.moc"
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_GROUP_H
|
||||
#define KBFX_PLASMA_CANVAS_GROUP_H
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qptrlist.h>
|
||||
#include "kbfxplasmacanvasabstractitem.h"
|
||||
#include <qobject.h>
|
||||
class QCanvasItem;
|
||||
class QRect;
|
||||
|
||||
class KbfxPlasmaCanvasGroup:public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QPtrList<KbfxPlasmaCanvasAbstractItem> ItemList;
|
||||
typedef QPtrListIterator<KbfxPlasmaCanvasAbstractItem> ItemListIter;
|
||||
//a Global mapof Groups
|
||||
typedef QMap<KbfxPlasmaCanvasAbstractItem*,KbfxPlasmaCanvasGroup*> ItemListMap;
|
||||
|
||||
KbfxPlasmaCanvasGroup();
|
||||
virtual ~KbfxPlasmaCanvasGroup();
|
||||
|
||||
bool addItem ( KbfxPlasmaCanvasAbstractItem * );
|
||||
bool deleteItem ( KbfxPlasmaCanvasAbstractItem * );
|
||||
void move ( int x,int y );
|
||||
void moveBy ( int x,int y );
|
||||
QString name();
|
||||
QRect boundingRect();
|
||||
int count();
|
||||
int height();
|
||||
int width();
|
||||
static KbfxPlasmaCanvasGroup * groupContaining ( KbfxPlasmaCanvasAbstractItem * );
|
||||
QString groupName();
|
||||
uint groupID();
|
||||
void setGroupName ( QString name );
|
||||
void setGroupID ( uint );
|
||||
bool isShaded() {return m_shaded;};
|
||||
virtual int rtti() { return 1005;}
|
||||
void showAll();
|
||||
|
||||
public slots:
|
||||
void moveUp ( int );
|
||||
void moveDown ( int );
|
||||
void shade();//folding action
|
||||
void hide();
|
||||
void show();
|
||||
signals:
|
||||
void groupShade ( uint id );
|
||||
void groupUnShade ( uint id );
|
||||
|
||||
|
||||
|
||||
private :
|
||||
ItemList m_itemList;
|
||||
static ItemListMap& itemListMap();
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_height;
|
||||
int m_width;
|
||||
//state variables
|
||||
bool m_shaded;
|
||||
bool m_visible;
|
||||
QString m_name;
|
||||
uint m_id;
|
||||
int m_sepheight;
|
||||
int m_count;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasgroupview.h"
|
||||
|
||||
KbfxPlasmaCanvasGroupView::KbfxPlasmaCanvasGroupView ()
|
||||
{
|
||||
m_groupChain.setAutoDelete ( true );
|
||||
m_count = 0;
|
||||
m_height = 0;
|
||||
m_width = 0;
|
||||
m_name = QString ( "Unkown" );
|
||||
m_fullExpand = false;
|
||||
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasGroupView::~KbfxPlasmaCanvasGroupView ()
|
||||
{
|
||||
// delete [] m_name;
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
m_groupChain.at ( i )->~KbfxPlasmaCanvasGroup();
|
||||
m_groupChain.remove ( m_groupChain.at ( i ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::addGroup ( KbfxPlasmaCanvasGroup * gPtr )
|
||||
{
|
||||
if ( gPtr == NULL )
|
||||
{
|
||||
qDebug
|
||||
( "KbfxPlasmaCanvasGroupView.cpp:39:Null Pointer Passed to addGroup()" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
gPtr->setGroupID ( ( uint ) m_count );
|
||||
m_height+= gPtr->height();
|
||||
m_width = gPtr->width();
|
||||
gPtr->move ( 0,m_height-gPtr->height() );
|
||||
m_groupChain.append ( gPtr );
|
||||
// gPtr->show();
|
||||
// qDebug("adding Groupy");
|
||||
m_count++;
|
||||
connect ( gPtr, SIGNAL ( groupShade ( uint ) ), this,
|
||||
SLOT ( foldGroup ( uint ) ) );
|
||||
connect ( gPtr, SIGNAL ( groupUnShade ( uint ) ), this,
|
||||
SLOT ( unFoldGroup ( uint ) ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasGroupView *
|
||||
KbfxPlasmaCanvasGroupView::contains ( KbfxPlasmaCanvasGroup * )
|
||||
{
|
||||
//maybe I don't need this
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::setName ( QString name )
|
||||
{
|
||||
m_name = name;
|
||||
//delete [] name;
|
||||
}
|
||||
|
||||
QString
|
||||
KbfxPlasmaCanvasGroupView::name()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::foldGroupAll ()
|
||||
{
|
||||
///not too many groups and needs fast shading so ...this
|
||||
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
if ( m_groupChain.at ( i ) )
|
||||
if ( !m_groupChain.at ( i )->isShaded() )
|
||||
m_groupChain.at ( i )->shade ();
|
||||
}
|
||||
|
||||
m_fullExpand = true;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::unfoldGroupAll ()
|
||||
{
|
||||
///not too many groups and needs fast shading so ...this
|
||||
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
if ( m_groupChain.at ( i ) )
|
||||
if ( m_groupChain.at ( i )->isShaded() )
|
||||
m_groupChain.at ( i )->shade ();
|
||||
}
|
||||
|
||||
m_fullExpand = true;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::hide ()
|
||||
{
|
||||
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
if ( m_groupChain.at ( i ) )
|
||||
// if( m_groupChain.at (i)->isShaded())
|
||||
m_groupChain.at ( i )->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::show()
|
||||
{
|
||||
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
// if (m_groupChain.at (i))
|
||||
// if( m_groupChain.at (i)->isShaded())
|
||||
/// unFoldGroup(i);
|
||||
|
||||
m_groupChain.at ( i )->show();
|
||||
///qDebug("Showing group %d",i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::foldGroup ( uint e_id )
|
||||
{
|
||||
|
||||
KbfxPlasmaCanvasGroup *_it;
|
||||
KbfxPlasmaCanvasGroup *_et = m_groupChain.at ( e_id );
|
||||
if ( _et == NULL )
|
||||
return;
|
||||
|
||||
int _height = _et->height ();
|
||||
//int _shadestate = _et->isShaded ();
|
||||
|
||||
for ( _it = m_groupChain.first (); _it; _it = m_groupChain.next () )
|
||||
{
|
||||
if ( e_id != _it->groupID () )
|
||||
{
|
||||
if ( _it->groupID () > e_id )
|
||||
{
|
||||
_it->moveUp ( _height );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasGroupView::unFoldGroup ( uint e_id )
|
||||
{
|
||||
KbfxPlasmaCanvasGroup *_it;
|
||||
KbfxPlasmaCanvasGroup *_et = m_groupChain.at ( e_id );
|
||||
if ( _et == NULL )
|
||||
{
|
||||
qDebug ( "OOps no such groups can't unfold" );
|
||||
return;
|
||||
}
|
||||
|
||||
int _height = _et->height ();
|
||||
//int _shadestate = _et->isShaded ();
|
||||
|
||||
for ( _it = m_groupChain.first (); _it; _it = m_groupChain.next () )
|
||||
{
|
||||
if ( e_id != _it->groupID () )
|
||||
{
|
||||
if ( _it->groupID () > e_id )
|
||||
{
|
||||
_it->moveDown ( _height );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasgroupview.moc"
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_GROUP_VIEW_H
|
||||
#define KBFX_PLASMA_CANVAS_GROUP_VIEW_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qptrlist.h>
|
||||
#include "kbfxplasmacanvasgroup.h"
|
||||
|
||||
/**
|
||||
This class will manager a list of Groups.
|
||||
**/
|
||||
|
||||
|
||||
class KbfxPlasmaCanvasGroupView:public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef QPtrList<KbfxPlasmaCanvasGroup> groupPtrList;
|
||||
|
||||
KbfxPlasmaCanvasGroupView();
|
||||
virtual ~KbfxPlasmaCanvasGroupView();
|
||||
|
||||
void addGroup ( KbfxPlasmaCanvasGroup* );
|
||||
void deleteGroup ( KbfxPlasmaCanvasGroup* );
|
||||
KbfxPlasmaCanvasGroupView* contains ( KbfxPlasmaCanvasGroup* );
|
||||
virtual int rtti() {return 1006;}
|
||||
void predend ( KbfxPlasmaCanvasGroup* );
|
||||
void append ( KbfxPlasmaCanvasGroup * );
|
||||
int height()
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
int width()
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
void setName ( QString name );
|
||||
QString name();
|
||||
bool expanded() { return m_fullExpand;}
|
||||
public slots:
|
||||
void foldGroupAll();
|
||||
void unfoldGroupAll();
|
||||
void hide();
|
||||
void show();
|
||||
void foldGroup ( uint id );
|
||||
void unFoldGroup ( uint id );
|
||||
|
||||
private:
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_z; //depth index : not Z axis
|
||||
int m_count;
|
||||
int m_height;
|
||||
int m_width;
|
||||
bool m_fullExpand;
|
||||
QString m_name;
|
||||
QString m_iconPath;
|
||||
KbfxPlasmaCanvasGroup * m_current;
|
||||
groupPtrList m_groupChain;
|
||||
//state variables
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,401 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasitem.h"
|
||||
|
||||
KbfxPlasmaCanvasItem::KbfxPlasmaCanvasItem ( QCanvasPixmapArray * a , QCanvas * canvas ) :KbfxPlasmaCanvasAbstractItem ( a, canvas )
|
||||
{
|
||||
this->setItemMode ( 1 );
|
||||
setAnimated ( false );
|
||||
m_desktopFile = 0L;
|
||||
m_isCurrent = false;
|
||||
// m_pixmapArray = a;
|
||||
QPixmap * _img = this->image ( 0 );
|
||||
m_commentText ="No Comment Set By Plugin";
|
||||
m_height =_img->height();
|
||||
m_width =_img->width();
|
||||
connect ( this,SIGNAL ( clicked() ),this,SLOT ( exec() ) );
|
||||
m_type = OTHER;
|
||||
// ConfigInit().read();
|
||||
m_noComments = ConfigInit().m_noComments;
|
||||
m_source = 0;
|
||||
m_margin = ConfigInit().m_commentMargine;
|
||||
m_lineColor = ConfigInit().m_lineColor;
|
||||
m_iconSize = ConfigInit().m_iconSize;
|
||||
m_commentColor = ConfigInit().m_fontAppCommentColor;
|
||||
m_commentFont = ConfigInit().m_fontAppCommentFont;
|
||||
m_fontAppNameColor = ConfigInit().m_fontAppNameColor;
|
||||
m_fontAppNameFont = ConfigInit().m_fontAppNameFont;
|
||||
m_sepNameFont = ConfigInit().m_sepNameFont;
|
||||
m_boldFonts = ConfigInit().m_fontHoverBold;
|
||||
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasItem::~KbfxPlasmaCanvasItem()
|
||||
{
|
||||
setCanvas ( 0L );
|
||||
}
|
||||
/*
|
||||
QCanvasPixmapArray * KbfxPlasmaCanvasItem::getPixmapArray()
|
||||
{
|
||||
return m_pixmapArray;
|
||||
|
||||
}
|
||||
*/
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setLabelText ( QString str )
|
||||
{
|
||||
|
||||
QFont * _font = new QFont ( m_fontAppNameFont );
|
||||
|
||||
QFontMetrics fm ( *_font );
|
||||
|
||||
int _commentWidth = fm.width ( str+"..." );
|
||||
int _strLen = str.length();
|
||||
if ( _commentWidth > ( this->width() - m_margin ) )
|
||||
{
|
||||
|
||||
for ( int i = 0; i < _strLen /*&& ( fm.width(str+"...") < width()-40 )*/ ;i++ )
|
||||
{
|
||||
str.truncate ( str.length()-2 );
|
||||
if ( fm.width ( str+"..." ) < width() - m_margin )
|
||||
break;
|
||||
|
||||
}
|
||||
str+="...";
|
||||
}
|
||||
|
||||
m_labelText = str ;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
KbfxPlasmaCanvasItem::lookup ( QString str )
|
||||
{
|
||||
|
||||
if ( str.isNull() )
|
||||
return false;
|
||||
|
||||
if ( m_type == SEPARATOR || m_type == INDEX )
|
||||
return false;
|
||||
|
||||
if ( m_labelText.contains ( str,false ) > 0 )
|
||||
return true;
|
||||
if ( m_commentText.contains ( str,false ) > 0 )
|
||||
return true;
|
||||
if ( m_exec.contains ( str,false ) >0 )
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setExec ( QString desktopfile )
|
||||
{
|
||||
m_desktopFile = new KDesktopFile ( desktopfile );
|
||||
m_desktopFilePath = desktopfile;
|
||||
bool check = m_desktopFile->isAuthorizedDesktopFile ( desktopfile );
|
||||
|
||||
setLabelText ( m_desktopFile->readName() );
|
||||
setComment ( m_desktopFile->readComment() );
|
||||
setIconPath ( m_desktopFile->readIcon() );
|
||||
|
||||
if ( check == 0 )
|
||||
{
|
||||
m_restricted = true;
|
||||
m_error = "Adiministrator Blocked";
|
||||
delete m_desktopFile;
|
||||
return ;
|
||||
}
|
||||
delete m_desktopFile;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setIconPath ( QString str )
|
||||
{
|
||||
KIconLoader *iconload = KGlobal::iconLoader ();
|
||||
m_iconPath = iconload->iconPath ( str, KIcon::Desktop, false );
|
||||
// m_icon.load(m_iconPath);
|
||||
QImage _img ( m_iconPath );
|
||||
|
||||
if ( _img.height() > 128 )
|
||||
{
|
||||
_img = _img.smoothScale ( 32,32 );
|
||||
|
||||
}
|
||||
|
||||
m_icon.convertFromImage ( _img );
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setIcon ( QPixmap pixmap )
|
||||
{
|
||||
m_icon = pixmap;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setSource ( KbfxDataSource src )
|
||||
{
|
||||
|
||||
|
||||
m_source = new KbfxDataSource();
|
||||
*m_source = src;
|
||||
if ( src.type() == KbfxDataSource::DESKTOP )
|
||||
{
|
||||
this->setExec ( src.desktopFile () );
|
||||
}
|
||||
else
|
||||
{
|
||||
setLabelText ( src.name() );
|
||||
setName ( src.name() );
|
||||
setComment ( src.comment() );
|
||||
setIconPath ( src.icon() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::hideit ()
|
||||
{
|
||||
|
||||
m_hidden = 0;
|
||||
this->hide ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setType ( Type t )
|
||||
{
|
||||
m_type = t;
|
||||
}
|
||||
|
||||
bool KbfxPlasmaCanvasItem::itemMode ()
|
||||
{
|
||||
return m_skined;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setItemMode ( bool mode )
|
||||
{
|
||||
m_skined = mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::drawBackDrop ( QPainter * pe,QRect & r )
|
||||
{
|
||||
r = r ;
|
||||
if ( pe == NULL )
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void
|
||||
KbfxPlasmaCanvasItem::drawText(QPainter * pe,QString str)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::draw ( QPainter & pe )
|
||||
{
|
||||
drawContent ( &pe );
|
||||
}
|
||||
|
||||
QPixmap
|
||||
KbfxPlasmaCanvasItem::dragPixmap()
|
||||
{
|
||||
double _x = x();
|
||||
double _y = y();
|
||||
setX ( 0.0 );
|
||||
setY ( 0.0 );
|
||||
QPixmap dragpixmap ( this->width(),this->height() );
|
||||
dragpixmap.fill ( QColor ( 255,255,255 ) );
|
||||
QPainter p;
|
||||
p.begin ( &dragpixmap );
|
||||
this->drawContent ( &p );
|
||||
p.end();
|
||||
setX ( _x );
|
||||
setY ( _y );
|
||||
return dragpixmap;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::drawContent ( QPainter * pe )
|
||||
{
|
||||
if ( m_isCurrent )
|
||||
{
|
||||
this->setFrame ( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setFrame ( 0 );
|
||||
}
|
||||
//int _currentFrame =
|
||||
QCanvasPixmap *cp = this->image ( this->frame () );
|
||||
m_height = cp->height();
|
||||
m_width = cp->width();
|
||||
//Draw the Background
|
||||
if ( m_skined == true )
|
||||
{
|
||||
|
||||
pe->drawPixmap ( this->boundingRect (), *cp );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pe->setPen ( QColor ( 91,178,62 ) );
|
||||
pe->drawRect ( this->boundingRect() );
|
||||
pe->setPen ( QColor ( 0,10,0 ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
We will split the Item box into two
|
||||
**/
|
||||
|
||||
QRect tmp ( 0,0,0,0 );
|
||||
//TODO: Should be read from kbfxconfig.cpp
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
QRect * rectTop = new QRect ( m_margin, ( int ) y(), cp->width() - m_margin, cp->height() /2 );
|
||||
QRect * rectBot = new QRect ( m_margin, ( int ) y() + rectTop->height(), cp->width() - m_margin, cp->height() /2 );
|
||||
|
||||
|
||||
///Draw Icon
|
||||
|
||||
//TODO::remover hard coded icon size : read from config
|
||||
|
||||
if ( !m_isCurrent )
|
||||
pe->drawPixmap ( QRect ( ( m_margin-m_iconSize ) /2, ( int ) y() + ( cp->height()-m_iconSize ) /2,m_iconSize,m_iconSize ),m_icon );
|
||||
else
|
||||
pe->drawPixmap ( QRect ( ( m_margin-m_iconSize ) /2, ( int ) y() + ( cp->height()-m_iconSize ) /2,m_iconSize+2,m_iconSize+2 ),m_icon );
|
||||
//End of DrawIcon
|
||||
|
||||
|
||||
QFont * _font = new QFont ( m_fontAppNameFont );
|
||||
QFont * _font_comment = new QFont ( m_commentFont );
|
||||
QFont * _font_separator = new QFont ( m_sepNameFont );
|
||||
pe->setFont ( *_font );
|
||||
|
||||
if ( this->type() == EXECUTABLE )
|
||||
{
|
||||
pe->setPen ( m_fontAppNameColor );
|
||||
if ( m_noComments == false )
|
||||
{
|
||||
if ( m_isCurrent && m_boldFonts == true ) { _font->setBold ( true );pe->setFont ( *_font ); }
|
||||
pe->drawText ( *rectTop, Qt::AlignLeft| Qt::AlignBottom ,QString ( m_labelText ), -1, &tmp,0 );
|
||||
pe->setPen ( m_lineColor );
|
||||
pe->drawLine ( m_margin, ( int ) y() + rectTop->height(), ( int ) cp->width() - 2, ( int ) y() + rectTop->height() );
|
||||
pe->setFont ( *_font_comment );
|
||||
pe->setPen ( m_commentColor );
|
||||
pe->drawText ( *rectBot, Qt::AlignLeft| Qt::AlignTop ,QString ( m_commentText ), -1, &tmp,0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pe->drawText ( QRect ( m_margin+1, ( int ) y()+1,cp->width(),cp->height() ), Qt::AlignLeft | Qt::AlignVCenter ,QString ( m_labelText ), -1, &tmp,0 );
|
||||
// pe->drawText ( QRect ( m_margin, ( int ) y(),cp->width(),cp->height() ), Qt::AlignLeft | Qt::AlignVCenter ,QString ( m_labelText ), -1, &tmp,0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( this->type() == SEPARATOR )
|
||||
{
|
||||
pe->setFont ( *_font_separator );
|
||||
pe->setPen ( ConfigInit().m_sepNameColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
pe->setPen ( m_fontAppNameColor );
|
||||
}
|
||||
pe->drawText ( QRect ( ( int ) x(), ( int ) y(),cp->width(),cp->height() ), Qt::AlignCenter ,QString ( m_labelText ), -1, &tmp,0 );
|
||||
|
||||
}
|
||||
|
||||
///Draw the line
|
||||
|
||||
|
||||
delete rectTop;
|
||||
delete rectBot;
|
||||
delete _font;
|
||||
delete _font_comment;
|
||||
delete _font_separator;
|
||||
}
|
||||
|
||||
|
||||
void::KbfxPlasmaCanvasItem::setComment ( QString str )
|
||||
{
|
||||
|
||||
|
||||
QFont * _font = new QFont ( m_commentFont );
|
||||
|
||||
QFontMetrics fm ( *_font );
|
||||
|
||||
int _commentWidth = fm.width ( str+"..." );
|
||||
int _strLen = str.length();
|
||||
if ( _commentWidth > ( this->width()-m_margin ) )
|
||||
{
|
||||
|
||||
for ( int i = 0; i < _strLen /*&& ( fm.width(str+"...") < width()-40 )*/ ;i++ )
|
||||
{
|
||||
str.truncate ( str.length()-2 );
|
||||
if ( fm.width ( str+"..." ) < width()-m_margin )
|
||||
break;
|
||||
|
||||
}
|
||||
str+="...";
|
||||
}
|
||||
|
||||
m_commentText = str;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::advance ( int phase )
|
||||
{
|
||||
if ( phase == 0 )
|
||||
{
|
||||
setXVelocity ( 0 );
|
||||
setYVelocity ( yVelocity () * 1 - 0.001 );
|
||||
}
|
||||
else
|
||||
{
|
||||
move ( x () + xVelocity (), y () + yVelocity () );
|
||||
}
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasitem.moc"
|
||||
|
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_ITEM_H
|
||||
#define KBFX_PLASMA_CANVAS_ITEM_H
|
||||
|
||||
#include <qcanvas.h>
|
||||
#include <qfont.h>
|
||||
#include <qfontinfo.h>
|
||||
#include <qimage.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kdebug.h>
|
||||
#include <kdesktopfile.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
#include "kbfxplasmacanvasabstractitem.h"
|
||||
|
||||
|
||||
class KbfxPlasmaCanvasItem:public KbfxPlasmaCanvasAbstractItem
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
// typedef enum {EXECUTABLE=0,SEPARATOR,INDEX,OTHER} Type;
|
||||
typedef enum {RASTER=0,VECTOR,NATIVE} SkinMode;
|
||||
|
||||
|
||||
KbfxPlasmaCanvasItem ( QCanvasPixmapArray * a, QCanvas * canvas );
|
||||
KbfxPlasmaCanvasItem ( const KbfxPlasmaCanvasItem &t );
|
||||
KbfxPlasmaCanvasItem &operator = ( const KbfxPlasmaCanvasItem &t );
|
||||
virtual ~KbfxPlasmaCanvasItem ();
|
||||
|
||||
bool itemMode();
|
||||
void setItemMode ( bool mode=true );
|
||||
void setType ( Type );
|
||||
void setCurrent ( bool );
|
||||
void setExec ( QString desktopfile );
|
||||
QString name() {return m_labelText;};
|
||||
QString desktopFile() { return m_desktopFilePath;}
|
||||
|
||||
|
||||
KbfxDataSource * source() { return m_source;}
|
||||
void setSource ( KbfxDataSource src );
|
||||
void setCommand ( QString cmd );
|
||||
void setComment ( QString comment );
|
||||
void setIcon ( QPixmap pixmap );
|
||||
void setIconPath ( QString path );
|
||||
bool isCurrent();
|
||||
int height() { return m_height;}
|
||||
int width() { return m_width;}
|
||||
Type type() { return m_type;}
|
||||
bool lookup ( QString str );
|
||||
virtual void advance ( int phase );
|
||||
virtual int rtti() const { return CANVASITEM;}
|
||||
virtual void draw ( QPainter & pe );
|
||||
virtual void drawContent ( QPainter * pe );
|
||||
virtual QPixmap dragPixmap();
|
||||
|
||||
// virtual void drawText(QPainter *pe,QString str);
|
||||
virtual void drawBackDrop ( QPainter * pe,QRect & rect );
|
||||
|
||||
/* Event Handling */
|
||||
virtual void mousePressEvent ( QMouseEvent * e );
|
||||
virtual void mouseMoveEvent ( QMouseEvent * e );
|
||||
virtual void enterEvent ( QEvent * e );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * e );
|
||||
|
||||
|
||||
void setLabelText ( QString s );
|
||||
|
||||
public slots:
|
||||
void updateAngle() {}
|
||||
void hideit();
|
||||
void exec();
|
||||
signals:
|
||||
void leave();
|
||||
void selected ( KbfxPlasmaCanvasItem* );
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void drawStar ( QPainter * pe );
|
||||
|
||||
int m_frameCount;
|
||||
int m_textWidth;
|
||||
QString m_exec;
|
||||
QString m_desktopFilePath;
|
||||
QString m_labelText;
|
||||
QString m_commentText;
|
||||
QPixmap m_icon;
|
||||
QString m_iconPath;
|
||||
KDesktopFile * m_desktopFile;
|
||||
KbfxDataSource * m_source;
|
||||
|
||||
/* Theming stuff */
|
||||
QColor m_fontAppNameColor;
|
||||
QFont m_fontAppNameFont;
|
||||
QColor m_commentColor;
|
||||
QFont m_commentFont;
|
||||
QColor m_lineColor;
|
||||
QFont m_sepNameFont;
|
||||
bool m_boldFonts;
|
||||
bool m_skined;
|
||||
bool m_restricted ; //KDE kiosk
|
||||
Type m_type;
|
||||
bool m_hidden;
|
||||
QString m_error;
|
||||
bool m_isCurrent;
|
||||
bool m_noComments;
|
||||
int m_margin;
|
||||
int m_height;
|
||||
int m_width;
|
||||
int m_iconSize;
|
||||
}
|
||||
;//C.G
|
||||
|
||||
#endif //M.I.G
|
||||
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasitem.h"
|
||||
#include <kapplication.h>
|
||||
#include <kdesktopfile.h>
|
||||
#include <kiconeffect.h>
|
||||
|
||||
void KbfxPlasmaCanvasItem::mousePressEvent ( QMouseEvent * e )
|
||||
{
|
||||
e = e;
|
||||
//TODO:
|
||||
//implement this class
|
||||
//emit clicked();
|
||||
//qDebug("Recive Mouse Press Event");
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::mouseReleaseEvent ( QMouseEvent * e )
|
||||
{
|
||||
e = e;
|
||||
// QPixmap pix = labelIcon();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
void KbfxPlasmaCanvasItem::mouseMoveEvent ( QMouseEvent * e )
|
||||
{
|
||||
e=e;
|
||||
//qDebug("Item revices Mouse Event");
|
||||
|
||||
}
|
||||
|
||||
void KbfxPlasmaCanvasItem::enterEvent ( QEvent * e )
|
||||
{
|
||||
e=e;
|
||||
//qDebug("Mouse Enters");
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::exec()
|
||||
{
|
||||
|
||||
if ( m_source == 0 )
|
||||
return;
|
||||
|
||||
|
||||
// KIconEffect::visualActivate(new QWidget(), this->boundingRect());
|
||||
m_source->exec();
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxPlasmaCanvasItem::isCurrent()
|
||||
{
|
||||
return m_isCurrent;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasItem::setCurrent ( bool state )
|
||||
{
|
||||
m_isCurrent = state;
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasitem.h"
|
||||
|
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasitemwrapper.h"
|
||||
#include <qptrlist.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
KbfxPlasmaCanvasItemWrapper::KbfxPlasmaCanvasItemWrapper ( QCanvas * canvas )
|
||||
{
|
||||
m_canvas = canvas;
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasItemWrapper::~KbfxPlasmaCanvasItemWrapper ()
|
||||
{}
|
||||
|
||||
QCanvasItem *
|
||||
KbfxPlasmaCanvasItemWrapper::item ( KbfxPlasmaCanvasItem::Type __type )
|
||||
{
|
||||
QPixmap _img_sep = ( *KbfxPlasmaPixmapProvider::pixmap ( "separator" ) );
|
||||
QImage _tmp_img = _img_sep.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_itemView_w, _img_sep.height (),QImage::ScaleFree );
|
||||
_img_sep = QPixmap ( _tmp_img );
|
||||
|
||||
QPixmap _img_tnorm = ( *KbfxPlasmaPixmapProvider::pixmap ( "tilenormal" ) );
|
||||
_tmp_img = _img_tnorm.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_itemView_w, _img_tnorm.height (),QImage::ScaleFree );
|
||||
_img_tnorm = QPixmap ( _tmp_img );
|
||||
|
||||
QPixmap _img_thov = ( *KbfxPlasmaPixmapProvider::pixmap ( "tilehover" ) );
|
||||
_tmp_img = _img_thov.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_itemView_w, _img_thov.height (),QImage::ScaleFree );
|
||||
_img_thov = QPixmap ( _tmp_img );
|
||||
|
||||
if ( __type == KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
{
|
||||
QValueList<QPixmap> list;
|
||||
list.append ( _img_sep );
|
||||
KbfxPlasmaCanvasItem *_ret =
|
||||
new KbfxPlasmaCanvasItem ( new QCanvasPixmapArray ( list ),m_canvas );
|
||||
_ret->setType ( __type );
|
||||
return ( QCanvasItem * ) _ret;
|
||||
}
|
||||
|
||||
if ( __type == KbfxPlasmaCanvasItem::EXECUTABLE )
|
||||
{
|
||||
|
||||
QValueList<QPixmap> list;
|
||||
list.append ( _img_tnorm );
|
||||
list.append ( _img_thov );
|
||||
|
||||
QCanvasPixmapArray * _pArray = new QCanvasPixmapArray ( list );
|
||||
|
||||
KbfxPlasmaCanvasItem *_ret = new KbfxPlasmaCanvasItem ( _pArray,
|
||||
m_canvas );
|
||||
|
||||
_ret->setType ( __type );
|
||||
return ( QCanvasItem * ) _ret;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
QCanvasItem *
|
||||
KbfxPlasmaCanvasItemWrapper::itemIndex ( KbfxPlasmaCanvasItem::Type __type )
|
||||
{
|
||||
QPixmap _img_isep = ( *KbfxPlasmaPixmapProvider::pixmap ( "indexseparator" ) );
|
||||
QImage _tmp_img = _img_isep.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_listBox_w, _img_isep.height (),QImage::ScaleFree );
|
||||
_img_isep = QPixmap ( _tmp_img );
|
||||
|
||||
QPixmap _img_r = ( *KbfxPlasmaPixmapProvider::pixmap ( "rhstile" ) );
|
||||
_tmp_img = _img_r.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_listBox_w, _img_r.height (),QImage::ScaleFree );
|
||||
_img_r = QPixmap ( _tmp_img );
|
||||
|
||||
QPixmap _img_rhov = ( *KbfxPlasmaPixmapProvider::pixmap ( "rhshovertile" ) );
|
||||
_tmp_img = _img_rhov.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_listBox_w, _img_rhov.height (),QImage::ScaleFree );
|
||||
_img_rhov = QPixmap ( _tmp_img );
|
||||
|
||||
if ( __type == KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
{
|
||||
QValueList<QPixmap> list;
|
||||
list.append ( _img_isep );
|
||||
KbfxPlasmaIndexItem *_ret =
|
||||
new KbfxPlasmaIndexItem ( new QCanvasPixmapArray ( list ),m_canvas );
|
||||
_ret->setType ( __type );
|
||||
return ( QCanvasItem * ) _ret;
|
||||
}
|
||||
if ( __type == KbfxPlasmaCanvasItem::INDEX )
|
||||
{
|
||||
QValueList<QPixmap> list2;
|
||||
list2.append ( _img_r );
|
||||
list2.append ( _img_rhov );
|
||||
KbfxPlasmaIndexItem *_ret = new KbfxPlasmaIndexItem ( new QCanvasPixmapArray ( list2 ),
|
||||
m_canvas );
|
||||
|
||||
_ret->setType ( __type );
|
||||
return ( QCanvasItem * ) _ret;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasitemwrapper.moc"
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_ITEM_WRAPPER_H
|
||||
#define KBFX_PLASMA_CANVAS_ITEM_WRAPPER_H
|
||||
|
||||
#include "kbfxplasmacanvasitem.h"
|
||||
#include "kbfxplasmaindexitem.h"
|
||||
#include <qcanvas.h>
|
||||
|
||||
|
||||
class KbfxPlasmaCanvasItemWrapper:public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
KbfxPlasmaCanvasItemWrapper ( QCanvas * canvas );
|
||||
~KbfxPlasmaCanvasItemWrapper();
|
||||
QCanvasItem* item ( KbfxPlasmaCanvasItem::Type __type );
|
||||
QCanvasItem* itemIndex ( KbfxPlasmaCanvasItem::Type __type );
|
||||
|
||||
private:
|
||||
|
||||
QCanvas * m_canvas;
|
||||
|
||||
//none
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
|
||||
enum {CANVASITEM=1003,CANVASBUTTON};
|
@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasstack.h"
|
||||
|
||||
KbfxPlasmaCanvasStack::KbfxPlasmaCanvasStack()
|
||||
{
|
||||
|
||||
m_current= 0;//set to NULL
|
||||
m_count = 0;
|
||||
m_height = 0;
|
||||
m_width = 0;
|
||||
m_groupChain.setAutoDelete ( TRUE );
|
||||
m_name = "Unset:Faulty plugin";
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasStack::~KbfxPlasmaCanvasStack()
|
||||
{
|
||||
//TODO: needs to manage memory here
|
||||
|
||||
|
||||
for ( uint i = 0; i < ( uint ) m_count; ++i )
|
||||
{
|
||||
|
||||
m_groupChain.at ( i )->~KbfxPlasmaCanvasGroupView();
|
||||
m_groupChain.remove ( m_groupChain.at ( i ) );
|
||||
|
||||
}
|
||||
|
||||
Dict::Iterator it;
|
||||
|
||||
for ( it = m_dict.begin();it != m_dict.end();++it )
|
||||
{
|
||||
m_dict.remove ( it );
|
||||
}
|
||||
|
||||
delete m_current;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasStack::raise ( uint id )
|
||||
{
|
||||
|
||||
KbfxPlasmaCanvasGroupView * _gvPtr = m_groupChain.at ( id );
|
||||
|
||||
if ( !_gvPtr )
|
||||
qDebug ( "Error item not in Stack" );
|
||||
else
|
||||
{
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
m_groupChain.at ( i )->hide();
|
||||
}
|
||||
m_height = _gvPtr->height();
|
||||
_gvPtr->show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
KbfxPlasmaCanvasStack::contains ( QString name )
|
||||
{
|
||||
//FIXME:Depricated Data Structure Needs fixing
|
||||
if ( m_dict.contains ( name ) == true )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasStack::addGroup ( KbfxPlasmaCanvasGroupView * gPtr )
|
||||
{
|
||||
if ( gPtr == NULL )
|
||||
{
|
||||
qDebug
|
||||
( "KbfxPlasmaCanvasStack.cpp:34:Null Pointer Passed to addGroup()" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_groupChain.append ( gPtr );
|
||||
m_height = gPtr->height();
|
||||
m_width = gPtr->width();
|
||||
// KbfxPlasmaDataStack stackinfo;
|
||||
/// stackinfo
|
||||
m_dict[gPtr->name() ] = m_count;
|
||||
|
||||
m_count++;
|
||||
}
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasStack::Dict
|
||||
KbfxPlasmaCanvasStack::getDict()
|
||||
{
|
||||
return m_dict;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasStack::hide()
|
||||
{
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
m_groupChain.at ( i )->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasStack::raiseByName ( QString name )
|
||||
{
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
m_groupChain.at ( i )->hide();
|
||||
}
|
||||
|
||||
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
if ( m_groupChain.at ( i )->name() == name )
|
||||
{
|
||||
m_groupChain.at ( i )->show();
|
||||
m_height = m_groupChain.at ( i )->height();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
KbfxPlasmaCanvasGroupView *
|
||||
KbfxPlasmaCanvasStack::activeViewByName ( QString name )
|
||||
{
|
||||
|
||||
|
||||
for ( uint i = 0; i < m_groupChain.count (); ++i )
|
||||
{
|
||||
if ( m_groupChain.at ( i )->name() == name )
|
||||
{
|
||||
return m_groupChain.at ( i );
|
||||
}
|
||||
}
|
||||
|
||||
return new KbfxPlasmaCanvasGroupView();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
KbfxPlasmaCanvasStack::getItemName ( int id )
|
||||
{
|
||||
return m_groupChain.at ( id )->name();
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasstack.moc"
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_STACK_H
|
||||
#define KBFX_PLASMA_CANVAS_STACK_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qptrlist.h>
|
||||
#include <kbfxplasmacanvasstackdata.h>
|
||||
//#include "kbfxplasmacanvasgroup.h"
|
||||
#include "kbfxplasmacanvasgroupview.h"
|
||||
|
||||
/**
|
||||
This class will manager a list of Grouplists.
|
||||
**/
|
||||
|
||||
|
||||
class KbfxPlasmaCanvasStack:public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef QPtrList<KbfxPlasmaCanvasGroupView> groupPtrList;
|
||||
typedef QMap<QString,uint> Dict;//DEPRECATED
|
||||
typedef QMap<KbfxPlasmaCanvasStackData,uint> DataDict;
|
||||
|
||||
KbfxPlasmaCanvasStack();
|
||||
virtual ~KbfxPlasmaCanvasStack();
|
||||
void addGroup ( KbfxPlasmaCanvasGroupView* );
|
||||
void deleteGroup ( KbfxPlasmaCanvasGroupView* );
|
||||
KbfxPlasmaCanvasStack* contains ( KbfxPlasmaCanvasGroupView* );
|
||||
QString getItemName ( int );
|
||||
virtual int rtti() {return 1006;}
|
||||
void predend ( KbfxPlasmaCanvasGroupView* );
|
||||
void append ( KbfxPlasmaCanvasGroupView* );
|
||||
Dict getDict();
|
||||
void hide();
|
||||
int count() { return m_count;}
|
||||
int height()
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
int width()
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
QString name() {return m_name;}
|
||||
void setName ( QString name ) { m_name = name;}
|
||||
bool contains ( QString );
|
||||
KbfxPlasmaCanvasGroupView * activeViewByName ( QString name );
|
||||
public slots:
|
||||
void raise ( uint id );
|
||||
void raiseByName ( QString name );
|
||||
private:
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_z; //depth index : not Z axis
|
||||
int m_count;
|
||||
int m_height;
|
||||
int m_width;
|
||||
KbfxPlasmaCanvasGroupView * m_current;
|
||||
groupPtrList m_groupChain;
|
||||
Dict m_dict;
|
||||
DataDict m_dataDict;
|
||||
QString m_name;
|
||||
//state variables
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_STACK_DATA_H
|
||||
#define KBFX_PLASMA_CANVAS_STACK_DATA_H
|
||||
|
||||
|
||||
class KbfxPlasmaCanvasStackData
|
||||
{
|
||||
|
||||
public:
|
||||
KbfxPlasmaCanvasStackData() {}
|
||||
~KbfxPlasmaCanvasStackData() {}
|
||||
QString name;
|
||||
QString icon;
|
||||
int id;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -0,0 +1,665 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmacanvasview.h"
|
||||
|
||||
KbfxPlasmaCanvasView::KbfxPlasmaCanvasView ( QWidget * parent,
|
||||
const char *name, WFlags fl ) :
|
||||
QCanvasView ( parent, name,fl )
|
||||
{
|
||||
|
||||
viewport ()->setMouseTracking ( TRUE );
|
||||
viewport ()->setAcceptDrops ( true );
|
||||
this->setVScrollBarMode ( QScrollView::AlwaysOff );
|
||||
this->setHScrollBarMode ( QScrollView::AlwaysOff );
|
||||
setFrameShape ( QFrame::NoFrame );
|
||||
m_currentItem = 0L;
|
||||
m_stack = 0;
|
||||
m_currentView = new KbfxPlasmaCanvasGroupView ();
|
||||
m_lastSignalData = "";
|
||||
gstack = 0;
|
||||
m_exeCandidate = 0;
|
||||
m_findDone = true;
|
||||
m_selectedItem = 0L;
|
||||
m_search = new QCanvas ( this->width (), this->height () );
|
||||
|
||||
m_scrollbar_top = new KbfxSpinxScrollBar ( this );
|
||||
m_scrollbar_bot = new KbfxSpinxScrollBar ( this,"bottom",1);
|
||||
m_scrollbar_top->setType ( KbfxSpinxScrollBar::UP );
|
||||
m_scrollbar_bot->setType ( KbfxSpinxScrollBar::DOWN );
|
||||
|
||||
connect ( m_scrollbar_top, SIGNAL ( scroll ( int, int ) ), this,
|
||||
SLOT ( scrollBy ( int, int ) ) );
|
||||
connect ( m_scrollbar_bot, SIGNAL ( scroll ( int, int ) ), this,
|
||||
SLOT ( scrollBy ( int, int ) ) );
|
||||
|
||||
placeScrollBars ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::placeScrollBars ()
|
||||
{
|
||||
m_scrollbar_top->move ( 0, 0 );
|
||||
m_scrollbar_bot->move ( 0, ( this->height () + 1 ) - m_scrollbar_bot->height () );
|
||||
}
|
||||
|
||||
KbfxPlasmaCanvasView::~KbfxPlasmaCanvasView ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::keyPressEvent ( QKeyEvent * ke )
|
||||
{
|
||||
qDebug ( "QCanvasView got Key events" );
|
||||
ke->ignore();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::execFirst ()
|
||||
{
|
||||
//if ( m_search->allItems ().count () < 1 )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
qDebug("_____----------------------------------------");
|
||||
if ( m_exeCandidate != 0 )
|
||||
m_exeCandidate->exec ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::clearAllButOne ( KbfxPlasmaCanvasItem * i )
|
||||
{
|
||||
i = i;
|
||||
|
||||
QCanvasItemList list = canvas ()->allItems ();
|
||||
|
||||
QCanvasItemList::Iterator it = list.begin ();
|
||||
for ( ; it != list.end (); ++it )
|
||||
{
|
||||
if ( *it )
|
||||
{
|
||||
if ( *it != m_selectedItem )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
t->setCurrent ( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::execAt ( int i )
|
||||
{
|
||||
int e = i - 48;
|
||||
int e_count = m_search->allItems ().count ();
|
||||
|
||||
if ( e_count < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( e >= e_count - 1 )
|
||||
return;
|
||||
|
||||
KbfxPlasmaCanvasItem *tmp = m_searchMap[e];
|
||||
if ( tmp == 0 )
|
||||
return;
|
||||
else
|
||||
tmp->exec ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::leaveEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
clearAllButOne ( m_currentItem );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::enterEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
clearAllButOne ( m_currentItem );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::mouseMoveEvent ( QMouseEvent * me )
|
||||
{
|
||||
QPoint p = inverseWorldMatrix ().map ( viewportToContents ( me->pos () ) );
|
||||
if ( canvas () == NULL )
|
||||
return;
|
||||
|
||||
// KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
QCanvasItemList l = canvas ()->collisions ( p );
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( *it == 0 )
|
||||
return;
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaCanvasItem *t = ( KbfxPlasmaCanvasItem * ) ( *it );
|
||||
t->mouseMoveEvent ( me );
|
||||
if ( m_currentItem != NULL )
|
||||
{
|
||||
m_currentItem->setCurrent ( false );
|
||||
}
|
||||
m_currentItem = t;
|
||||
t->setCurrent ( true );
|
||||
}
|
||||
}
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::contentsMouseMoveEvent ( QMouseEvent * me )
|
||||
{
|
||||
if ( canvas () == NULL )
|
||||
return;
|
||||
|
||||
if ( me->state () & LeftButton )
|
||||
{
|
||||
int distance = ( me->pos () - m_dragPos ).manhattanLength ();
|
||||
if ( distance > QApplication::startDragDistance () )
|
||||
this->startDrag ();
|
||||
}
|
||||
QScrollView::contentsMouseMoveEvent ( me );
|
||||
|
||||
QCanvasItemList l = canvas ()->collisions ( me->pos () );
|
||||
|
||||
if ( l.count () <= 0 )
|
||||
return;
|
||||
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( *it == 0 )
|
||||
return;
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaCanvasItem *t = ( KbfxPlasmaCanvasItem * ) ( *it );
|
||||
t->mouseMoveEvent ( me );
|
||||
if ( m_currentItem != NULL )
|
||||
{
|
||||
m_currentItem->setCurrent ( false );
|
||||
}
|
||||
m_currentItem = t;
|
||||
t->setCurrent ( true );
|
||||
this->setCursor ( QCursor ( Qt::PointingHandCursor ) );
|
||||
}
|
||||
}
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::contentsMousePressEvent ( QMouseEvent * me )
|
||||
{
|
||||
KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
QCanvasItemList l = canvas ()->collisions ( me->pos () );
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaCanvasItem *t = ( KbfxPlasmaCanvasItem * ) ( *it );
|
||||
t->mousePressEvent ( me );
|
||||
if ( t->type () == KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
tmp = KbfxPlasmaCanvasGroup::groupContaining ( t );
|
||||
}
|
||||
}
|
||||
if ( tmp != 0 )
|
||||
tmp->shade ();
|
||||
m_clickPos = me->pos ();
|
||||
|
||||
if ( me->button () == LeftButton )
|
||||
m_dragPos = me->pos ();
|
||||
QScrollView::contentsMousePressEvent ( me );
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::startDrag ()
|
||||
{
|
||||
if ( m_currentItem != 0 )
|
||||
{
|
||||
KbfxDataSource *src = new KbfxDataSource ();
|
||||
src = m_currentItem->source ();
|
||||
if ( src == 0 )
|
||||
{
|
||||
qDebug ( "null source" );
|
||||
return;
|
||||
}
|
||||
QUriDrag *drag =
|
||||
new QUriDrag ( QStrList ( src->contentPath () ), this,
|
||||
src->name ().ascii () );
|
||||
drag->setFileNames ( QStringList ( src->contentPath () ) );
|
||||
drag->setPixmap ( m_currentItem->dragPixmap () );
|
||||
drag->drag ();
|
||||
emit clicked ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::resizeEvent ( QResizeEvent * )
|
||||
{
|
||||
placeScrollBars ();
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
KbfxPlasmaCanvasView::enterEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
if ( canvas () == 0 )
|
||||
return;
|
||||
|
||||
// KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
QPoint _mPos = QCursor::pos ();
|
||||
QCanvasItemList l = canvas ()->collisions ( this->mapFromGlobal ( _mPos ) );
|
||||
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( *it == 0 )
|
||||
break;
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaCanvasItem *t = ( KbfxPlasmaCanvasItem * ) ( *it );
|
||||
// t->enterEvent ( e);
|
||||
m_currentItem = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::reload()
|
||||
{
|
||||
clearAll();
|
||||
clearSearch();
|
||||
m_appletMap.clear();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::clearAll ()
|
||||
{
|
||||
if ( canvas() != m_search )
|
||||
return ;
|
||||
|
||||
QCanvasItemList list = canvas ()->allItems ();
|
||||
|
||||
QCanvasItemList::Iterator it = list.begin ();
|
||||
for ( ; it != list.end (); ++it )
|
||||
{
|
||||
if ( *it )
|
||||
{
|
||||
// KbfxPlasmaCanvasItem *t = (KbfxPlasmaCanvasItem *) (*it);
|
||||
m_search->removeItem ( ( *it ) );
|
||||
( *it )->setCanvas ( 0L );
|
||||
// delete (*it);
|
||||
}
|
||||
}
|
||||
canvas()->update();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::setKbfxCanvas ( QCanvas * cnv )
|
||||
{
|
||||
m_default = cnv;
|
||||
setCanvas ( m_default );
|
||||
// canvas ()->setBackgroundPixmap ( ( *KbfxPlasmaPixmapProvider::pixmap ( "appviewbg" )) );
|
||||
QPixmap * pixmap = KbfxPlasmaPixmapProvider::pixmap ( "middleboxbg" );
|
||||
if ( pixmap != NULL )
|
||||
{
|
||||
QImage img = pixmap->convertToImage();
|
||||
img = img.smoothScale ( this->width(),pixmap->height(),QImage::ScaleFree );
|
||||
pixmap->convertFromImage ( img );
|
||||
this->canvas ()->setBackgroundPixmap ( *pixmap );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::expandAll ()
|
||||
{
|
||||
if ( m_currentView != 0 )
|
||||
{
|
||||
if ( ConfigInit ().m_startHidden == false )
|
||||
m_currentView->unfoldGroupAll ();
|
||||
scroll ( 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::handleLoadRequest ( KbfxSignal signal )
|
||||
{
|
||||
QString tm = signal.name ();
|
||||
|
||||
KbfxDataStack *_stack = m_dataStack[signal.name () ];
|
||||
if ( _stack == 0 )
|
||||
{
|
||||
qDebug ( "Empty Stack" );
|
||||
return;
|
||||
}
|
||||
|
||||
QString _activateGroup = _stack->getSubGroupName ( signal.id () );
|
||||
|
||||
KbfxDataGroupList *_dataList = _stack->getStack ( _activateGroup );
|
||||
KbfxPlasmaCanvasGroupView *gview = new KbfxPlasmaCanvasGroupView ();
|
||||
KbfxPlasmaCanvasStack *v_stack = m_appletMap[signal.name () ];
|
||||
|
||||
if ( m_currentView->name () == _activateGroup && canvas() != m_search)
|
||||
{
|
||||
return;
|
||||
}
|
||||
setCanvas ( m_default );
|
||||
|
||||
scrollBy ( 0, - ( canvas ()->height () ) );
|
||||
|
||||
stackMap::Iterator it;
|
||||
for ( it = m_appletMap.begin (); it != m_appletMap.end (); ++it )
|
||||
{
|
||||
( *it )->hide ();
|
||||
}
|
||||
|
||||
if ( m_appletMap[signal.name () ]->contains ( _activateGroup ) != true )
|
||||
{
|
||||
loadGroup ( _dataList, gview );
|
||||
m_currentView = gview;
|
||||
m_appletMap[signal.name () ]->setName ( signal.name () );
|
||||
m_appletMap[signal.name () ]->addGroup ( gview );
|
||||
m_appletMap[signal.name () ]->raiseByName ( _activateGroup );
|
||||
int _height =
|
||||
v_stack->height () + m_scrollbar_top->height () +
|
||||
m_scrollbar_bot->height ();
|
||||
if ( _height > this->visibleHeight () )
|
||||
canvas ()->resize ( v_stack->width (), _height );
|
||||
else
|
||||
canvas ()->resize ( v_stack->width (), this->visibleHeight () );
|
||||
canvas()->update();
|
||||
repaint();
|
||||
// return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_appletMap[signal.name () ]->raiseByName ( _activateGroup );
|
||||
m_currentView =
|
||||
m_appletMap[signal.name () ]->activeViewByName ( _activateGroup );
|
||||
int _height =
|
||||
m_appletMap[signal.name () ]->height () + m_scrollbar_top->height () +
|
||||
m_scrollbar_bot->height ();
|
||||
if ( _height > this->visibleHeight () )
|
||||
canvas ()->resize ( m_appletMap[signal.name () ]->width (), _height );
|
||||
else
|
||||
canvas ()->resize ( m_appletMap[signal.name () ]->width (),
|
||||
this->visibleHeight () );
|
||||
canvas()->update();
|
||||
repaint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::contentsMouseReleaseEvent ( QMouseEvent * me )
|
||||
{
|
||||
// KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
QCanvasItemList l = canvas ()->collisions ( me->pos () );
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaCanvasItem *t = ( KbfxPlasmaCanvasItem * ) ( *it );
|
||||
t->mouseReleaseEvent ( me );
|
||||
if ( t->type () != KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
emit clicked ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::clearSearch ()
|
||||
{
|
||||
searchMap::Iterator it;
|
||||
for ( it = m_searchMap.begin (); it != m_searchMap.end (); ++it )
|
||||
{
|
||||
if ( it != 0 )
|
||||
m_searchMap.remove ( it );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::search_R ( const QString name )
|
||||
{
|
||||
gstack = new KbfxPlasmaCanvasStack ();
|
||||
KbfxPlasmaCanvasGroup *visualGroup = new KbfxPlasmaCanvasGroup ();
|
||||
KbfxPlasmaCanvasGroupView *glist = new KbfxPlasmaCanvasGroupView ();
|
||||
KbfxPlasmaCanvasItem *box = 0;
|
||||
KbfxPlasmaCanvasItemWrapper *boxwrapper = 0;
|
||||
|
||||
glist->setName ( "Search Result" );
|
||||
|
||||
this->setCanvas ( m_search );
|
||||
|
||||
QPixmap * pixmap = KbfxPlasmaPixmapProvider::pixmap ( "middleboxbg" );
|
||||
if ( pixmap != NULL )
|
||||
{
|
||||
QImage img = pixmap->convertToImage();
|
||||
img = img.smoothScale ( this->width(),pixmap->height(),QImage::ScaleFree );
|
||||
pixmap->convertFromImage ( img );
|
||||
this->canvas ()->setBackgroundPixmap ( *pixmap );
|
||||
}
|
||||
|
||||
this->setCursor ( QCursor ( Qt::BusyCursor ) );
|
||||
|
||||
clearAll ();
|
||||
dataStack::Iterator sit;
|
||||
|
||||
for ( sit = m_dataStack.begin (); sit != m_dataStack.end (); ++sit )
|
||||
{
|
||||
if ( sit == NULL )
|
||||
continue;
|
||||
|
||||
visualGroup = new KbfxPlasmaCanvasGroup ();
|
||||
KbfxDataGroup *appGroup =
|
||||
KbfxPlasmaPluginLoader::search ( sit.key (), name );
|
||||
|
||||
boxwrapper = new KbfxPlasmaCanvasItemWrapper ( m_search );
|
||||
box =
|
||||
( KbfxPlasmaCanvasItem * ) boxwrapper->
|
||||
item ( KbfxPlasmaCanvasItem::SEPARATOR );
|
||||
|
||||
if ( appGroup != NULL )
|
||||
box->setLabelText ( "Hits for " + sit.key () );
|
||||
|
||||
if ( appGroup == NULL )
|
||||
{
|
||||
qDebug ( "Null Search Group" );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ( appGroup->count () <= 0 )
|
||||
continue;
|
||||
|
||||
if ( visualGroup->addItem ( box ) == false )
|
||||
{}
|
||||
|
||||
|
||||
KbfxDataGroup::Data dat = appGroup->getData ();
|
||||
KbfxDataGroup::Data::Iterator it;
|
||||
|
||||
KbfxDataSource * firstItem = appGroup->itemAt(0);
|
||||
|
||||
boxwrapper = new KbfxPlasmaCanvasItemWrapper ( m_search );
|
||||
m_exeCandidate =
|
||||
( KbfxPlasmaCanvasItem * ) boxwrapper->
|
||||
item ( KbfxPlasmaCanvasItem::EXECUTABLE );
|
||||
|
||||
m_exeCandidate->setSource ( *firstItem );
|
||||
|
||||
for ( it = dat.begin(); it != dat.end (); it++ )
|
||||
{
|
||||
qApp->processEvents ();
|
||||
boxwrapper = new KbfxPlasmaCanvasItemWrapper ( m_search );
|
||||
box =
|
||||
( KbfxPlasmaCanvasItem * ) boxwrapper->
|
||||
item ( KbfxPlasmaCanvasItem::EXECUTABLE );
|
||||
box->setSource ( * ( it.data () ) );
|
||||
if ( visualGroup->addItem ( box ) == true )
|
||||
{
|
||||
}
|
||||
}
|
||||
visualGroup->move ( 0, m_scrollbar_top->height () );
|
||||
|
||||
glist->addGroup ( visualGroup );
|
||||
}
|
||||
|
||||
gstack->addGroup ( glist );
|
||||
gstack->raise ( 0 );
|
||||
if ( gstack->height() < this->visibleHeight() )
|
||||
m_search->resize ( gstack->width(),this->visibleHeight() );
|
||||
else
|
||||
m_search->resize ( gstack->width (),
|
||||
gstack->height () + m_scrollbar_top->height () +
|
||||
m_scrollbar_bot->height () );
|
||||
m_search->update ();
|
||||
|
||||
this->setCursor ( QCursor ( Qt::ArrowCursor ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::search ( const QString & str )
|
||||
{
|
||||
if ( str.isEmpty () )
|
||||
return;
|
||||
|
||||
if ( str == "" )
|
||||
return;
|
||||
|
||||
search_R ( str );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::addStack ( KbfxPlasmaCanvasStack * stak, QString name )
|
||||
{
|
||||
if ( m_appletMap.contains ( name ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_appletMap[name] = stak;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::addStack ( KbfxDataStack * stak, QString name )
|
||||
{
|
||||
if ( m_dataStack.contains ( name ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_dataStack[name] = stak;
|
||||
addStack ( new KbfxPlasmaCanvasStack (), name );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::loadGroup ( KbfxDataGroupList * src,
|
||||
KbfxPlasmaCanvasGroupView * dest )
|
||||
{
|
||||
if ( src == 0 )
|
||||
return ;
|
||||
|
||||
KbfxDataGroupList::GroupList list = src->getGroup ();
|
||||
dest->setName ( src->name () );
|
||||
KbfxPlasmaCanvasItem *box = 0;
|
||||
KbfxPlasmaCanvasItemWrapper *boxwrapper = 0;
|
||||
KbfxPlasmaCanvasGroup *appGroup = 0; //new KbfxPlasmaCanvasGroup ();
|
||||
QString l_lastAdd = "";
|
||||
for ( int i = 0; i < src->count (); i++ )
|
||||
{
|
||||
if ( list.at ( i ) != 0 )
|
||||
{
|
||||
if ( list.at ( i )->count () <= 0 )
|
||||
continue;
|
||||
|
||||
appGroup = new KbfxPlasmaCanvasGroup ();
|
||||
|
||||
boxwrapper = new KbfxPlasmaCanvasItemWrapper ( m_default );
|
||||
box =
|
||||
( KbfxPlasmaCanvasItem * ) boxwrapper->
|
||||
item ( KbfxPlasmaCanvasItem::SEPARATOR );
|
||||
|
||||
if ( list.at ( i )->name ().compare ( l_lastAdd ) == 0 )
|
||||
{
|
||||
box->setLabelText ( src->name () );
|
||||
}
|
||||
else
|
||||
{
|
||||
l_lastAdd = list.at ( i )->name () ;
|
||||
box->setLabelText ( list.at ( i )->name () );
|
||||
}
|
||||
|
||||
appGroup->addItem ( box );
|
||||
|
||||
KbfxDataGroup::Data::Iterator git;
|
||||
KbfxDataGroup::Data data;
|
||||
data = list.at ( i )->getData ();
|
||||
|
||||
for ( git = data.begin (); git != data.end (); git++ )
|
||||
{
|
||||
boxwrapper = new KbfxPlasmaCanvasItemWrapper ( m_default );
|
||||
box =
|
||||
( KbfxPlasmaCanvasItem * ) boxwrapper->
|
||||
item ( KbfxPlasmaCanvasItem::EXECUTABLE );
|
||||
box->setSource ( * ( git.data () ) );
|
||||
appGroup->addItem ( box );
|
||||
}
|
||||
if ( appGroup->count () > 0 )
|
||||
{
|
||||
dest->addGroup ( appGroup );
|
||||
appGroup->move ( 0, m_scrollbar_top->height () );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ConfigInit ().m_startHidden )
|
||||
{
|
||||
dest->foldGroupAll ();
|
||||
}
|
||||
else
|
||||
{
|
||||
dest->unfoldGroupAll ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::contentsDragLeaveEvent ( QDragEnterEvent * event )
|
||||
{
|
||||
event->accept ( true );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaCanvasView::contentsDragEnterEvent ( QDragEnterEvent * event )
|
||||
{
|
||||
event->accept ( true );
|
||||
}
|
||||
|
||||
#include "kbfxplasmacanvasview.moc"
|
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_CANVAS_VIEW_H
|
||||
#define KBFX_PLASMA_CANVAS_VIEW_H
|
||||
|
||||
#include <qcanvas.h>
|
||||
#include <qcursor.h>
|
||||
#include <qdragobject.h>
|
||||
#include <qpainter.h>
|
||||
|
||||
#include <kimageeffect.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxdatastack.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
#include <kbfxplasmapluginloader.h>
|
||||
|
||||
//#include "kbfxplasmacanvasrtti.h"
|
||||
#include "kbfxplasmacanvasgroup.h"
|
||||
#include "kbfxplasmacanvasgroupview.h"
|
||||
#include "kbfxplasmacanvasitem.h"
|
||||
#include "kbfxplasmacanvasitemwrapper.h"
|
||||
|
||||
#include "kbfxplasmacanvasstack.h"
|
||||
#include "kbfxplasmacanvasview.h"
|
||||
#include "kbfxsignal.h"
|
||||
#include "kbfxspinxscrollbar.h"
|
||||
|
||||
|
||||
class QCanvasView;
|
||||
|
||||
|
||||
class KbfxPlasmaCanvasView : public QCanvasView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef QMap<QString,KbfxPlasmaCanvasStack*> stackMap;
|
||||
typedef QMap<QString,KbfxDataStack*> dataStack;
|
||||
typedef QMap<int,KbfxPlasmaCanvasItem*> searchMap;
|
||||
|
||||
KbfxPlasmaCanvasView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
|
||||
virtual ~KbfxPlasmaCanvasView();
|
||||
void addStack ( KbfxPlasmaCanvasStack*stk,QString name );
|
||||
void addStack ( KbfxDataStack*stk,QString name );
|
||||
|
||||
void setKbfxCanvas ( QCanvas*cnv );
|
||||
void loadGroup ( KbfxDataGroupList * src,KbfxPlasmaCanvasGroupView * dest );
|
||||
void contentsDragLeaveEvent ( QDragEnterEvent *event );
|
||||
void contentsDragEnterEvent ( QDragEnterEvent *event );
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void clearAll();
|
||||
virtual void contentsMousePressEvent ( QMouseEvent * me );
|
||||
virtual void contentsMouseMoveEvent ( QMouseEvent * e );
|
||||
virtual void contentsMouseReleaseEvent ( QMouseEvent * e );
|
||||
virtual void mouseMoveEvent ( QMouseEvent * me );
|
||||
virtual void enterEvent ( QEvent * e );
|
||||
virtual void keyPressEvent ( QKeyEvent * ke );
|
||||
virtual void emulatedKeyPress ( QKeyEvent * k ) {keyPressEvent ( k );}
|
||||
virtual void resizeEvent ( QResizeEvent * ) ;
|
||||
virtual void leaveEvent ( QEvent * e );
|
||||
// virtual void leaveEvent(QEvent e );
|
||||
void handleLoadRequest ( KbfxSignal );
|
||||
void search ( const QString & );
|
||||
void search_R ( const QString key );
|
||||
void execFirst();
|
||||
void execAt ( int i );
|
||||
void expandAll();
|
||||
void reload();
|
||||
signals:
|
||||
void clicked();
|
||||
protected:
|
||||
void clearAllButOne ( KbfxPlasmaCanvasItem * i );
|
||||
|
||||
private:
|
||||
void clearSearch();
|
||||
void startDrag();
|
||||
void placeScrollBars();
|
||||
|
||||
QPoint m_clickPos;
|
||||
KbfxPlasmaCanvasItem * m_currentItem;
|
||||
KbfxPlasmaCanvasStack * m_currentStack;
|
||||
KbfxPlasmaCanvasStack * m_stack;
|
||||
QString m_lastSignalData;
|
||||
stackMap m_appletMap;
|
||||
dataStack m_dataStack;
|
||||
searchMap m_searchMap;
|
||||
KbfxPlasmaCanvasStack * gstack ;
|
||||
KbfxPlasmaCanvasItem * m_exeCandidate;
|
||||
QCanvas * m_default;
|
||||
QCanvas * m_search;
|
||||
bool m_findDone;
|
||||
KbfxSpinxScrollBar * m_scrollbar_top;
|
||||
KbfxSpinxScrollBar * m_scrollbar_bot;
|
||||
QPoint m_dragPos;
|
||||
KbfxPlasmaCanvasGroupView * m_currentView;
|
||||
QString m_currentViewName;
|
||||
KbfxPlasmaCanvasItem * m_selectedItem;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmaindexitem.h"
|
||||
#include <kdesktopfile.h>
|
||||
#include <kapplication.h>
|
||||
#include <kbfxconfig.h>
|
||||
|
||||
KbfxPlasmaIndexItem::KbfxPlasmaIndexItem ( QCanvasPixmapArray * a, QCanvas * canvas ) :KbfxPlasmaCanvasAbstractItem ( a,canvas )
|
||||
{
|
||||
//this->setItemMode (1);
|
||||
setAnimated ( false );
|
||||
setCurrent ( false );
|
||||
m_isSelected = false;
|
||||
QPixmap * _img = this->image ( 0 );
|
||||
m_height =_img->height();
|
||||
m_width= _img->width();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
KbfxPlasmaIndexItem::~KbfxPlasmaIndexItem()
|
||||
{}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::setIcon ( QString str )
|
||||
{
|
||||
KIconLoader *iconload = KGlobal::iconLoader ();
|
||||
m_iconPath = iconload->iconPath ( str, KIcon::Desktop, false );
|
||||
|
||||
m_icon.load ( m_iconPath );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::setText ( QString text )
|
||||
{
|
||||
m_text = text;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::setSelected ( bool stat )
|
||||
{
|
||||
m_isSelected = stat;
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
KbfxPlasmaIndexItem::selected()
|
||||
{
|
||||
return m_isSelected;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::drawContent ( QPainter * pe )
|
||||
{
|
||||
|
||||
if ( this->isCurrent() || m_isSelected )
|
||||
{
|
||||
this->setFrame ( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setFrame ( 0 );
|
||||
}
|
||||
|
||||
QCanvasPixmap *cp = this->image ( this->frame () );
|
||||
m_height = cp->height();
|
||||
m_width = cp->width();
|
||||
|
||||
pe->drawPixmap ( this->boundingRect (), *cp );
|
||||
|
||||
QRect r ( ( int ) x(), ( int ) y(), m_width, m_height );
|
||||
QRect textRect ( m_height+1, ( int ) y(), m_width,m_height );
|
||||
|
||||
QFont * _font_plugin = new QFont ( ConfigInit().m_pluginNameFont );
|
||||
QFont * _font_index = new QFont ( ConfigInit().m_fontIndexFont );
|
||||
|
||||
if ( this->type() != KbfxPlasmaIndexItem::SEPARATOR )
|
||||
{
|
||||
pe->setFont ( *_font_index );
|
||||
pe->setPen ( ConfigInit().m_fontIndexColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
pe->setFont ( *_font_plugin );
|
||||
pe->setPen ( ConfigInit().m_pluginNameColor);
|
||||
}
|
||||
|
||||
pe->drawText ( textRect, Qt::AlignVCenter | Qt::AlignLeft ,QString ( m_text ), -1, &r,0 );
|
||||
pe->drawPixmap ( QRect ( ( int ) x() +5 , ( int ) y() +6,m_height-12,m_height-12 ),m_icon );
|
||||
|
||||
delete _font_plugin;
|
||||
delete _font_index;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
KbfxPlasmaIndexItem::height()
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::setId ( int id )
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::draw ( QPainter & p )
|
||||
{
|
||||
drawContent ( &p );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::setLabelText ( QString str )
|
||||
{
|
||||
QFont * _font = new QFont(ConfigInit().m_fontIndexFont);
|
||||
|
||||
QFontMetrics fm ( *_font );
|
||||
|
||||
int _commentWidth = fm.width ( str+"..." );
|
||||
int _strLen = str.length();
|
||||
int _margin = height();;
|
||||
if ( _commentWidth > ( m_width -_margin ) )
|
||||
{
|
||||
|
||||
for ( int i = 0; i < _strLen /*&& ( fm.width(str+"...") < width()-40 )*/ ;i++ )
|
||||
{
|
||||
str.truncate ( str.length()-2 );
|
||||
if ( fm.width ( str+"..." ) < m_width-_margin )
|
||||
break;
|
||||
|
||||
}
|
||||
str+="...";
|
||||
}
|
||||
|
||||
setText ( str );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
KbfxPlasmaIndexItem::belongsTo()
|
||||
{
|
||||
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexItem::setBelongsTo ( QString parent )
|
||||
{
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
|
||||
void KbfxPlasmaIndexItem::mousePressEvent ( QMouseEvent * e )
|
||||
{
|
||||
e = e;
|
||||
}
|
||||
|
||||
#include "kbfxplasmaindexitem.moc"
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_INDEX_ITEM_H
|
||||
#define KBFX_PLASMA_INDEX_ITEM_H
|
||||
|
||||
#include "kbfxplasmacanvasabstractitem.h"
|
||||
|
||||
class KbfxPlasmaIndexItem : public KbfxPlasmaCanvasAbstractItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
KbfxPlasmaIndexItem ( QCanvasPixmapArray * a, QCanvas * canvas );
|
||||
virtual ~KbfxPlasmaIndexItem();
|
||||
|
||||
void setIcon ( QString path );
|
||||
void setText ( QString text );
|
||||
void setId ( int id );
|
||||
//void setName(QString name);
|
||||
void setLabelText ( QString text );
|
||||
void setBelongsTo ( QString parent );
|
||||
QString belongsTo();
|
||||
int height();
|
||||
void setSelected ( bool select );
|
||||
bool selected();
|
||||
int Id() { return m_id;}
|
||||
|
||||
virtual void drawContent ( QPainter * pe );
|
||||
virtual void draw ( QPainter & pe );
|
||||
virtual void mousePressEvent ( QMouseEvent * e );
|
||||
|
||||
private:
|
||||
int m_id;
|
||||
QString m_name;
|
||||
QString m_text;
|
||||
QString m_iconPath;
|
||||
QPixmap m_icon;
|
||||
QString m_parent;
|
||||
bool m_isCurrent;
|
||||
int m_height;
|
||||
int m_width;
|
||||
bool m_isSelected;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,436 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxplasmaindexview.h"
|
||||
|
||||
KbfxPlasmaIndexView::KbfxPlasmaIndexView ( QWidget * parent, const char *name,
|
||||
WFlags l ) :
|
||||
QCanvasView ( parent, name, l )
|
||||
{
|
||||
m_itemGroup = new KbfxPlasmaCanvasGroup ();
|
||||
m_itemGroupList = new KbfxPlasmaCanvasGroupView ();
|
||||
m_itemStack = new KbfxPlasmaCanvasStack ();
|
||||
m_pluginLoaded = "";
|
||||
m_itemStack->addGroup ( m_itemGroupList );
|
||||
viewport ()->setMouseTracking ( TRUE );
|
||||
|
||||
m_currentPos = QPoint ( 0, 0 );
|
||||
m_mousePollTimer = new QTimer ( this );
|
||||
|
||||
m_pluginList = KbfxPlasmaPluginLoader::scanPlugins ();
|
||||
viewport ()->setAcceptDrops ( true );
|
||||
this->setVScrollBarMode ( QScrollView::AlwaysOff );
|
||||
this->setHScrollBarMode ( QScrollView::AlwaysOff );
|
||||
setFrameShape ( QFrame::NoFrame );
|
||||
m_currentItem = 0L;
|
||||
m_selectedItem = 0L;
|
||||
// m_pluginList = "";
|
||||
connect ( this, SIGNAL ( clicked ( KbfxPlasmaIndexItem * ) ), this,
|
||||
SLOT ( slotClicked ( KbfxPlasmaIndexItem * ) ) );
|
||||
m_currentView = 0;
|
||||
setDragAutoScroll ( true );
|
||||
}
|
||||
|
||||
|
||||
KbfxPlasmaIndexView::~KbfxPlasmaIndexView ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::checkMousePos ()
|
||||
{
|
||||
KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
if ( QCursor::pos () == mapToGlobal ( contentsToViewport ( m_currentPos ) ) )
|
||||
{
|
||||
QMouseEvent me ( QEvent::MouseButtonPress,
|
||||
this->mapToGlobal ( m_currentPos ), Qt::LeftButton,
|
||||
Qt::LeftButton );
|
||||
|
||||
clearAll ();
|
||||
|
||||
QCanvasItemList l = canvas ()->collisions ( m_currentPos );
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
|
||||
if ( t->type () != KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
{
|
||||
emit clearSelected();
|
||||
t->mousePressEvent ( &me );
|
||||
m_selectedItem = t;
|
||||
t->setSelected ( true );
|
||||
emit clicked ( t );
|
||||
}
|
||||
|
||||
if ( t->type () == KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
tmp = KbfxPlasmaCanvasGroup::groupContaining ( t );
|
||||
// groupContaining ((KbfxPlasmaCanvasItem *) l.first ());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// if (tmp != 0)
|
||||
// tmp->shade();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::setView ( KbfxPlasmaCanvasView * view )
|
||||
{
|
||||
if ( view == NULL )
|
||||
return;
|
||||
m_currentView = view;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::clearAllButOne ( KbfxPlasmaIndexItem * i )
|
||||
{
|
||||
i = i;
|
||||
|
||||
QCanvasItemList list = canvas ()->allItems ();
|
||||
|
||||
QCanvasItemList::Iterator it = list.begin ();
|
||||
for ( ; it != list.end (); ++it )
|
||||
{
|
||||
if ( *it )
|
||||
{
|
||||
if ( *it != m_selectedItem )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
t->setCurrent ( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::clearSelection ()
|
||||
{
|
||||
QCanvasItemList list = canvas ()->allItems ();
|
||||
|
||||
QCanvasItemList::Iterator it = list.begin ();
|
||||
for ( ; it != list.end (); ++it )
|
||||
{
|
||||
if ( *it )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
t->setCurrent ( false );
|
||||
t->setSelected ( false );
|
||||
}
|
||||
}
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::leaveEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
clearAllButOne ( m_currentItem );
|
||||
emit expand ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::contextMenuSlot ( int id )
|
||||
{
|
||||
id = id;
|
||||
/*
|
||||
m_pluginList.remove ( m_pluginList.at ( id - 1 ) );
|
||||
if ( m_currentView != 0 )
|
||||
emit pluginRequest ( m_pluginMenu->text ( id ), m_currentView );
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::contentsContextMenuEvent ( QContextMenuEvent * event )
|
||||
{
|
||||
event = event;
|
||||
/*
|
||||
m_pluginMenu = new KPopupMenu ( this );;
|
||||
connect ( m_pluginMenu, SIGNAL ( activated ( int ) ), this,
|
||||
SLOT ( contextMenuSlot ( int ) ) );
|
||||
|
||||
m_pluginMenu->insertTitle ( "Insert Plugin", 0, 0 );
|
||||
int _index = 1;
|
||||
|
||||
for ( QStringList::Iterator it = m_pluginList.begin ();
|
||||
it != m_pluginList.end (); ++it )
|
||||
{
|
||||
|
||||
m_pluginMenu->insertItem ( *it, _index, _index );
|
||||
_index++;
|
||||
}
|
||||
|
||||
m_pluginMenu->exec ( event->globalPos () );
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::loadList ( KbfxDataStack * stkPtr )
|
||||
{
|
||||
if ( stkPtr == NULL )
|
||||
{
|
||||
kdDebug() << "Loading Stack Failed:KbfxListBox->loadList()" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int _height = 0;
|
||||
|
||||
KbfxPlasmaCanvasItem *box = 0;
|
||||
KbfxPlasmaCanvasItemWrapper *boxwrapper = 0;
|
||||
|
||||
KbfxPlasmaCanvasItemWrapper *indexitemwrap =
|
||||
new KbfxPlasmaCanvasItemWrapper ( canvas () );
|
||||
|
||||
m_itemGroup = new KbfxPlasmaCanvasGroup ();
|
||||
|
||||
boxwrapper = new KbfxPlasmaCanvasItemWrapper ( canvas () );
|
||||
|
||||
box =
|
||||
( KbfxPlasmaCanvasItem * ) boxwrapper->
|
||||
itemIndex ( KbfxPlasmaCanvasItem::SEPARATOR );
|
||||
|
||||
box->setLabelText ( stkPtr->name () );
|
||||
m_itemGroup->addItem ( box );
|
||||
|
||||
_height += box->height ();
|
||||
|
||||
KbfxDataStack::DataDict _dict = stkPtr->getDataDict ();
|
||||
KbfxDataStack::DataDict::Iterator it;
|
||||
for ( it = _dict.begin (); it != _dict.end (); ++it )
|
||||
{
|
||||
KbfxPlasmaIndexItem *item =
|
||||
( KbfxPlasmaIndexItem * ) indexitemwrap->
|
||||
itemIndex ( KbfxPlasmaCanvasItem::INDEX );
|
||||
|
||||
if ( item == 0 )
|
||||
return;
|
||||
|
||||
item->setType ( KbfxPlasmaCanvasItem::INDEX );
|
||||
item->setText ( it.data ().name );
|
||||
item->setName ( it.data ().name );
|
||||
item->setLabelText ( it.data ().name );
|
||||
item->setIcon ( it.data ().icon );
|
||||
item->setId ( it.key () );
|
||||
|
||||
m_itemGroup->addItem ( item );
|
||||
|
||||
item->setBelongsTo ( stkPtr->name () );
|
||||
}
|
||||
|
||||
m_itemGroupList->addGroup ( m_itemGroup );
|
||||
|
||||
if ( m_itemGroupList->height () > this->height () )
|
||||
canvas ()->resize ( this->width (), m_itemGroupList->height () );
|
||||
canvas ()->update ();
|
||||
|
||||
m_itemStack->raise ( 0 );
|
||||
|
||||
for ( QStringList::Iterator it = m_pluginList.begin ();
|
||||
it != m_pluginList.end (); ++it )
|
||||
{
|
||||
if ( *it == stkPtr->name() )
|
||||
{
|
||||
m_pluginList.remove ( it );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::setKbfxCanvas ( QCanvas * cnv )
|
||||
{
|
||||
setCanvas ( cnv );
|
||||
|
||||
canvas ()->setBackgroundPixmap ( ( *KbfxPlasmaPixmapProvider::pixmap ( "listboxbg" )) );
|
||||
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::loadPlugin ( QString name, KbfxPlasmaCanvasView * view )
|
||||
{
|
||||
if ( m_pluginList.contains ( name ) <= 0 )
|
||||
{
|
||||
KbfxPlasmaPluginLoader *m_loader = new KbfxPlasmaPluginLoader ();
|
||||
KbfxDataStack *m_stack_R = m_loader->getView ( name );
|
||||
|
||||
if ( m_stack_R == NULL )
|
||||
return;
|
||||
|
||||
if ( m_currentView != 0 )
|
||||
view->addStack ( m_stack_R, name );
|
||||
|
||||
this->loadList ( m_stack_R );
|
||||
canvas ()->update ();
|
||||
m_pluginLoaded += name;
|
||||
|
||||
delete m_loader;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
kdDebug() << "Plugin already loaded" << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::mouseMoveEvent ( QMouseEvent * me )
|
||||
{
|
||||
me = me;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::contentsMouseMoveEvent ( QMouseEvent * me )
|
||||
{
|
||||
if ( canvas () == NULL )
|
||||
return;
|
||||
|
||||
m_currentPos = me->pos ();
|
||||
|
||||
// TODO: Get wait time from config
|
||||
|
||||
this->setCursor ( QCursor ( Qt::PointingHandCursor ) );
|
||||
|
||||
QTimer::singleShot ( 800, this, SLOT ( checkMousePos () ) );
|
||||
|
||||
if ( contentsToViewport ( me->pos () ).y () < this->height () / 5 )
|
||||
{
|
||||
scrollBy ( -10, -10 );
|
||||
}
|
||||
else if ( contentsToViewport ( me->pos () ).y () > ( ( this->height () * 2 ) / 3 ) )
|
||||
{
|
||||
scrollBy ( 10, 10 );
|
||||
}
|
||||
|
||||
QScrollView::contentsMouseMoveEvent ( me );
|
||||
|
||||
|
||||
// KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
QCanvasItemList l = canvas ()->collisions ( me->pos () );
|
||||
|
||||
if ( l.count () <= 0 )
|
||||
return;
|
||||
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( *it == 0 )
|
||||
return;
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
t->mouseMoveEvent ( me );
|
||||
if ( m_currentItem != NULL )
|
||||
{
|
||||
if ( !m_currentItem->isSelected () )
|
||||
m_currentItem->setCurrent ( false );
|
||||
}
|
||||
m_currentItem = t;
|
||||
t->setCurrent ( true );
|
||||
}
|
||||
}
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::contentsMousePressEvent ( QMouseEvent * me )
|
||||
{
|
||||
if ( me->button () == RightButton )
|
||||
return;
|
||||
|
||||
clearAll ();
|
||||
|
||||
this->setCursor ( QCursor ( Qt::WaitCursor ) );
|
||||
|
||||
KbfxPlasmaCanvasGroup *tmp = 0;
|
||||
QCanvasItemList l = canvas ()->collisions ( me->pos () );
|
||||
for ( QCanvasItemList::Iterator it = l.begin (); it != l.end (); ++it )
|
||||
{
|
||||
if ( ( *it )->rtti () == CANVASITEM )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
|
||||
if ( t->type () != KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
{
|
||||
t->mousePressEvent ( me );
|
||||
m_selectedItem = t;
|
||||
t->setSelected ( true );
|
||||
emit clicked ( t );
|
||||
}
|
||||
|
||||
if ( t->type () == KbfxPlasmaCanvasItem::SEPARATOR )
|
||||
tmp = KbfxPlasmaCanvasGroup::groupContaining ( t );
|
||||
// groupContaining ((KbfxPlasmaCanvasItem *) l.first ());
|
||||
}
|
||||
}
|
||||
if ( tmp != 0 )
|
||||
tmp->shade ();
|
||||
|
||||
// m_clickPos = me->pos ();
|
||||
|
||||
QScrollView::contentsMousePressEvent ( me );
|
||||
|
||||
canvas ()->update ();
|
||||
this->setCursor ( QCursor ( Qt::PointingHandCursor ) );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::slotClicked ( KbfxPlasmaIndexItem * it )
|
||||
{
|
||||
if ( it == NULL )
|
||||
return;
|
||||
|
||||
KbfxPlasmaIndexItem *_it = ( KbfxPlasmaIndexItem * ) it;
|
||||
|
||||
KbfxSignal signal ( _it->belongsTo (), _it->Id () );
|
||||
|
||||
this->setCursor ( QCursor ( Qt::WaitCursor ) );
|
||||
emit loadRequest ( signal );
|
||||
this->setCursor ( QCursor ( Qt::PointingHandCursor ) );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxPlasmaIndexView::clearAll ()
|
||||
{
|
||||
QCanvasItemList list = canvas ()->allItems ();
|
||||
|
||||
QCanvasItemList::Iterator it = list.begin ();
|
||||
for ( ; it != list.end (); ++it )
|
||||
{
|
||||
if ( *it )
|
||||
{
|
||||
KbfxPlasmaIndexItem *t = ( KbfxPlasmaIndexItem * ) ( *it );
|
||||
t->setSelected ( false );
|
||||
}
|
||||
}
|
||||
|
||||
canvas ()->update ();
|
||||
}
|
||||
|
||||
|
||||
#include "kbfxplasmaindexview.moc"
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_PLASMA_INDEX_VIEW_H
|
||||
#define KBFX_PLASMA_INDEX_VIEW_H
|
||||
|
||||
#include <qcanvas.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kpopupmenu.h>
|
||||
|
||||
#include <kbfxdatastack.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
#include <kbfxplasmapluginloader.h>
|
||||
|
||||
#include "kbfxplasmacanvasitemwrapper.h"
|
||||
#include "kbfxplasmacanvasstack.h"
|
||||
#include "kbfxplasmacanvasview.h"
|
||||
#include "kbfxplasmaindexitem.h"
|
||||
#include "kbfxsignal.h"
|
||||
|
||||
|
||||
|
||||
class KbfxPlasmaIndexView : public QCanvasView
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
KbfxPlasmaIndexView ( QWidget * parent = 0, const char * name = 0, WFlags l = 0 );
|
||||
virtual ~KbfxPlasmaIndexView();
|
||||
void loadList ( KbfxDataStack * stkPtr );
|
||||
int count() { return m_itemGroup->count() ; }
|
||||
void setView ( KbfxPlasmaCanvasView * view );
|
||||
virtual void contentsMouseMoveEvent ( QMouseEvent * e );
|
||||
virtual void contentsMousePressEvent ( QMouseEvent * me );
|
||||
virtual void contentsContextMenuEvent ( QContextMenuEvent * e ) ;
|
||||
virtual void mouseMoveEvent ( QMouseEvent * e );
|
||||
virtual void leaveEvent ( QEvent * e );
|
||||
void setKbfxCanvas ( QCanvas * cnv );
|
||||
void clearAll();
|
||||
|
||||
public slots:
|
||||
void slotClicked ( KbfxPlasmaIndexItem * );
|
||||
void contextMenuSlot ( int id );
|
||||
void loadPlugin ( QString name,KbfxPlasmaCanvasView * );
|
||||
void checkMousePos();
|
||||
void clearSelection();
|
||||
|
||||
signals:
|
||||
void loadRequest ( KbfxSignal signal );
|
||||
void pluginRequest ( QString pluginName,KbfxPlasmaCanvasView * );
|
||||
void clicked ( KbfxPlasmaIndexItem * item );
|
||||
void expand();
|
||||
void clearSelected();
|
||||
|
||||
protected:
|
||||
void clearAllButOne ( KbfxPlasmaIndexItem * i );
|
||||
|
||||
private:
|
||||
|
||||
KbfxPlasmaCanvasGroup * m_itemGroup;
|
||||
KbfxPlasmaCanvasGroupView * m_itemGroupList;
|
||||
KbfxPlasmaCanvasStack * m_itemStack;
|
||||
KbfxPlasmaIndexItem * m_currentItem;
|
||||
KbfxPlasmaIndexItem * m_selectedItem;
|
||||
QStringList m_pluginList;
|
||||
QStringList m_pluginLoaded;
|
||||
KPopupMenu * m_pluginMenu;
|
||||
KbfxPlasmaCanvasView * m_currentView;
|
||||
QPoint m_currentPos;
|
||||
QTimer * m_mousePollTimer;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SIGNAL_H
|
||||
#define KBFX_SIGNAL_H
|
||||
|
||||
class KbfxSignal
|
||||
{
|
||||
public:
|
||||
KbfxSignal() {m_name="";}
|
||||
KbfxSignal ( QString name,uint id ) { m_name = name;m_id = id;}
|
||||
~KbfxSignal() {}
|
||||
QString name() {return m_name;}
|
||||
uint id() {return m_id;}
|
||||
private:
|
||||
QString m_name;
|
||||
uint m_id;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 <config.h>
|
||||
|
||||
#include "kbfxspinx.h"
|
||||
|
||||
bool KbfxSpinx::m_horizontal_position = TRUE;
|
||||
|
||||
KbfxSpinx::KbfxSpinx ( const QString& configFile, Type type, int actions, QWidget *parent, const char *name )
|
||||
: KPanelApplet ( configFile, type, actions, parent, name ),DCOPObject ( "KBFXInterface" )
|
||||
{
|
||||
m_parent = parent;
|
||||
createKbfx();
|
||||
}
|
||||
|
||||
KbfxSpinx::~KbfxSpinx()
|
||||
{
|
||||
}
|
||||
|
||||
void KbfxSpinx::dirtyReaload(const QString & dir)
|
||||
{
|
||||
QString _dir=dir;
|
||||
notifyConfigChange();
|
||||
}
|
||||
|
||||
void KbfxSpinx::createKbfx()
|
||||
{
|
||||
m_menu = 0; // Set to NULL
|
||||
m_tooltip = ConfigInit().m_ToolTip;
|
||||
m_kicker_auto_adjust = ConfigInit().m_ToolBarResize;
|
||||
m_KbfxWatcher = ConfigInit().m_KbfxWatcher;
|
||||
m_dcopClient = new DCOPClient ();
|
||||
m_dcopClient->attach ();
|
||||
|
||||
kbfxBtn = new KbfxButton ( this,"Kbfx Button" );
|
||||
if ( ConfigInit ().m_KbfxMenuType == "kmenu" )
|
||||
{
|
||||
kbfxBtn->show();
|
||||
kbfxBtn->repaint();
|
||||
}
|
||||
else
|
||||
{
|
||||
createRMenu();
|
||||
connect ( m_menu,SIGNAL ( aboutToHide () ),kbfxBtn,SLOT ( toggle() ) );
|
||||
}
|
||||
|
||||
kmenu_timer = new QTimer ( this,"Fade Timer" );
|
||||
connect ( kmenu_timer, SIGNAL ( timeout() ), kbfxBtn, SLOT ( toggleKMenu () ) );
|
||||
|
||||
connect ( kbfxBtn , SIGNAL ( pressed() ),this,SLOT ( showKbfxMenu() ) );
|
||||
connect ( kbfxBtn , SIGNAL ( showToolTip() ),this,SLOT ( ToolTip() ) );
|
||||
|
||||
if ( m_kicker_auto_adjust )
|
||||
m_parent->resize ( m_parent->width(),kbfxBtn->height() );
|
||||
resizeRequest();
|
||||
|
||||
if (m_KbfxWatcher)
|
||||
{
|
||||
l_watch = new KDirWatch(this,"SyscocaWatch");
|
||||
KUser * l_user = new KUser();
|
||||
QString l_path("/var/tmp/kdecache-");
|
||||
l_path.append(l_user->loginName());
|
||||
l_path.append("/");
|
||||
l_watch->addDir(l_path);
|
||||
l_watch->startScan( TRUE, FALSE);
|
||||
connect ( l_watch, SIGNAL ( dirty(const QString&) ),
|
||||
this, SLOT ( dirtyReaload(const QString&) ) );
|
||||
delete l_user;
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxSpinx::notifyConfigChange()
|
||||
{
|
||||
kdDebug() << "Got DCOP Call notifyConfigChange"
|
||||
<< endl;
|
||||
/*
|
||||
FIXME
|
||||
The delete here does not reload everything.
|
||||
Only the button and the parent menu.
|
||||
Carefull memory de-allocation is needed before deleteing further :-(
|
||||
Else be ready for a nice backtrace.
|
||||
Memleak is obvious.
|
||||
*/
|
||||
|
||||
/*
|
||||
bool _KbfxButton_m_sizeHeight = KbfxButton::m_sizeHeight;
|
||||
int _KbfxButton_m_size = KbfxButton::m_size;
|
||||
|
||||
zap ( l_watch );
|
||||
zap ( kmenu_timer );
|
||||
zap ( kbfxBtn );
|
||||
zap ( m_menu );
|
||||
zap ( m_dcopClient );
|
||||
ConfigInit().read();
|
||||
KbfxPlasmaPixmapProvider::rebuildCache();
|
||||
createKbfx();
|
||||
|
||||
KbfxButton::m_sizeHeight = _KbfxButton_m_sizeHeight;
|
||||
KbfxButton::m_size = _KbfxButton_m_size;
|
||||
kbfxBtn->loadSkins();
|
||||
*/
|
||||
|
||||
kbfxBtn -> reloadConfig();
|
||||
}
|
||||
|
||||
void KbfxSpinx::createRMenu()
|
||||
{
|
||||
m_menu = new KbfxSpinxPopUp ( this,"KbfxOpop" );
|
||||
m_menuWidget = new KbfxSpinxMenuWidget ( m_menu,"KbfxSpinxMenu" );
|
||||
m_menu->addItem ( m_menuWidget,0 );
|
||||
kbfxBtn->show();
|
||||
kbfxBtn->repaint();
|
||||
menuPosition();
|
||||
}
|
||||
|
||||
void KbfxSpinx::showKbfxMenu()
|
||||
{
|
||||
if ( ConfigInit ().m_KbfxMenuType == "kmenu" )
|
||||
{
|
||||
showKmenu ();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_menu->popup ( menuPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
void KbfxSpinx::ToolTip ()
|
||||
{
|
||||
if ( !m_tooltip )
|
||||
return;
|
||||
|
||||
KbfxToolTip *tooltip = new KbfxToolTip ();
|
||||
|
||||
QPoint xpoint = ( this->mapToGlobal ( QPoint ( 0, 0 ) ) );
|
||||
int popx = xpoint.x ();
|
||||
int popy = xpoint.y ();
|
||||
|
||||
if ( position () == pTop )
|
||||
{
|
||||
popy += this->height();
|
||||
}
|
||||
if ( position () == pBottom )
|
||||
{
|
||||
popy -= tooltip->height();
|
||||
}
|
||||
if ( position () == pLeft )
|
||||
{
|
||||
popx += this->width();
|
||||
}
|
||||
if ( position () == pRight )
|
||||
{
|
||||
popx -= tooltip->width();
|
||||
}
|
||||
|
||||
connect ( kbfxBtn, SIGNAL ( leave () ), tooltip, SLOT ( hideToolTip () ) );
|
||||
connect ( kbfxBtn, SIGNAL ( clicked () ), tooltip, SLOT ( hideToolTip () ) );
|
||||
tooltip->setStartPos ( popx, popy );
|
||||
tooltip->show ();
|
||||
}
|
||||
|
||||
void KbfxSpinx::showKmenu()
|
||||
{
|
||||
/* Import of old KBFX code */
|
||||
/**
|
||||
Note that there is no real way to know the
|
||||
height of the K-menu
|
||||
**/
|
||||
|
||||
this->setCursor ( Qt::BlankCursor );
|
||||
|
||||
QByteArray data, rdata;
|
||||
QDataStream arg ( data, IO_WriteOnly );
|
||||
QCString replytype;
|
||||
QPoint _tmp ( QCursor::pos () );
|
||||
|
||||
if ( position () == pTop || position () == pBottom )
|
||||
{
|
||||
if ( _tmp.y () > 128 )
|
||||
{
|
||||
QCursor::setPos ( this->mapToGlobal ( QPoint ( 0, 0 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QCursor::setPos ( this->mapToGlobal ( this->geometry ().bottomLeft () ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _tmp.x () > 128 )
|
||||
{
|
||||
QCursor::setPos ( this->mapToGlobal ( QPoint ( 0, 0 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QCursor::setPos ( this->mapToGlobal ( this->geometry ().topRight () ) );
|
||||
}
|
||||
}
|
||||
|
||||
arg << QPoint ( QCursor::pos () );
|
||||
|
||||
if ( !m_dcopClient->
|
||||
call ( "kicker", "kicker", "popupKMenu(QPoint)", data, replytype, rdata,
|
||||
FALSE, -1 ) )
|
||||
{
|
||||
kdWarning ()
|
||||
<< "**KBFX-APPLET-FATAL_ERROR:Could not send DCOP command"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
this->setCursor ( Qt::ArrowCursor );
|
||||
QCursor::setPos ( _tmp );
|
||||
if ( !kmenu_timer->isActive ())
|
||||
kmenu_timer->start(5000,true);
|
||||
kdDebug () << "Kmenu Called" << endl;
|
||||
}
|
||||
|
||||
void KbfxSpinx::showMenu()
|
||||
{
|
||||
showKbfxMenu();
|
||||
}
|
||||
|
||||
void KbfxSpinx::about()
|
||||
{
|
||||
// KMessageBox::information ( 0, i18n ( "This is an about box" ) );
|
||||
KRun::runCommand ( "kbfxconfigapp --about" );
|
||||
}
|
||||
|
||||
void KbfxSpinx::help()
|
||||
{
|
||||
kapp->invokeHelp ( "", "kbfxconfigapp" );
|
||||
}
|
||||
|
||||
void KbfxSpinx::preferences()
|
||||
{
|
||||
KRun::runCommand ( "kbfxconfigapp" );
|
||||
}
|
||||
|
||||
int KbfxSpinx::widthForHeight ( int height ) const
|
||||
{
|
||||
static int width_for_height = 0;
|
||||
if ( width_for_height != height || !m_horizontal_position )
|
||||
{
|
||||
if ( m_kicker_auto_adjust )
|
||||
kbfxBtn->readjust( TRUE ); // Readjust for height
|
||||
KbfxButton::m_sizeHeight = TRUE;
|
||||
KbfxButton::m_size = height;
|
||||
kbfxBtn->loadSkins();
|
||||
width_for_height = height;
|
||||
}
|
||||
m_horizontal_position = TRUE;
|
||||
return kbfxBtn->width();
|
||||
}
|
||||
|
||||
int KbfxSpinx::heightForWidth ( int width ) const
|
||||
{
|
||||
static int height_for_width = 0;
|
||||
if ( height_for_width != width || m_horizontal_position)
|
||||
{
|
||||
if ( m_kicker_auto_adjust )
|
||||
kbfxBtn->readjust( FALSE ); // Readjust for width
|
||||
KbfxButton::m_sizeHeight = FALSE;
|
||||
KbfxButton::m_size = width;
|
||||
kbfxBtn->loadSkins();
|
||||
height_for_width = width;
|
||||
}
|
||||
m_horizontal_position = FALSE;
|
||||
return kbfxBtn->height();
|
||||
}
|
||||
|
||||
QPoint KbfxSpinx::menuPosition()
|
||||
{
|
||||
QPoint xpoint = ( this->mapToGlobal ( QPoint ( 0, 0 ) ) );
|
||||
int popx = xpoint.x ();
|
||||
int popy = xpoint.y ();
|
||||
|
||||
if ( position () == pTop )
|
||||
{
|
||||
return QPoint ( popx, ( popy + this->height() ) );
|
||||
}
|
||||
if ( position () == pBottom )
|
||||
{
|
||||
return QPoint ( popx, ( popy - m_menuWidget->height() ) );
|
||||
}
|
||||
if ( position () == pLeft )
|
||||
{
|
||||
return QPoint ( ( popx + this->width() ), popy );
|
||||
}
|
||||
if ( position () == pRight )
|
||||
{
|
||||
return QPoint ( ( popx - m_menuWidget->width() ), popy );
|
||||
}
|
||||
|
||||
return xpoint; // Should never be reached?
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
KPanelApplet* init ( QWidget *parent, const QString& configFile )
|
||||
{
|
||||
KGlobal::locale()->insertCatalogue ( "KbfxSpinx" );
|
||||
return new KbfxSpinx ( configFile, KPanelApplet::Normal,
|
||||
KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences,
|
||||
parent, "KbfxSpinx" );
|
||||
}
|
||||
}
|
||||
|
||||
#include "kbfxspinx.moc"
|
@ -0,0 +1,17 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=KBFX Spinx
|
||||
Comment=K-Menu Replacement
|
||||
Comment[de]=K-Menü- Nachfolger
|
||||
Comment[el]=Αντικαταστάτης του K-Μενού
|
||||
Comment[et]=K-menüü asendus
|
||||
Comment[fr]=Remplacement du menu K
|
||||
Comment[nl]=K-Menu-vervanging
|
||||
Comment[pt]=Substituto do Menu K
|
||||
Comment[pt_BR]=Substituto do Menu K
|
||||
Comment[sv]=Ersättning av K-menyn
|
||||
Icon=kbfx
|
||||
X-KDE-Library=libkbfxspinx
|
||||
X-KDE-UniqueApplet=true
|
||||
|
||||
|
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_H
|
||||
#define KBFX_SPINX_H
|
||||
|
||||
#define zap(x) if(x){delete(x); x=0;}
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <qbitmap.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlcdnumber.h>
|
||||
#include <qpoint.h>
|
||||
#include <qpopupmenu.h>
|
||||
#include <qstring.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <dcopclient.h>
|
||||
#include <dcopobject.h>
|
||||
#include <dcopref.h>
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kdirwatch.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kpanelapplet.h>
|
||||
#include <kpopupmenu.h>
|
||||
#include <krun.h>
|
||||
#include <kuser.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
#include "kbfxbutton.h"
|
||||
#include "kbfxspinxmenu.h"
|
||||
#include "kbfxspinxpopup.h"
|
||||
#include "kbfxspinxview.h"
|
||||
#include "kbfxtooltip.h"
|
||||
|
||||
|
||||
class KbfxSpinx : public KPanelApplet,public DCOPObject
|
||||
{
|
||||
K_DCOP
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxSpinx ( const QString& configFile, Type t = Normal, int actions = 0,
|
||||
QWidget *parent = 0, const char *name = 0 );
|
||||
|
||||
~KbfxSpinx();
|
||||
virtual int widthForHeight ( int height ) const;
|
||||
virtual int heightForWidth ( int width ) const;
|
||||
virtual void about();
|
||||
virtual void help();
|
||||
virtual void preferences();
|
||||
QPoint menuPosition();
|
||||
void resizeRequest() { emit(updateLayout()); }
|
||||
k_dcop:
|
||||
ASYNC showMenu();
|
||||
ASYNC notifyConfigChange();
|
||||
|
||||
public slots:
|
||||
void showKbfxMenu();
|
||||
void showKmenu();
|
||||
void ToolTip();
|
||||
void dirtyReaload(const QString&);
|
||||
|
||||
protected:
|
||||
void createRMenu();
|
||||
void createKbfx();
|
||||
bool m_tooltip;
|
||||
|
||||
private:
|
||||
KConfig *ksConfig;
|
||||
KbfxButton * kbfxBtn;
|
||||
KbfxSpinxMenuWidget * m_menuWidget;
|
||||
KbfxSpinxPopUp * m_menu;
|
||||
QWidget * m_parent;
|
||||
bool m_kicker_auto_adjust;
|
||||
bool m_KbfxWatcher;
|
||||
static bool m_horizontal_position;
|
||||
DCOPClient * m_dcopClient;
|
||||
QTimer * kmenu_timer;
|
||||
KDirWatch * l_watch;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,513 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxspinxmenu.h"
|
||||
|
||||
KbfxSpinxMenuWidget::KbfxSpinxMenuWidget ( QWidget * parent, const char *name,
|
||||
WFlags fl ) :
|
||||
QWidget ( parent, "MenuWidget",
|
||||
fl | Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop )
|
||||
{
|
||||
m_parent = parent;
|
||||
QString _name=name;
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::reinit()
|
||||
{
|
||||
emit refresh();
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::init()
|
||||
{
|
||||
createMask ();
|
||||
|
||||
QWidget *main = new QWidget ( this );
|
||||
|
||||
m_kbfxSpinxTop = new KbfxSpinxTop ( main );
|
||||
m_toolBarBot = new KbfxSpinxToolBar ( main );
|
||||
m_toolBarBot->setMinimumHeight ( ConfigInit ().m_botBar_h );
|
||||
m_toolBarBot->setMaximumHeight ( ConfigInit ().m_botBar_h );
|
||||
m_kbfxSpinxTop->setMaximumHeight ( ConfigInit ().m_topBar_h );
|
||||
m_kbfxSpinxTop->setMinimumHeight ( ConfigInit ().m_topBar_h );
|
||||
|
||||
QWidget *middle = new QWidget ( main );
|
||||
|
||||
middle->setPalette ( QPalette ( QColor ( 24, 233, 233 ) ) );
|
||||
|
||||
// m_middleFrame = new QHBoxLayout(middle);
|
||||
|
||||
m_canvasView = new KbfxPlasmaCanvasView ( this );
|
||||
m_indexView = new KbfxPlasmaIndexView ( this );
|
||||
m_indexLeftView = new KbfxPlasmaIndexView ( this );
|
||||
|
||||
/* Search Box */
|
||||
m_searchTag = new KbfxPixmapLabel ( this, "Search:" );
|
||||
QToolTip::add( m_searchTag, tr2i18n( "Double click to clear..." ) );
|
||||
m_searchTag->normalize ();
|
||||
m_searchTag->move ( ConfigInit ().m_searchBox_x,
|
||||
ConfigInit ().m_searchBox_y );
|
||||
|
||||
QPixmap m_searchPixmap = ( *KbfxPlasmaPixmapProvider::pixmap ( "find" ) );
|
||||
|
||||
m_searchTag->setPixmap ( m_searchPixmap );
|
||||
|
||||
m_searchTag->resize ( m_searchPixmap.width (), ConfigInit ().m_searchBox_h );
|
||||
|
||||
m_search = new QLineEdit ( this, "Search BOX" );
|
||||
QToolTip::add( m_search, tr2i18n( "Type here to search..." ) );
|
||||
m_search->setFrameShape ( QFrame::NoFrame );
|
||||
m_search->setFocusPolicy ( QWidget::StrongFocus );
|
||||
m_search->move ( ConfigInit ().m_searchBox_x + m_searchTag->width (),
|
||||
ConfigInit ().m_searchBox_y );
|
||||
m_search->resize ( ConfigInit ().m_searchBox_w - m_searchTag->width (),
|
||||
ConfigInit ().m_searchBox_h );
|
||||
|
||||
connect (m_searchTag, SIGNAL (mouseDoubleClicked ( const ButtonState & )), this,
|
||||
SLOT (search_clear ( const ButtonState & )));
|
||||
|
||||
int frameHeight = ConfigInit().m_listBox_h;
|
||||
|
||||
if (frameHeight <= (this->height () - ( m_kbfxSpinxTop->height () + m_toolBarBot->height ()) ) ) {
|
||||
frameHeight = (this->height () - ( m_kbfxSpinxTop->height () +
|
||||
m_toolBarBot->height ()) );
|
||||
}
|
||||
|
||||
// m_middleFrame->addWidget(middleleft);
|
||||
m_canvasView->setMaximumHeight ( ConfigInit().m_itemView_h );
|
||||
m_canvasView->setMinimumHeight ( ConfigInit().m_itemView_h );
|
||||
m_canvasView->setMaximumWidth ( ConfigInit ().m_itemView_w );
|
||||
m_canvasView->setMinimumWidth ( ConfigInit ().m_itemView_w );
|
||||
m_appCanvas = new QCanvas ( m_canvasView->width (), m_canvasView->height () );
|
||||
m_canvasView->setKbfxCanvas ( m_appCanvas );
|
||||
m_appCanvas->setDoubleBuffering ( true );
|
||||
|
||||
m_indexView->setMaximumHeight ( frameHeight );
|
||||
m_indexView->setMinimumHeight ( frameHeight );
|
||||
m_indexView->setMaximumWidth ( ConfigInit ().m_listBox_w );
|
||||
m_indexView->setMinimumWidth ( ConfigInit ().m_listBox_w );
|
||||
m_indexCanvas = new QCanvas ( m_indexView->width (), m_indexView->height () );
|
||||
m_indexView->setKbfxCanvas ( m_indexCanvas );
|
||||
m_indexCanvas->setDoubleBuffering ( true );
|
||||
m_indexView->setView ( m_canvasView );
|
||||
|
||||
m_indexLeftView->setMaximumHeight ( frameHeight );
|
||||
m_indexLeftView->setMinimumHeight ( frameHeight );
|
||||
m_indexLeftView->setMaximumWidth ( ConfigInit ().m_listBox_w );
|
||||
m_indexLeftView->setMinimumWidth ( ConfigInit ().m_listBox_w );
|
||||
m_indexLeftCanvas =
|
||||
new QCanvas ( m_indexLeftView->width (), m_indexLeftView->height () );
|
||||
m_indexLeftView->setKbfxCanvas ( m_indexLeftCanvas );
|
||||
m_indexLeftCanvas->setDoubleBuffering ( true );
|
||||
m_indexLeftView->setView ( m_canvasView );
|
||||
|
||||
|
||||
m_canvasView->move ( ConfigInit ().m_itemView_x, ConfigInit ().m_itemView_y );
|
||||
m_indexView->move ( ConfigInit ().m_listBox_x, ConfigInit ().m_listBox_y );
|
||||
m_indexLeftView->move ( ConfigInit ().m_listBox_w + ConfigInit ().m_itemView_w,
|
||||
ConfigInit ().m_listBox_y );
|
||||
|
||||
m_fixedFrame = new QVBoxLayout ( main );
|
||||
m_fixedFrame->setResizeMode ( QLayout::Minimum );
|
||||
m_fixedFrame->addWidget ( m_kbfxSpinxTop );
|
||||
m_fixedFrame->addWidget ( middle );
|
||||
m_fixedFrame->addWidget ( m_toolBarBot );
|
||||
|
||||
m_loadedListLeft = " ";
|
||||
m_loadedListRight = " ";
|
||||
|
||||
main->resize ( this->size () );
|
||||
|
||||
loadHistory ();
|
||||
|
||||
connect ( m_indexView, SIGNAL ( loadRequest ( KbfxSignal ) ), m_canvasView,
|
||||
SLOT ( handleLoadRequest ( KbfxSignal ) ) );
|
||||
|
||||
connect ( m_indexLeftView, SIGNAL ( loadRequest ( KbfxSignal ) ), m_canvasView,
|
||||
SLOT ( handleLoadRequest ( KbfxSignal ) ) );
|
||||
|
||||
connect ( m_canvasView, SIGNAL ( clicked () ), this, SLOT ( hideMenu () ) );
|
||||
|
||||
connect ( m_search, SIGNAL ( textChanged ( const QString & ) ), m_canvasView,
|
||||
SLOT ( search ( const QString & ) ) );
|
||||
|
||||
connect ( m_indexView,
|
||||
SIGNAL ( pluginRequest ( QString, KbfxPlasmaCanvasView * ) ),
|
||||
m_indexView, SLOT ( loadPlugin ( QString, KbfxPlasmaCanvasView * ) ) );
|
||||
|
||||
connect ( m_indexLeftView,
|
||||
SIGNAL ( pluginRequest ( QString, KbfxPlasmaCanvasView * ) ),
|
||||
m_indexLeftView,
|
||||
SLOT ( loadPlugin ( QString, KbfxPlasmaCanvasView * ) ) );
|
||||
|
||||
connect ( m_indexView,
|
||||
SIGNAL ( clearSelected() ),
|
||||
m_indexLeftView, SLOT ( clearSelection() ) );
|
||||
|
||||
connect ( m_indexLeftView,
|
||||
SIGNAL ( clearSelected() ),
|
||||
m_indexView,
|
||||
SLOT ( clearSelection() ) );
|
||||
|
||||
connect (this,SIGNAL(refresh()),m_canvasView,SLOT(reload()));
|
||||
connect (this,SIGNAL(runItem()),m_canvasView,SLOT(execFirst()));
|
||||
|
||||
KbfxSpinxToolButton *logout = new KbfxSpinxToolButton ( m_toolBarBot );
|
||||
KbfxSpinxToolButton *lock = new KbfxSpinxToolButton ( m_toolBarBot );
|
||||
|
||||
lock ->setPixmaps ( ( *KbfxPlasmaPixmapProvider::pixmap ( "lock" ) ),
|
||||
( *KbfxPlasmaPixmapProvider::pixmap ( "lockhover" ) ) );
|
||||
|
||||
logout ->setPixmaps ( ( *KbfxPlasmaPixmapProvider::pixmap ( "logout" ) ),
|
||||
( *KbfxPlasmaPixmapProvider::pixmap ( "logouthover" ) ) );
|
||||
|
||||
KbfxDataSource *logoutSrc = new KbfxDataSource ();
|
||||
logoutSrc->setCommand ( "dcop kdesktop KDesktopIface logout" );
|
||||
logoutSrc->setName ( "Logout" );
|
||||
|
||||
KbfxDataSource *lockSrc = new KbfxDataSource ();
|
||||
lockSrc->setCommand ( "dcop kdesktop KScreensaverIface lock" );
|
||||
lockSrc->setName ( "logout" );
|
||||
|
||||
logout->setDataSource ( logoutSrc );
|
||||
lock ->setDataSource ( lockSrc );
|
||||
|
||||
delete logoutSrc;
|
||||
delete lockSrc;
|
||||
m_toolBarBot->addButton ( logout );
|
||||
m_toolBarBot->addButton ( lock );
|
||||
|
||||
connect ( logout,SIGNAL ( clicked() ),this , SLOT ( hideMenu() ) );
|
||||
connect ( lock ,SIGNAL ( clicked() ),this , SLOT ( hideMenu() ) );
|
||||
}
|
||||
|
||||
|
||||
KbfxSpinxMenuWidget::~KbfxSpinxMenuWidget ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::search_clear ( const ButtonState & _btn )
|
||||
{
|
||||
if ( _btn == Qt::LeftButton )
|
||||
{
|
||||
/* Clear the search box */
|
||||
m_search->clear();
|
||||
/* Clear the search canvas */
|
||||
m_canvasView->clearAll ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
KbfxSpinxMenuWidget::changeHeight (int het)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::createMask ()
|
||||
{
|
||||
QPixmap maskpng = ( *KbfxPlasmaPixmapProvider::pixmap ( "mask" ) );
|
||||
QImage rawimg = maskpng.convertToImage ();
|
||||
|
||||
rawimg =
|
||||
rawimg.smoothScale ( ConfigInit ().m_userMenuWidth,
|
||||
ConfigInit ().m_userMenuHeight,
|
||||
QImage::ScaleFree );
|
||||
|
||||
maskpng.convertFromImage ( rawimg );
|
||||
|
||||
setMinimumWidth ( maskpng.width () );
|
||||
setMinimumHeight ( maskpng.height () );
|
||||
// setMaximumWidth ( maskpng.width () );
|
||||
// setMaximumHeight ( maskpng.height () );
|
||||
if ( !maskpng.mask () )
|
||||
if ( rawimg.hasAlphaBuffer () )
|
||||
{
|
||||
QBitmap bm;
|
||||
bm = rawimg.createAlphaMask ();
|
||||
maskpng.setMask ( bm );
|
||||
}
|
||||
else
|
||||
{
|
||||
QBitmap bm;
|
||||
bm = rawimg.createHeuristicMask ();
|
||||
// maskpng.setMask ( bm );
|
||||
}
|
||||
|
||||
if ( maskpng.mask () && m_parent )
|
||||
m_parent->setMask ( *maskpng.mask () );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::resizeContent ()
|
||||
{}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::loadHistory ()
|
||||
{
|
||||
QStringList::Iterator it;
|
||||
for ( it = ConfigInit ().m_pluginsLeft.begin ();
|
||||
it != ConfigInit ().m_pluginsLeft.end (); ++it )
|
||||
{
|
||||
if ( (*it) != NULL)
|
||||
this->loadPluginLeft ( ( *it ) );
|
||||
}
|
||||
for ( it = ConfigInit ().m_pluginsRight.begin ();
|
||||
it != ConfigInit ().m_pluginsRight.end (); ++it )
|
||||
{
|
||||
if ( (*it) != NULL)
|
||||
this->loadPluginRight ( ( *it ) );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::enterPressed ()
|
||||
{
|
||||
kdDebug() << "TODO: Implement Enter Presed" << endl;
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
KbfxSpinxMenuWidget::propergateMove (QMouseEvent * me)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::hideMenu ()
|
||||
{
|
||||
emit nowHidden ();
|
||||
m_parent->hide ();
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
KbfxSpinxMenuWidget::mouseMoveEvent (QMouseEvent * me)
|
||||
{
|
||||
// m_listBox->setFocus();
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::loadPluginLeft ( QString name )
|
||||
{
|
||||
if (name == NULL) {
|
||||
return;
|
||||
}
|
||||
if ( m_loadedListLeft.contains ( name ) <= 0 )
|
||||
{
|
||||
m_loader = new KbfxPlasmaPluginLoader ();
|
||||
m_stack_R = m_loader->getView ( name );
|
||||
|
||||
if ( m_stack_R == NULL )
|
||||
return;
|
||||
|
||||
m_canvasView->addStack ( m_stack_R, name );
|
||||
m_indexView->loadList ( m_stack_R );
|
||||
delete m_loader;
|
||||
m_loadedListLeft += name;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
kdDebug() << "Plugin already loaded" << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::loadPluginRight ( QString name )
|
||||
{
|
||||
if ( m_loadedListRight.contains ( name ) <= 0 )
|
||||
{
|
||||
m_loader = new KbfxPlasmaPluginLoader ();
|
||||
m_stack_R = m_loader->getView ( name );
|
||||
|
||||
if ( m_stack_R == NULL )
|
||||
return;
|
||||
|
||||
m_canvasView->addStack ( m_stack_R, name );
|
||||
m_indexLeftView->loadList ( m_stack_R );
|
||||
delete m_loader;
|
||||
m_loadedListRight += name;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
kdDebug() << "Plugin already loaded" << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
KbfxSpinxMenuWidget::focusInEvent (QFocusEvent * te)
|
||||
{
|
||||
kdDebug() << "TODO: Handle Focus Event" << endl;
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
KbfxSpinxMenuWidget::keyPressEvent ( QKeyEvent * e )
|
||||
{
|
||||
if ( e->key () == Qt::Key_Backspace )
|
||||
{
|
||||
m_search->backspace ();
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key () == Qt::Key_Escape )
|
||||
{
|
||||
hideMenu ();
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key() == Qt::Key_Return )
|
||||
{
|
||||
hideMenu ();
|
||||
m_canvasView->setFocus ();
|
||||
KRun::runCommand ( m_search->text ());
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key () == Qt::Key_Up )
|
||||
{
|
||||
m_search->setFocus ();
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key () == Qt::Key_Down )
|
||||
{
|
||||
m_canvasView->setFocus ();
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key () == Qt::Key_Control
|
||||
|| e->key () == Qt::Key_Alt
|
||||
|| e->key () == Qt::Key_Pause
|
||||
|| e->key () == Qt::Key_Print
|
||||
|| e->key () == Qt::Key_SysReq
|
||||
|| e->key () == Qt::Key_Meta
|
||||
|| e->key () == Qt::Key_CapsLock
|
||||
|| e->key () == Qt::Key_NumLock
|
||||
|| e->key () == Qt::Key_ScrollLock
|
||||
|| e->key () == Qt::Key_F1
|
||||
|| e->key () == Qt::Key_F2
|
||||
|| e->key () == Qt::Key_F3
|
||||
|| e->key () == Qt::Key_F4
|
||||
|| e->key () == Qt::Key_F5
|
||||
|| e->key () == Qt::Key_F6
|
||||
|| e->key () == Qt::Key_F7
|
||||
|| e->key () == Qt::Key_F8
|
||||
|| e->key () == Qt::Key_F9
|
||||
|| e->key () == Qt::Key_F10
|
||||
|| e->key () == Qt::Key_F11
|
||||
|| e->key () == Qt::Key_F12
|
||||
|| e->key () == Qt::Key_F13
|
||||
|| e->key () == Qt::Key_F14
|
||||
|| e->key () == Qt::Key_F15
|
||||
|| e->key () == Qt::Key_F16
|
||||
|| e->key () == Qt::Key_F17
|
||||
|| e->key () == Qt::Key_F18
|
||||
|| e->key () == Qt::Key_F19
|
||||
|| e->key () == Qt::Key_F20
|
||||
|| e->key () == Qt::Key_Super_L
|
||||
|| e->key () == Qt::Key_Super_R
|
||||
|| e->key () == Qt::Key_Menu
|
||||
|| e->key () == Qt::Key_Hyper_L
|
||||
|| e->key () == Qt::Key_Hyper_R
|
||||
|| e->key () == Qt::Key_Help
|
||||
|| e->key () == Qt::Key_Back
|
||||
|| e->key () == Qt::Key_Forward
|
||||
|| e->key () == Qt::Key_Stop
|
||||
|| e->key () == Qt::Key_Refresh
|
||||
|| e->key () == Qt::Key_VolumeDown
|
||||
|| e->key () == Qt::Key_VolumeMute
|
||||
|| e->key () == Qt::Key_VolumeUp
|
||||
|| e->key () == Qt::Key_BassBoost
|
||||
|| e->key () == Qt::Key_BassUp
|
||||
|| e->key () == Qt::Key_BassDown
|
||||
|| e->key () == Qt::Key_TrebleUp
|
||||
|| e->key () == Qt::Key_TrebleDown
|
||||
|| e->key () == Qt::Key_MediaPlay
|
||||
|| e->key () == Qt::Key_MediaStop
|
||||
|| e->key () == Qt::Key_MediaPrev
|
||||
|| e->key () == Qt::Key_MediaNext
|
||||
|| e->key () == Qt::Key_MediaRecord
|
||||
|| e->key () == Qt::Key_HomePage
|
||||
|| e->key () == Qt::Key_Favorites
|
||||
|| e->key () == Qt::Key_Search
|
||||
|| e->key () == Qt::Key_Standby
|
||||
|| e->key () == Qt::Key_OpenUrl
|
||||
|| e->key () == Qt::Key_LaunchMail
|
||||
|| e->key () == Qt::Key_LaunchMedia
|
||||
)
|
||||
{
|
||||
hideMenu ();
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
else if ( e->key() == Qt::Key_Alt )
|
||||
{
|
||||
hideMenu ();
|
||||
m_canvasView->setFocus ();
|
||||
emit runItem ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
else if ( e->key () == Qt::Key_Tab )
|
||||
{
|
||||
// m_listBox->setFocus ();
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key () >= Qt::Key_0 && e->key () <= Qt::Key_9 )
|
||||
{
|
||||
printf ( "%d \n", e->key () );
|
||||
emit runItemAt ( e->key () );
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( e->key () == Qt::Key_Left )
|
||||
{
|
||||
m_canvasView->setFocus ();
|
||||
m_canvasView->emulatedKeyPress ( e );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
m_search->show ();
|
||||
m_search->setText ( m_search->text () + e->text () );
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
#include "kbfxspinxmenu.moc"
|
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_MENU_WIDGET_H
|
||||
#define KBFX_SPINX_MENU_WIDGET_H
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qbitmap.h>
|
||||
#include <qcanvas.h>
|
||||
#include <qframe.h>
|
||||
#include <qhbox.h>
|
||||
#include <qimage.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qvbox.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
//#include <kbfxdatasource.h>
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxdatastack.h>
|
||||
#include <kbfxpixmaplabel.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
#include <kbfxplasmapluginloader.h>
|
||||
|
||||
//#include "kbfxplasmalistview.h"
|
||||
//#include "kbfxplasmalistbox.h"
|
||||
#include "kbfxplasmacanvasgroup.h"
|
||||
#include "kbfxplasmacanvasview.h"
|
||||
#include "kbfxplasmaindexview.h"
|
||||
#include "kbfxsignal.h"
|
||||
#include "kbfxspinxscrollbar.h"
|
||||
#include "kbfxspinxtoolbar.h"
|
||||
#include "kbfxspinxtoolbutton.h"
|
||||
#include "kbfxspinxtop.h"
|
||||
#include "kbfxspinxview.h"
|
||||
|
||||
|
||||
class KbfxSpinxMenuWidget:public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public :
|
||||
KbfxSpinxMenuWidget ( QWidget * parent = 0, const char * name = 0,WFlags fl =0 );
|
||||
virtual ~KbfxSpinxMenuWidget();
|
||||
// virtual void mouseMoveEvent(QMouseEvent * me);
|
||||
// virtual void focusInEvent ( QFocusEvent * ) ;
|
||||
virtual void keyPressEvent ( QKeyEvent * e ) ;
|
||||
void grabEvent ( QKeyEvent * e ) { keyPressEvent ( e );}
|
||||
void loadHistory();
|
||||
void resizeContent();
|
||||
void reinit();
|
||||
public slots:
|
||||
void hideMenu();
|
||||
// void propergateMove(QMouseEvent * me);
|
||||
void loadPluginLeft ( QString name );
|
||||
void loadPluginRight ( QString name );
|
||||
void enterPressed();
|
||||
void search_clear ( const ButtonState & );
|
||||
// void changeHeight(int h);
|
||||
signals:
|
||||
void nowHidden();
|
||||
void runItem();
|
||||
void runItemAt ( int i );
|
||||
void leads();
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
void init();
|
||||
QPoint menuPosition();
|
||||
void createMask();
|
||||
KbfxPlasmaCanvasView * m_canvasView;
|
||||
// KbfxPlasmaCanvasView * m_indexView;
|
||||
QCanvas * m_canvas ;
|
||||
// KbfxPlasmaListBox * m_listBox;
|
||||
KbfxPlasmaPluginLoader * m_loader;
|
||||
KbfxSpinxTop * m_menuTop;
|
||||
QString m_loadedListLeft;
|
||||
QString m_loadedListRight;
|
||||
// FIXME: canvasstack is depricated Interface
|
||||
KbfxPlasmaCanvasStack * m_stack;
|
||||
KbfxDataStack * m_stack_R;
|
||||
QWidget * m_parent;
|
||||
QLineEdit * m_search;
|
||||
KbfxPixmapLabel * m_searchTag;
|
||||
KbfxSpinxToolBar * m_toolBarBot;
|
||||
KbfxSpinxToolBar * m_toolBarSide;
|
||||
int m_h;
|
||||
|
||||
/* SUPER NEW LAYOUT FIX HERE */
|
||||
|
||||
QBoxLayout * m_fixedFrame;
|
||||
QBoxLayout * m_middleFrame;
|
||||
QCanvas * m_appCanvas;
|
||||
QCanvas * m_indexCanvas;
|
||||
QCanvas * m_indexLeftCanvas;
|
||||
|
||||
KbfxPlasmaIndexView * m_indexView;
|
||||
|
||||
KbfxPlasmaIndexView * m_indexLeftView;
|
||||
KbfxSpinxTop * m_kbfxSpinxTop;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// C++ Implementation: kbfxspinxpopup
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Siraj Razick <sirajr@gmail.com>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "kbfxspinxpopup.h"
|
||||
|
||||
KbfxSpinxPopUp::KbfxSpinxPopUp ( QWidget * parent, const char * name ) :QPopupMenu ( parent,name )
|
||||
{
|
||||
m_mainItem = 0L;
|
||||
}
|
||||
|
||||
|
||||
KbfxSpinxPopUp::~KbfxSpinxPopUp()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxPopUp::keyPressEvent ( QKeyEvent * e )
|
||||
{
|
||||
/*
|
||||
if ( e->key() == Qt::Key_Tab )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if ( e->key() == Qt::Key_Up )
|
||||
{
|
||||
m_mainItem->grabEvent ( e );
|
||||
// e->ignore();
|
||||
return ;
|
||||
}
|
||||
*/
|
||||
m_mainItem->grabEvent ( e );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxPopUp::addItem ( QWidget * item,int index )
|
||||
{
|
||||
m_mainItem = ( KbfxSpinxMenuWidget* ) item;
|
||||
this->insertItem ( item,index );
|
||||
|
||||
}
|
||||
#include "kbfxspinxpopup.moc"
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// C++ Interface: kbfxspinxpopup
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Siraj Razick <sirajr@gmail.com>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef KBFX_SPINX_POP_UP_H
|
||||
#define KBFX_SPINX_POP_UP_H
|
||||
|
||||
#include <qpopupmenu.h>
|
||||
#include "kbfxspinxmenu.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@author Siraj Razick <sirajr@gmail.com>
|
||||
*/
|
||||
class KbfxSpinxPopUp : public QPopupMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxSpinxPopUp ( QWidget * parent = 0, const char * name = 0 ) ;
|
||||
|
||||
~KbfxSpinxPopUp();
|
||||
virtual void keyPressEvent ( QKeyEvent * ke );
|
||||
void addItem ( QWidget * item,int index );
|
||||
private:
|
||||
KbfxSpinxMenuWidget * m_mainItem;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxspinxscrollbar.h"
|
||||
|
||||
KbfxSpinxScrollBar::KbfxSpinxScrollBar ( QWidget * parent, const char *name, int type ) :
|
||||
QWidget ( parent, name )
|
||||
{
|
||||
if (type == 0){
|
||||
m_normal = ( *KbfxPlasmaPixmapProvider::pixmap ( "scrollnormal" ) );
|
||||
} else {
|
||||
m_normal = ( *KbfxPlasmaPixmapProvider::pixmap ( "scrollnormalbot" ) );
|
||||
}
|
||||
QImage _tmp_img = m_normal.convertToImage();
|
||||
_tmp_img = _tmp_img.smoothScale ( ConfigInit().m_itemView_w, m_normal.height (),QImage::ScaleFree );
|
||||
m_normal = QPixmap ( _tmp_img );
|
||||
|
||||
this->resize ( m_normal.width (), m_normal.height () );
|
||||
|
||||
_x = this->x () /40;
|
||||
_y = this->y ();
|
||||
w = this->width () / 40;
|
||||
h = this->height () / 2;
|
||||
_x += ( this->width () - w ) / 2;
|
||||
_y += ( this->height () - h ) / 2;
|
||||
m_triAngle = QPointArray ( 3 );
|
||||
m_dir = DOWN;
|
||||
m_timer = new QTimer ( this,"ScrollTimer" );
|
||||
connect ( m_timer,SIGNAL ( timeout() ),this,SLOT ( timeoutslot() ) );
|
||||
m_pressed = false;
|
||||
|
||||
}
|
||||
|
||||
KbfxSpinxScrollBar::~KbfxSpinxScrollBar ()
|
||||
{}
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::paintEvent ( QPaintEvent * pe )
|
||||
{
|
||||
QRect r = pe->rect();
|
||||
QPainter p;
|
||||
p.begin ( this );
|
||||
p.drawPixmap ( QRect ( 0, 0, m_normal.width (), m_normal.height () ),
|
||||
m_normal );
|
||||
p.setPen ( QColor ( 255,255,255 ) );
|
||||
if ( m_pressed == false )
|
||||
p.setBrush ( QColor ( 255,255,255 ) );
|
||||
else
|
||||
p.setBrush ( QColor ( 0,0,0 ) );
|
||||
|
||||
p.drawPolygon ( m_triAngle );
|
||||
p.end ();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::setType ( Direction dir )
|
||||
{
|
||||
if ( dir == DOWN )
|
||||
{
|
||||
m_triAngle.setPoint ( 0, _x, _y );
|
||||
m_triAngle.setPoint ( 1, _x + w, _y );
|
||||
m_triAngle.setPoint ( 2, _x + w / 2, _y + h );
|
||||
|
||||
}
|
||||
else if ( dir == UP )
|
||||
{
|
||||
m_triAngle.setPoint ( 0, _x, _y + h );
|
||||
m_triAngle.setPoint ( 1, _x + w, _y + h );
|
||||
m_triAngle.setPoint ( 2, _x + w / 2, _y );
|
||||
}
|
||||
m_dir = dir;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::mousePressEvent ( QMouseEvent * me )
|
||||
{
|
||||
me = me;
|
||||
m_pressed = true;
|
||||
m_timer->start ( 50,false );
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::mouseReleaseEvent ( QMouseEvent * me )
|
||||
{
|
||||
me = me;
|
||||
m_pressed = false;
|
||||
m_timer->stop();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::enterEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
m_pressed = true;
|
||||
m_timer->start ( 50,false );
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::leaveEvent ( QEvent *e )
|
||||
{
|
||||
e =e ;
|
||||
m_pressed = false;
|
||||
m_timer->stop();
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxScrollBar::timeoutslot()
|
||||
{
|
||||
if ( m_dir == DOWN )
|
||||
emit scroll ( 0,20 );
|
||||
else if ( m_dir == UP )
|
||||
emit scroll ( 0,-20 );
|
||||
}
|
||||
|
||||
#include "kbfxspinxscrollbar.moc"
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_SCROLL_BAR_H
|
||||
#define KBFX_SPINX_SCROLL_BAR_H
|
||||
|
||||
#include <qimage.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qpointarray.h>
|
||||
#include <qtimer.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
|
||||
class QWidget;
|
||||
|
||||
class KbfxSpinxScrollBar:public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum {UP,DOWN,LEFT,RIGHT} Direction;
|
||||
KbfxSpinxScrollBar ( QWidget * parent = 0,const char * name = 0,int type = 0 );
|
||||
~KbfxSpinxScrollBar();
|
||||
virtual void paintEvent ( QPaintEvent * ev );
|
||||
virtual void mousePressEvent ( QMouseEvent * me );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * me );
|
||||
virtual void enterEvent ( QEvent * e );
|
||||
virtual void leaveEvent ( QEvent * e );
|
||||
void setType ( Direction dir );
|
||||
public slots:
|
||||
void timeoutslot();
|
||||
|
||||
signals:
|
||||
void scrollUp();
|
||||
void scrollDown();
|
||||
void scroll ( int , int );
|
||||
|
||||
private:
|
||||
QPixmap m_normal;
|
||||
QPixmap m_hover;
|
||||
QPixmap m_presseod;
|
||||
QPointArray m_triAngle;
|
||||
Direction m_dir;
|
||||
QTimer * m_timer;
|
||||
bool m_pressed;
|
||||
|
||||
|
||||
//
|
||||
int _x;
|
||||
int _y;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxspinxtoolbar.h"
|
||||
|
||||
KbfxSpinxToolBar::KbfxSpinxToolBar ( QWidget * parent , const char * name , WFlags l ) :QWidget ( parent,name,l )
|
||||
{
|
||||
|
||||
_y = 0;
|
||||
m_bg = ( *KbfxPlasmaPixmapProvider::pixmap ( "botbg" ) );
|
||||
// _x = m_bg.width();
|
||||
_x = ConfigInit().m_botBar_w;
|
||||
}
|
||||
|
||||
|
||||
KbfxSpinxToolBar::~KbfxSpinxToolBar()
|
||||
{}
|
||||
|
||||
void
|
||||
KbfxSpinxToolBar::setSize ( QSize size )
|
||||
{
|
||||
this->resize ( size );
|
||||
_x = size.width();
|
||||
_y = size.height();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void KbfxSpinxToolBar::addButton ( KbfxSpinxToolButton * btn )
|
||||
{
|
||||
// KbfxSpinxToolButton * _btn = btn;
|
||||
_x -= btn->width();
|
||||
// btn->resize(this->height()-10,this->height()-10);
|
||||
btn->move ( _x, ( this->height()-btn->height() ) /4 );
|
||||
btn->show();
|
||||
btn->update();
|
||||
}
|
||||
|
||||
void KbfxSpinxToolBar::paintEvent ( QPaintEvent * pe )
|
||||
{
|
||||
pe = pe ;
|
||||
QPainter p;
|
||||
p.begin ( this );
|
||||
p.drawPixmap ( QRect ( 0,0,ConfigInit().m_botBar_w,ConfigInit().m_botBar_h ),m_bg );
|
||||
p.end();
|
||||
}
|
||||
|
||||
|
||||
#include "kbfxspinxtoolbar.moc"
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_TOOL_BAR_H
|
||||
#define KBFX_SPINX_TOOL_BAR_H
|
||||
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qstring.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
#include "kbfxspinxtoolbutton.h"
|
||||
|
||||
class KbfxSpinxToolBar:public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
KbfxSpinxToolBar ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
|
||||
virtual ~KbfxSpinxToolBar();
|
||||
virtual void paintEvent ( QPaintEvent * pe );
|
||||
|
||||
void addButton ( KbfxSpinxToolButton * btn );
|
||||
void setSize ( QSize s );
|
||||
|
||||
private:
|
||||
int _x;
|
||||
int _y;
|
||||
int m_buttonWidth;
|
||||
int m_buttonHeight;
|
||||
QPixmap m_bg;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxspinxtoolbutton.h"
|
||||
|
||||
KbfxSpinxToolButton::KbfxSpinxToolButton ( QWidget * parent , const char * name ) :QLabel ( parent,name,Qt::WStaticContents | Qt::WNoAutoErase |Qt::WPaintDesktop )
|
||||
{
|
||||
m_dataSource = 0;
|
||||
m_dataGroup = 0;
|
||||
m_fadeTime = ConfigInit().m_fadeTime;
|
||||
|
||||
fade_timer = new QTimer ( this,"Fade Timer" );
|
||||
connect ( fade_timer,SIGNAL ( timeout() ),this,SLOT ( fade() ) );
|
||||
}
|
||||
|
||||
|
||||
KbfxSpinxToolButton::~KbfxSpinxToolButton()
|
||||
{}
|
||||
|
||||
void KbfxSpinxToolButton::fade ( )
|
||||
{
|
||||
if ( m_fadeTime == 0 )
|
||||
{
|
||||
m_current = m_fadePix;
|
||||
}
|
||||
else
|
||||
{
|
||||
QImage _final = m_fadePix.convertToImage ();
|
||||
QImage _current = m_current.convertToImage ();
|
||||
|
||||
if ( !fade_timer->isActive ())
|
||||
{
|
||||
m_opacity = 0;
|
||||
fade_timer->start( m_fadeTime, false);
|
||||
}
|
||||
if ( m_opacity > 0.9 )
|
||||
fade_timer->stop();
|
||||
m_opacity += 0.1;
|
||||
|
||||
KImageEffect::blend ( _final, _current, m_opacity);
|
||||
m_current = QPixmap ( _current );
|
||||
}
|
||||
this->resize ( m_current.size() );
|
||||
this->update();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxToolButton::enterEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
m_fadePix = m_hover;
|
||||
fade();
|
||||
this->setCursor ( QCursor ( Qt::PointingHandCursor ) );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxToolButton::leaveEvent ( QEvent * e )
|
||||
{
|
||||
e = e;
|
||||
m_fadePix = m_normal;
|
||||
fade();
|
||||
this->setCursor ( QCursor ( Qt::ArrowCursor ) );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxToolButton::setPixmaps ( QPixmap normal, QPixmap hover )
|
||||
{
|
||||
QSize _sizeNormal = normal.size();
|
||||
QImage _tmpHover = hover.convertToImage ();
|
||||
_tmpHover = _tmpHover.smoothScale ( _sizeNormal, QImage::ScaleFree );
|
||||
|
||||
m_normal = normal;
|
||||
m_hover = QPixmap ( _tmpHover );
|
||||
m_current = m_normal;
|
||||
|
||||
resize ( m_current.size () );
|
||||
this->repaint();
|
||||
this->update();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxToolButton::setDataSource ( KbfxDataSource * src )
|
||||
{
|
||||
m_name = src->name();
|
||||
m_icon = src->icon();
|
||||
m_exe = src->command();
|
||||
m_dataSource = new KbfxDataSource();
|
||||
*m_dataSource = *src; // copy
|
||||
KIconLoader *iconload = KGlobal::iconLoader ();
|
||||
QString m_iconPath = iconload->iconPath ( m_icon, KIcon::Desktop, false );
|
||||
m_iconPixmap = QPixmap ( m_iconPath );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxToolButton::paintEvent ( QPaintEvent * e )
|
||||
{
|
||||
QRect r = e->rect();
|
||||
QPainter p;
|
||||
QPixmap buffer ( m_current.size() );
|
||||
buffer.fill();
|
||||
p.begin ( this );
|
||||
p.setPen ( QColor ( 255,255,255 ) );
|
||||
p.drawPixmap ( QRect ( 0, 0, m_current.width(), m_current.height() ), m_current );
|
||||
p.end();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxToolButton::mouseReleaseEvent ( QMouseEvent * me )
|
||||
{
|
||||
me = me;
|
||||
if ( m_dataSource == 0 )
|
||||
return;
|
||||
else
|
||||
KRun::runCommand ( m_dataSource->command() );
|
||||
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
#include "kbfxspinxtoolbutton.moc"
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_TOOL_BUTTON_H
|
||||
#define KBFX_SPINX_TOOL_BUTTON_H
|
||||
|
||||
#include <qcursor.h>
|
||||
#include <qimage.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qtimer.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kiconloader.h>
|
||||
#include <kimageeffect.h>
|
||||
#include <krun.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxdatagroup.h>
|
||||
#include <kbfxdatasource.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
class KbfxSpinxToolButton:public QLabel
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum{SINGLE=0,EXPANDABLE} ButtonType;
|
||||
|
||||
KbfxSpinxToolButton ( QWidget * parent = 0, const char * name = 0 );
|
||||
virtual ~KbfxSpinxToolButton();
|
||||
virtual void paintEvent ( QPaintEvent * pe );
|
||||
|
||||
virtual void enterEvent ( QEvent * e );
|
||||
virtual void leaveEvent ( QEvent * l );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * me );
|
||||
/*
|
||||
virtual void mousePressEvent(QMouseEvent * me);
|
||||
*/
|
||||
void setDataSource ( KbfxDataSource * src );
|
||||
// void setDataGroup(KbfxDataGroup * gsrc);
|
||||
void setName ( QString name ) {m_name =name;}
|
||||
void setExec ( QString cmd ) { m_exe = cmd;}
|
||||
void setType ( KbfxSpinxToolButton::ButtonType type ) { m_type = type;}
|
||||
void setIcon ( QString path );
|
||||
void setPixmaps ( QPixmap , QPixmap );
|
||||
|
||||
public slots:
|
||||
void fade();
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_exe;
|
||||
QString m_icon;
|
||||
QString m_tooltip;
|
||||
|
||||
QPixmap m_normal;
|
||||
QPixmap m_pressed;
|
||||
QPixmap m_hover;
|
||||
QPixmap m_current;
|
||||
QPixmap m_iconPixmap;
|
||||
KbfxDataSource * m_dataSource;
|
||||
KbfxDataGroup * m_dataGroup;
|
||||
ButtonType m_type;
|
||||
bool m_statePressed;
|
||||
QTimer * fade_timer;
|
||||
float m_opacity;
|
||||
QPixmap m_fadePix;
|
||||
int m_fadeTime;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxspinxtop.h"
|
||||
|
||||
KbfxSpinxTop::KbfxSpinxTop ( QWidget * parent,const char * name ) :QWidget ( parent,name,Qt::WNoAutoErase | WStaticContents | Qt::WPaintClever | Qt::WNoAutoErase )
|
||||
{
|
||||
|
||||
m_background = ( *KbfxPlasmaPixmapProvider::pixmap ( "topbg" ) );
|
||||
m_currentTextBuffer = "";
|
||||
|
||||
this->resize ( ConfigInit().m_topBar_w,ConfigInit().m_topBar_h );
|
||||
// this->resize(m_background.size());
|
||||
loadFaceIcon();
|
||||
createDudeBox();
|
||||
m_userName=getUserName();
|
||||
|
||||
}
|
||||
|
||||
KbfxSpinxTop::~KbfxSpinxTop()
|
||||
{}
|
||||
|
||||
void
|
||||
KbfxSpinxTop::mousePressEvent ( QMouseEvent * e )
|
||||
{
|
||||
e = e;
|
||||
emit sizeChange ( 10 );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxSpinxTop::createDudeBox()
|
||||
{
|
||||
m_dudeBox = ( *KbfxPlasmaPixmapProvider::pixmap ( "dudebox" ) );
|
||||
// int padding = ((m_dudeBox.height()-m_faceIcon.height()))/2;
|
||||
|
||||
QPainter p;
|
||||
p.begin ( &m_dudeBox );
|
||||
// p.drawPixmap(QRect(padding,padding,m_faceIcon.width(),m_faceIcon.height()),m_faceIcon);
|
||||
p.drawPixmap ( QRect ( ConfigInit().m_faceIconX,ConfigInit().m_faceIconY,ConfigInit().m_faceIconW,ConfigInit().m_faceIconH ),m_faceIcon );
|
||||
p.end();
|
||||
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
KbfxSpinxTop::getUserName ()
|
||||
{
|
||||
KUser *user = new KUser ();
|
||||
QString logInName ( user->fullName () );
|
||||
// Nookie says some might find it discriminating... We don't want that.
|
||||
if ( logInName == "root" )
|
||||
logInName = QString ( "Administrator" );
|
||||
delete user;
|
||||
return logInName.upper ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxTop::loadFaceIcon()
|
||||
{
|
||||
QImage UserImage ( ConfigInit().m_SpinxDudeImage );
|
||||
UserImage = UserImage.smoothScale ( 48, 48 );
|
||||
m_faceIcon = QPixmap ( UserImage );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxSpinxTop::paintEvent ( QPaintEvent * pe )
|
||||
{
|
||||
pe = pe;
|
||||
QRect * r = new QRect ( 0,0,ConfigInit().m_topBar_w,ConfigInit().m_topBar_h );
|
||||
|
||||
m_pixmapbuff = new QPixmap();
|
||||
m_pixmapbuff->resize ( r->size() );
|
||||
m_pixmapbuff->fill ( this, r->topLeft() );
|
||||
|
||||
QPainter p;
|
||||
p.begin ( m_pixmapbuff,this );
|
||||
// Draw commands are here
|
||||
p.drawPixmap ( *r,m_background );
|
||||
p.setPen ( QColor ( ConfigInit().m_userNameColor ) );
|
||||
|
||||
p.drawPixmap ( QRect ( ConfigInit().m_facePos_x,ConfigInit().m_facePos_y,m_dudeBox.width(),m_dudeBox.height() ),m_dudeBox );
|
||||
if ( !ConfigInit().m_faceBoxHideText )
|
||||
{
|
||||
QFont * _font = new QFont(ConfigInit().m_userNameFont);
|
||||
p.setFont ( *_font );
|
||||
// p.setPen(QColor(199,187,206));
|
||||
// p.drawText(ConfigInit().m_userNamePos_x+1,ConfigInit().m_userNamePos_y+2,m_userName);
|
||||
p.setPen ( QColor ( ConfigInit().m_userNameColor ) );
|
||||
p.drawText ( ConfigInit().m_userNamePos_x,ConfigInit().m_userNamePos_y,m_userName );
|
||||
delete _font;
|
||||
}
|
||||
p.end();
|
||||
|
||||
bitBlt ( this, r->x(), r->y(),m_pixmapbuff, 0, 0,
|
||||
r->width(), r->height() );
|
||||
|
||||
// delete [] pe;
|
||||
delete m_pixmapbuff;
|
||||
delete r;
|
||||
}
|
||||
|
||||
#include "kbfxspinxtop.moc"
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_TOP_H
|
||||
#define KBFX_SPINX_TOP_H
|
||||
|
||||
#include <qimage.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kiconloader.h>
|
||||
#include <klineedit.h>
|
||||
#include <kuser.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
class KbfxSpinxTop:public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxSpinxTop ( QWidget * parent = 0,const char * name = 0 );
|
||||
virtual ~KbfxSpinxTop();
|
||||
|
||||
virtual void paintEvent ( QPaintEvent * );
|
||||
virtual void mousePressEvent ( QMouseEvent * e ) ;
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
void textChanged ( QString );
|
||||
void sizeChange ( int );
|
||||
|
||||
private:
|
||||
void loadFaceIcon();
|
||||
void createDudeBox();
|
||||
QString getUserName();
|
||||
|
||||
QPixmap m_background;
|
||||
QPixmap * m_pixmapbuff;
|
||||
QPixmap m_faceIcon;
|
||||
QPixmap m_dudeBox;
|
||||
QString m_currentTextBuffer;
|
||||
QString m_userName;
|
||||
QPixmap m_iconPixmap;
|
||||
QTimer * m_fadeTimer;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "kbfxspinxview.h"
|
||||
|
||||
KbfxSpinxView::KbfxSpinxView ( QWidget * parent , const char * name,WFlags flag ) :QFrame ( parent,name,flag )
|
||||
{
|
||||
setMinimumWidth ( 300 );
|
||||
setMinimumHeight ( 365 );
|
||||
setMouseTracking ( true );
|
||||
}
|
||||
|
||||
KbfxSpinxView::~KbfxSpinxView()
|
||||
{}
|
||||
|
||||
#include "kbfxspinxview.moc"
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_SPINX_VIEW_H
|
||||
#define KBFX_SPINX_VIEW_H
|
||||
|
||||
#include <qframe.h>
|
||||
|
||||
class KbfxSpinxView:public QFrame
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KbfxSpinxView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
|
||||
~KbfxSpinxView();
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,306 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 "config.h"
|
||||
|
||||
#include "kbfxtooltip.h"
|
||||
|
||||
KbfxToolTip::KbfxToolTip ( QWidget * parent, const char *name, WFlags fl ) :
|
||||
QWidget ( parent, name,
|
||||
fl | WStyle_Customize | WRepaintNoErase | WStyle_NoBorder |
|
||||
WDestructiveClose | Qt::WPaintDesktop | Qt::WType_Popup | Qt::
|
||||
WPaintClever | Qt::WNoAutoErase | Qt::WResizeNoErase | Qt::
|
||||
WStaticContents | Qt::WNoAutoErase )
|
||||
{
|
||||
_animate = ConfigInit ().m_ToolTipAnimation;
|
||||
m_fontTooltipFont = ConfigInit ().m_fontTooltipFont;
|
||||
|
||||
logo = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit().m_SpinxTooltipLogo ) ) ?
|
||||
QImage ( ConfigInit().m_SpinxTooltipLogo )
|
||||
: QImage ( ConfigInit().m_SpinxTooltipLogoDefault );
|
||||
|
||||
tooltip_win = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_SpinxTooltipWindow ) ) ?
|
||||
QImage ( ConfigInit ().m_SpinxTooltipWindow )
|
||||
: QImage ( ConfigInit ().m_SpinxTooltipWindowDefault );
|
||||
|
||||
tooltip_mask = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit().m_SpinxTooltipMask ) ) ?
|
||||
QImage ( ConfigInit().m_SpinxTooltipMask )
|
||||
: QImage ( ConfigInit().m_SpinxTooltipMaskDefault );
|
||||
|
||||
dude_img = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_SpinxDudeImage ) ) ?
|
||||
QImage ( ConfigInit ().m_SpinxDudeImage )
|
||||
: QImage ( ConfigInit ().m_SpinxDudeImageDefault );
|
||||
|
||||
setUserImage ();
|
||||
setBoundBox ();
|
||||
setBackground ( QPixmap () );
|
||||
setWindow ( QPixmap () );
|
||||
KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_ToolTipAvatar ) ?
|
||||
setAnimationImage ( ConfigInit ().m_ToolTipAvatar )
|
||||
: setAnimationImage ( ConfigInit ().m_ToolTipAvatarDefault );
|
||||
|
||||
_hide_timer = new QTimer ( this );
|
||||
_update_timer = new QTimer ( this );
|
||||
_move_timer = new QTimer ( this );
|
||||
|
||||
connect ( _hide_timer, SIGNAL ( timeout () ), this, SLOT ( hide () ) );
|
||||
connect ( _hide_timer, SIGNAL ( timeout () ), _agent, SLOT ( hide () ) );
|
||||
connect ( _update_timer, SIGNAL ( timeout () ), this, SLOT ( logoMove () ) );
|
||||
|
||||
QCursor kbfxCursor;
|
||||
kbfxCursor.setShape ( Qt::PointingHandCursor );
|
||||
this->setCursor ( ( const QCursor ) kbfxCursor );
|
||||
}
|
||||
|
||||
KbfxToolTip::~KbfxToolTip ()
|
||||
{
|
||||
delete _hide_timer;
|
||||
delete _move_timer;
|
||||
delete _update_timer;
|
||||
delete _window;
|
||||
delete _agent;
|
||||
delete _agent_anim;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setWindow ( QPixmap win )
|
||||
{
|
||||
QImage m_win_img;
|
||||
|
||||
( win.isNull () ) ?
|
||||
m_win_img = tooltip_win
|
||||
: m_win_img = win.convertToImage ();
|
||||
|
||||
m_win_img = m_win_img.smoothScale ( _bg.width (), 13 );
|
||||
// _window = new QLabel (this, "", Qt::WStaticContents | Qt::WNoAutoErase);
|
||||
_window = new QLabel ( this, "" );
|
||||
_window->resize ( _bg.width (), 13 );
|
||||
_window->setBackgroundPixmap ( m_win_img );
|
||||
if ( _animate )
|
||||
_window->show ();
|
||||
else
|
||||
_window->hide ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setAnimationImage ( QString path )
|
||||
{
|
||||
/*
|
||||
_agent = new QLabel (this, "",
|
||||
Qt::WStaticContents |
|
||||
Qt::WNoAutoErase | Qt::WPaintDesktop);
|
||||
*/
|
||||
_agent = new QLabel ( this,"" );
|
||||
_agent->resize ( 100, 100 );
|
||||
|
||||
_agent_anim = new QMovie ( path );
|
||||
QPixmap agent_mask = _agent_anim->framePixmap ();
|
||||
_agent->setBackgroundPixmap ( agent_mask );
|
||||
if ( agent_mask.mask () )
|
||||
_agent->setMask ( *agent_mask.mask () );
|
||||
_agent->repaint ();
|
||||
|
||||
/*FIXME:Need to remove Hard Coded Values */
|
||||
_agent->move ( 200, 0 );
|
||||
|
||||
if ( _animate )
|
||||
_agent->show ();
|
||||
else
|
||||
_agent->close ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxToolTip::setBackground ( QPixmap bg )
|
||||
{
|
||||
|
||||
( bg.isNull () ) ?
|
||||
_bg = tooltip_mask
|
||||
: _bg = bg.convertToImage ();
|
||||
|
||||
/* animation check : Auto streatch */
|
||||
if ( _animate )
|
||||
{
|
||||
QImage m_tmp = _bg;
|
||||
_bg = m_tmp.smoothScale ( _bg.width () + 100, _bg.height () );
|
||||
}
|
||||
|
||||
this->setBackgroundPixmap ( _bg );
|
||||
|
||||
QPixmap m_tmp ( _bg );
|
||||
if ( m_tmp.mask () )
|
||||
this->setMask ( ( *m_tmp.mask () ) );
|
||||
this->resize ( _bg.width (), _bg.height () );
|
||||
_maxW = _bg.width ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setStartPos ( int _x_, int _y_ )
|
||||
{
|
||||
_x = _x_;
|
||||
_y = _y_;
|
||||
_logo_move_x = 100;
|
||||
if ( _animate )
|
||||
{
|
||||
_logo_move_x = 0;
|
||||
_hide_timer->start ( 10000, TRUE );
|
||||
_move_timer->start ( _agent_anim->speed (), FALSE );
|
||||
_update_timer->start ( 2, FALSE );
|
||||
}
|
||||
|
||||
move ( _x, _y );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::logoMove ()
|
||||
{
|
||||
QPainter p;
|
||||
|
||||
if ( _logo_move_x < _bg.width () - 68 )
|
||||
{
|
||||
_logo_move_x += 1;
|
||||
_window->repaint ();
|
||||
|
||||
p.begin ( _window );
|
||||
p.drawPixmap ( QRect ( _logo_move_x, 0, logo.width (), logo.height () ),
|
||||
QPixmap ( logo ) );
|
||||
p.end ();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.begin ( _window );
|
||||
p.drawPixmap ( QRect ( _bg.width () - 68, 0, logo.width (), logo.height () ),
|
||||
QPixmap ( logo ) );
|
||||
p.end ();
|
||||
}
|
||||
|
||||
QPixmap agent_mask = _agent_anim->framePixmap ();
|
||||
_agent->setBackgroundPixmap ( agent_mask );
|
||||
if ( agent_mask.mask () )
|
||||
_agent->setMask ( *agent_mask.mask () );
|
||||
_agent->repaint ();
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setAnimated ( bool b )
|
||||
{
|
||||
_animate = b;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxToolTip::setLabelText ( QString str )
|
||||
{
|
||||
_label_text = str;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setHeadingText ( QString str )
|
||||
{
|
||||
_heading_text = str;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setVersionText ( QString str )
|
||||
{
|
||||
_version_text = str;
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::hideToolTip ()
|
||||
{
|
||||
_move_timer->stop ();
|
||||
_hide_timer->stop ();
|
||||
|
||||
_agent->close ();
|
||||
this->hide ();
|
||||
this->close ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxToolTip::setUserImage ()
|
||||
{
|
||||
QImage userimage = dude_img;
|
||||
userimage = userimage.smoothScale ( 48, 48 );
|
||||
_dude = QPixmap ( userimage );
|
||||
}
|
||||
|
||||
void
|
||||
KbfxToolTip::setBoundBox ()
|
||||
{
|
||||
_dude_box = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_SpinxTooltipDudebox ) ) ?
|
||||
QPixmap ( ConfigInit ().m_SpinxTooltipDudebox )
|
||||
: QPixmap ( ConfigInit ().m_SpinxTooltipDudeboxDefault );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KbfxToolTip::paintEvent ( QPaintEvent * pe )
|
||||
{
|
||||
|
||||
const QRect r = pe->rect ();
|
||||
QFont *let = new QFont (m_fontTooltipFont);
|
||||
|
||||
QPainter p;
|
||||
p.begin ( this );
|
||||
p.setBackgroundMode ( Qt::TransparentMode );
|
||||
p.drawPixmap ( QRect ( 7, 16, _dude_box.width (), _dude_box.height () ),
|
||||
_dude_box );
|
||||
int _paddingX = ( ( _dude_box.height () - _dude.height () ) / 2 ) + 16;
|
||||
p.drawPixmap ( QRect
|
||||
( _paddingX - ( 55 - 48 ), _paddingX, _dude.width (),
|
||||
_dude.height () ), _dude );
|
||||
|
||||
if ( _animate )
|
||||
{}
|
||||
else
|
||||
{
|
||||
|
||||
p.drawPixmap ( QRect ( 126, 0, logo.width (), logo.height () ),
|
||||
QPixmap ( QImage (ConfigInit ().m_SpinxTooltipLogo ) ) );
|
||||
}
|
||||
|
||||
let->setBold ( TRUE );
|
||||
let->setPointSize ( 10 );
|
||||
p.setFont ( *let );
|
||||
p.setPen ( QColor ( 61, 94, 129 ) );
|
||||
p.drawText ( _dude_box.width () + 15, 30, "KBFX" );
|
||||
|
||||
p.setPen ( QColor ( 0, 0, 0 ) );
|
||||
let->setBold ( FALSE );
|
||||
let->setPointSize ( 8 );
|
||||
p.setFont ( *let );
|
||||
p.drawText ( ( _animate ) ? _dude_box.width () + 50 : _dude_box.width () + 4,
|
||||
_dude_box.height () + 30, QString ( "Version " ).append ( APPLICATION_VERSION ) );
|
||||
|
||||
p.setPen ( ConfigInit ().m_fontTooltipColor );
|
||||
let->setBold ( TRUE );
|
||||
let->setPointSize ( 8 );
|
||||
p.setFont ( *let );
|
||||
|
||||
|
||||
p.drawText ( _dude_box.width () + 15, 43, ConfigInit ().m_ToolTipText );
|
||||
p.end ();
|
||||
delete let;
|
||||
}
|
||||
|
||||
#include "kbfxtooltip.moc"
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2006
|
||||
* Siraj Razick <siraj@kdemail.net>
|
||||
* PhobosK <phobosk@mail.kbfx.org>
|
||||
* see Also AUTHORS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*
|
||||
* 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 Library 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 KBFX_TOOL_TIP
|
||||
#define KBFX_TOOL_TIP
|
||||
|
||||
#include <qcursor.h>
|
||||
#include <qimage.h>
|
||||
#include <qlabel.h>
|
||||
#include <qmovie.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qtimer.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kicontheme.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <ktip.h>
|
||||
#include <kuser.h>
|
||||
|
||||
#include <kbfxconfig.h>
|
||||
|
||||
#include <kbfxplasmapixmapprovider.h>
|
||||
|
||||
class KbfxToolTip:public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
KbfxToolTip ( QWidget * parent=0,const char * name=0,WFlags fl=WType_TopLevel );
|
||||
~KbfxToolTip();
|
||||
void setStartPos ( int x=0, int y=0 );
|
||||
virtual void paintEvent ( QPaintEvent *pe );
|
||||
void setBackground ( QPixmap bg );
|
||||
void setAnimationImage ( QString path );
|
||||
void setWindow ( QPixmap win );
|
||||
|
||||
public slots:
|
||||
void hideToolTip();
|
||||
void logoMove();
|
||||
void setUserImage();
|
||||
void setBoundBox();
|
||||
void setAnimated ( bool );
|
||||
void setLabelText ( QString );
|
||||
void setHeadingText ( QString );
|
||||
void setVersionText ( QString );
|
||||
|
||||
private:
|
||||
QTimer * _hide_timer;
|
||||
QTimer * _move_timer;
|
||||
QTimer * _update_timer;
|
||||
int _x,_y;
|
||||
int _maxW;
|
||||
int _width;
|
||||
int _height;
|
||||
int _logo_move_x;
|
||||
QPixmap _dude;
|
||||
QPixmap _dude_box;
|
||||
QImage _bg;
|
||||
QLabel * _window;
|
||||
QLabel * _agent;
|
||||
QMovie * _agent_anim;
|
||||
bool _animate;
|
||||
QString _label_text;
|
||||
QString _heading_text;
|
||||
QString _version_text;
|
||||
QFont m_fontTooltipFont;
|
||||
QImage logo;
|
||||
QImage tooltip_win;
|
||||
QImage tooltip_mask;
|
||||
QImage dude_img;
|
||||
};
|
||||
#endif
|
@ -0,0 +1,91 @@
|
||||
# Copyright 1999-2006 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header:
|
||||
|
||||
inherit eutils multilib
|
||||
|
||||
DESCRIPTION="Fast crawling Desktop-Searchengine with (optional) QT4 GUI"
|
||||
HOMEPAGE="http://www.vandenoever.info/software/strigi"
|
||||
SRC_URI="http://www.vandenoever.info/software/${PN}/${P}.tar.bz2"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~ppc ~x86"
|
||||
IUSE="xercesc clucene hyperestraier sqlite3 xml xattr qt4 log dbus inotify"
|
||||
|
||||
DEPEND="
|
||||
>=dev-util/cmake-2.4.2
|
||||
>=sys-libs/zlib-1.2.3
|
||||
>=app-arch/bzip2-1.0.3
|
||||
dev-libs/openssl
|
||||
virtual/libiconv
|
||||
dev-libs/expat
|
||||
xercesc? ( >=dev-libs/xerces-c )
|
||||
clucene? ( >=dev-cpp/clucene-0.9.16 )
|
||||
hyperestraier? ( app-text/hyperestraier )
|
||||
sqlite3? ( =dev-db/sqlite-3* )
|
||||
xml? ( dev-libs/libxml2 )
|
||||
xattr? ( sys-apps/attr )
|
||||
qt4? ( >=x11-libs/qt-4.2.1-r1 )
|
||||
log? ( >=dev-libs/log4cxx-0.9.7 )
|
||||
dbus? ( sys-apps/dbus )"
|
||||
# For most optional dependancies the use flags will be ignored,
|
||||
# useage will be determined by the pressence of the library instead.
|
||||
# This is a problem with the upstream build file.
|
||||
|
||||
pkg_setup() {
|
||||
|
||||
if !(use clucene) && !(use hyperestraier) && !(use sqlite3) ; then
|
||||
echo ""
|
||||
echo "ERROR:"
|
||||
eerror "You must enable one of the supported backends: "
|
||||
eerror "clucene, hyperestraier and sqlite3"
|
||||
eerror "If you are unsure, select cluencene"
|
||||
echo ""
|
||||
die
|
||||
fi
|
||||
|
||||
if use dbus && use qt4 && !(built_with_use ">=x11-libs/qt-4.2.0" dbus); then
|
||||
echo ""
|
||||
echo "ERROR:"
|
||||
eerror "You are building Stingi with qt4 and dbus, but qt4 wasn't built with dbus."
|
||||
eerror "Please reemerge qt4 with dbus, or disable dbus in Stingi."
|
||||
echo ""
|
||||
die
|
||||
fi
|
||||
|
||||
if use qt4 && !(use dbus); then
|
||||
echo ""
|
||||
echo "WARNING:"
|
||||
ewarn "You are building Stingi with qt4 but without dbus."
|
||||
ewarn "Strigiclient won't be able to detect a running Strigi daemon."
|
||||
ewarn "To avoid this, please enable both qt4 and dbus."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# inotify still in development and unstable
|
||||
if use inotify; then
|
||||
echo ""
|
||||
echo "WARNING:"
|
||||
ewarn "Inotify support in stingi is still unstable"
|
||||
ewarn "If you get problems, please rebuild stringi without inotify"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cmake \
|
||||
-DENABLE_INOTIFY:BOOL=$( use inotify && echo ON || echo OFF ) \
|
||||
-DENABLE_DBUS:BOOL=$( use dbus && echo ON || echo OFF ) \
|
||||
-DENABLE_LOG4CXX:BOOL=$( use log && echo ON || echo OFF ) \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
|
||||
-DLIB_DESTINATION:PATH=$(get_libdir) \
|
||||
. || die
|
||||
|
||||
emake || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake install DESTDIR=${D} || die
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
# Copyright 1999-2006 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header:
|
||||
|
||||
inherit eutils multilib
|
||||
|
||||
DESCRIPTION="Fast crawling Desktop-Searchengine with (optional) QT4 GUI"
|
||||
HOMEPAGE="http://www.vandenoever.info/software/strigi"
|
||||
SRC_URI="http://www.vandenoever.info/software/${PN}/${P}.tar.bz2"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~ppc ~x86"
|
||||
IUSE="xercesc clucene hyperestraier sqlite3 xml xattr qt4 log dbus inotify"
|
||||
|
||||
DEPEND="
|
||||
>=dev-util/cmake-2.4.2
|
||||
>=sys-libs/zlib-1.2.3
|
||||
>=app-arch/bzip2-1.0.3
|
||||
dev-libs/openssl
|
||||
virtual/libiconv
|
||||
dev-libs/expat
|
||||
xercesc? ( >=dev-libs/xerces-c )
|
||||
clucene? ( >=dev-cpp/clucene-0.9.16 )
|
||||
hyperestraier? ( app-text/hyperestraier )
|
||||
sqlite3? ( =dev-db/sqlite-3* )
|
||||
xml? ( dev-libs/libxml2 )
|
||||
xattr? ( sys-apps/attr )
|
||||
qt4? ( >=x11-libs/qt-4.2.1-r1 )
|
||||
log? ( >=dev-libs/log4cxx-0.9.7 )
|
||||
dbus? ( sys-apps/dbus )"
|
||||
# For most optional dependancies the use flags will be ignored,
|
||||
# useage will be determined by the pressence of the library instead.
|
||||
# This is a problem with the upstream build file.
|
||||
|
||||
pkg_setup() {
|
||||
|
||||
if !(use clucene) && !(use hyperestraier) && !(use sqlite3) ; then
|
||||
echo ""
|
||||
echo "ERROR:"
|
||||
eerror "You must enable one of the supported backends: "
|
||||
eerror "clucene, hyperestraier and sqlite3"
|
||||
eerror "If you are unsure, select cluencene"
|
||||
echo ""
|
||||
die
|
||||
fi
|
||||
|
||||
if use dbus && use qt4 && !(built_with_use ">=x11-libs/qt-4.2.0" dbus); then
|
||||
echo ""
|
||||
echo "ERROR:"
|
||||
eerror "You are building Stingi with qt4 and dbus, but qt4 wasn't built with dbus."
|
||||
eerror "Please reemerge qt4 with dbus, or disable dbus in Stingi."
|
||||
echo ""
|
||||
die
|
||||
fi
|
||||
|
||||
if use qt4 && !(use dbus); then
|
||||
echo ""
|
||||
echo "WARNING:"
|
||||
ewarn "You are building Stingi with qt4 but without dbus."
|
||||
ewarn "Strigiclient won't be able to detect a running Strigi daemon."
|
||||
ewarn "To avoid this, please enable both qt4 and dbus."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# inotify still in development and unstable
|
||||
if use inotify; then
|
||||
echo ""
|
||||
echo "WARNING:"
|
||||
ewarn "Inotify support in stingi is still unstable"
|
||||
ewarn "If you get problems, please rebuild stringi without inotify"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cmake \
|
||||
-DENABLE_INOTIFY:BOOL=$( use inotify && echo ON || echo OFF ) \
|
||||
-DENABLE_DBUS:BOOL=$( use dbus && echo ON || echo OFF ) \
|
||||
-DENABLE_LOG4CXX:BOOL=$( use log && echo ON || echo OFF ) \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
|
||||
-DLIB_DESTINATION:PATH=$(get_libdir) \
|
||||
. || die
|
||||
|
||||
emake || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake install DESTDIR=${D} || die
|
||||
}
|