Author: schubi2
Date: Mon Jul 16 11:31:11 2007
New Revision: 6014
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6014&view=rev
Log:
creating library
Added:
branches/tmp/schubi/dialogsolver/
branches/tmp/schubi/dialogsolver/COPYING
branches/tmp/schubi/dialogsolver/Makefile.am
branches/tmp/schubi/dialogsolver/Makefile.cvs
branches/tmp/schubi/dialogsolver/VERSION
branches/tmp/schubi/dialogsolver/config.rpath (with props)
branches/tmp/schubi/dialogsolver/configure.ac
branches/tmp/schubi/dialogsolver/libzypp-qdialogsolver.spec.in
branches/tmp/schubi/dialogsolver/mkinstalldirs (with props)
branches/tmp/schubi/dialogsolver/package/
branches/tmp/schubi/dialogsolver/package/libzypp-qdialogsolver.changes
branches/tmp/schubi/dialogsolver/src/
branches/tmp/schubi/dialogsolver/src/Makefile.am
branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.cpp
branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.h
branches/tmp/schubi/dialogsolver/src/drawparams.cpp
branches/tmp/schubi/dialogsolver/src/drawparams.h
branches/tmp/schubi/dialogsolver/src/graphtree_defines.h
branches/tmp/schubi/dialogsolver/src/graphtreelabel.cpp
branches/tmp/schubi/dialogsolver/src/graphtreelabel.h
branches/tmp/schubi/dialogsolver/src/pannerview.cpp
branches/tmp/schubi/dialogsolver/src/pannerview.h
branches/tmp/schubi/dialogsolver/src/resgraphview.cpp
branches/tmp/schubi/dialogsolver/src/resgraphview.h
branches/tmp/schubi/dialogsolver/src/restreewidget.cpp
branches/tmp/schubi/dialogsolver/src/restreewidget.h
branches/tmp/schubi/dialogsolver/src/solvertree.cpp
branches/tmp/schubi/dialogsolver/src/solvertree.h
Added: branches/tmp/schubi/dialogsolver/COPYING
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/COPYING?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/COPYING (added)
+++ branches/tmp/schubi/dialogsolver/COPYING Mon Jul 16 11:31:11 2007
@@ -0,0 +1,21 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+Copyright (C) 2000-2002 Ximian, Inc.
+Copyright (C) 2005 SUSE Linux Products GmbH
+
+ZYpp is licensed under the GNU General Public License version 2
+or later. The text of the GNU General Public License can be viewed at
+http://www.gnu.org/licenses/gpl.html
+
+As a special exception, you have permission to link this program
+with the following libraries and distribute executables, as long as you
+follow the requirements of the GNU GPL in regard to all of the
+software in the executable aside from the following libraries:
+- OpenSSL (http://www.openssl.org)
\ No newline at end of file
Added: branches/tmp/schubi/dialogsolver/Makefile.am
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/Makefile.am?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/Makefile.am (added)
+++ branches/tmp/schubi/dialogsolver/Makefile.am Mon Jul 16 11:31:11 2007
@@ -0,0 +1,34 @@
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS = src
+
+## ##################################################
+
+#ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS =
+
+EXTRA_DIST = mkinstalldirs
+#config.rpath
+
+## ##################################################
+
+.PHONY: package package-local check-up-to-date
+
+package: check-up-to-date package-local
+
+package-local: dist-bzip2 libzypp-qdialogsolver.spec
+ @if [ `bunzip2 -c $(distdir).tar.bz2 | wc --bytes` = 0 ] ; then \
+ echo "Error: $(distdir).tar.bz2 is empty" ; \
+ exit 1 ; \
+ fi
+ rm -f package/*.tar.bz2
+ rm -f package/*~
+ rm -f package/*.bak
+ rm -f package/*.auto
+ mv $(distdir).tar.bz2 package/
+ mv libzypp-qdialogsolver.spec package/
+
+check-up-to-date:
+ cd $(srcdir) && ! LC_ALL=C svn status --show-updates --quiet \
+ | grep -v '^Status against revision'
Added: branches/tmp/schubi/dialogsolver/Makefile.cvs
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/Makefile.cvs?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/Makefile.cvs (added)
+++ branches/tmp/schubi/dialogsolver/Makefile.cvs Mon Jul 16 11:31:11 2007
@@ -0,0 +1,31 @@
+## ##################################################
+## Makefile.cvs
+## ##################################################
+
+.PHONY: default init configure reconf
+
+# Try to detect if this is a lib or lib64 system
+LIB = $(shell gcc -v 2>&1 \
+ | awk ' BEGIN{ lib="lib" } \
+ match( $$0, "--libdir=/usr/([^ ]*)" ) { \
+ lib=substr($$0,RSTART,RLENGTH); \
+ sub("--libdir=/usr/","",lib) \
+ } \
+ END{print lib} ' )
+
+PREFIX = /usr
+CONFIGURE_OPTS=
+default: configure
+
+configure: init
+ ./configure --prefix=$(PREFIX) --libdir=$(PREFIX)/$(LIB) \
+ --disable-static \
+ $(CONFIGURE_OPTS)
+
+init:
+ rm -rf autom4te.cache
+ autoreconf --force --install --symlink --verbose
+
+reconf: init
+ ./config.status --recheck
+ ./config.status
Added: branches/tmp/schubi/dialogsolver/VERSION
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/VERSION?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/VERSION (added)
+++ branches/tmp/schubi/dialogsolver/VERSION Mon Jul 16 11:31:11 2007
@@ -0,0 +1 @@
+m4_define([BACKEND_VERSION], [7.1.1.0_0.8])
Added: branches/tmp/schubi/dialogsolver/config.rpath
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/config.rpath?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/config.rpath (added)
+++ branches/tmp/schubi/dialogsolver/config.rpath Mon Jul 16 11:31:11 2007
@@ -0,0 +1,614 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2006 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit , 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ darwin*)
+ case $cc_basename in
+ xlc*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ mingw* | pw32* | os2*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ wl='-Wl,'
+ ;;
+ pgcc | pgf77 | pgf90)
+ wl='-Wl,'
+ ;;
+ ccc*)
+ wl='-Wl,'
+ ;;
+ como)
+ wl='-lopt='
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ unicos*)
+ wl='-Wl,'
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ case "$host_os" in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we cannot use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ interix3*)
+ hardcode_direct=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = no; then
+ hardcode_libdir_flag_spec=
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ else
+ aix_use_runtimelinking=no
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ hardcode_direct=no
+ if test "$GCC" = yes ; then
+ :
+ else
+ case $cc_basename in
+ xlc*)
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+ hpux11*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ ;;
+ *)
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ ;;
+ aix4* | aix5*)
+ ;;
+ amigaos*)
+ ;;
+ beos*)
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ shrext=.dll
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ ;;
+ dgux*)
+ ;;
+ freebsd1*)
+ ;;
+ kfreebsd*-gnu)
+ ;;
+ freebsd* | dragonfly*)
+ ;;
+ gnu*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $host_cpu in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ ;;
+ interix3*)
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux*)
+ ;;
+ knetbsd*-gnu)
+ ;;
+ netbsd*)
+ ;;
+ newsos6)
+ ;;
+ nto-qnx*)
+ ;;
+ openbsd*)
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ ;;
+ osf3* | osf4* | osf5*)
+ ;;
+ solaris*)
+ ;;
+ sunos4*)
+ ;;
+ sysv4 | sysv4.3*)
+ ;;
+ sysv4*MP*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ ;;
+ uts4*)
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/configure.ac?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/configure.ac (added)
+++ branches/tmp/schubi/dialogsolver/configure.ac Mon Jul 16 11:31:11 2007
@@ -0,0 +1,164 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl ==================================================
+m4_include([VERSION])
+AC_INIT(qdialogsolver,[QDIALOGSOLVER_VERSION])
+AC_CONFIG_SRCDIR(src/Makefile.am)
+
+AC_PREFIX_DEFAULT(/usr)
+AC_CANONICAL_TARGET
+AC_ARG_PROGRAM
+
+AM_INIT_AUTOMAKE(foreign dist-bzip2 no-dist-gzip tar-ustar)
+AM_CONFIG_HEADER(config.h)
+
+dnl ==================================================
+dnl Versioning
+dnl ==========
+dnl
+dnl CURRENT The most recent interface number that this library implements.
+dnl
+dnl REVISION The implementation number of the current interface.
+dnl
+dnl AGE The difference between the newest and oldest interfaces that this
+dnl library implements.
+dnl In other words, the library implements all the interface numbers
+dnl in the range from number 'CURRENT - AGE' to 'CURRENT'.
+dnl
+dnl 1) Start with version information of `0:0:0' for each libtool library.
+dnl
+dnl 2) Update the version information only immediately before a public release
+dnl of your software. More frequent updates are unnecessary, and only guarantee
+dnl that the current interface number gets larger faster.
+dnl
+dnl 3) If the library source code has changed at all since the last update,
+dnl then increment revision (`c:r:a' becomes `c:r+1:a').
+dnl
+dnl 4) If any interfaces have been added, removed, or changed since the last
+dnl update, increment current, and set revision to 0.
+dnl
+dnl 5) If any interfaces have been added since the last public release, then
+dnl increment age.
+dnl
+dnl 6) If any interfaces have been removed since the last public release, then
+dnl set age to 0.
+dnl
+dnl QDIALOGSOLVER_CURRENT=0
+dnl QDIALOGSOLVER_REVISION=0
+dnl QDIALOGSOLVER_AGE=0
+dnl QDIALOGSOLVER_VERSION_INFO="-version-info $QDIALOGSOLVER_CURRENT:$QDIALOGSOLVER_REVISION:$QDIALOGSOLVER_AGE"
+
+QDIALOGSOLVER_VERSION_INFO="-version-info 0:0:0"
+AC_SUBST(QDIALOGSOLVER_VERSION_INFO)
+
+dnl ==================================================
+
+CXXFLAGS="${CXXFLAGS} -g -O2 -Wall -Wformat"
+AC_SYS_LARGEFILE
+
+dnl ==================================================
+
+docdir=\${datadir}/doc/packages
+pkgdocdir=\${docdir}/$PACKAGE
+
+AC_SUBST(docdir)
+AC_SUBST(pkgdocdir)
+
+zyppdir=${prefix}/share/$PACKAGE
+localedir=${prefix}/share/locale
+
+AC_SUBST(localedir)
+
+AH_TEMPLATE([LOCALEDIR],[gettext localedir])
+AC_DEFINE_UNQUOTED([LOCALEDIR], ["${localedir}"])
+AH_TEMPLATE([TEXTDOMAIN],[gettext textdomain])
+AC_DEFINE_UNQUOTED([TEXTDOMAIN], ["$PACKAGE"])
+
+dnl ==================================================
+dnl checks for programs
+
+dnl check for c++ compiler and tools
+AC_PROG_CXX
+AC_PROG_CXX
+AC_PROG_CXXCPP
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+
+dnl do AC_CHECK_* tests using c++ (e.g. boost header)
+AC_LANG([C++])
+
+AC_PATH_PROG(XGETTEXT, xgettext)
+if test -z "$XGETTEXT" ; then
+ AC_MSG_ERROR(xgettext is missing; please install gettext-devel.)
+fi
+
+AC_PATH_PROG(MYRUNTEST, runtest)
+if test -z "$MYRUNTEST" ; then
+ AC_MSG_ERROR(runtest is missing; please install dejagnu.)
+fi
+
+dnl ==================================================
+dnl checks for header files
+AC_CHECK_HEADERS([boost/scoped_ptr.hpp],
+ [],
+ AC_MSG_ERROR([boost header not found. please install boost-devel]))
+
+dnl ==================================================
+dnl checks for libraries
+dnl libzypp
+PKG_CHECK_MODULES(ZYPP, libzypp, pkg_libzypp=yes, pkg_libzypp=no)
+if test $pkg_libzypp = no; then
+ echo
+ AC_MSG_ERROR([Could not find libzypp library, please install libzypp-devel])
+fi
+
+AC_MSG_CHECKING(for zypp large file support)
+ZYPP_FEATURES=`$PKG_CONFIG --variable=features libzypp 2>/dev/null`
+ZYPP_LFS=no
+for feature in $ZYPP_FEATURES ; do
+ case $feature in
+ LFS) ZYPP_LFS=yes ;;
+ esac
+done
+enable_largefile=$ZYPP_LFS
+AC_MSG_RESULT($enable_largefile)
+
+test -n "$ZYPP_CFLAGS" && CXXFLAGS="$CXXFLAGS $ZYPP_CFLAGS"
+
+
+dnl ==================================================
+dnl internationalization macros
+AM_GNU_GETTEXT
+
+dnl ==================================================
+dnl checks for typedefs
+dnl ==================================================
+dnl checks for structures
+dnl ==================================================
+dnl checks for compiler characteristics
+dnl ==================================================
+dnl checks for library functions
+dnl ==================================================
+dnl checks for system services
+dnl ==================================================
+dnl AC_CONFIG_FILES([FILE...])
+AC_OUTPUT(Makefile \
+ libzypp-qdialogsovler.spec \
+ src/Makefile
+)
+dnl ==================================================
+
+echo "
+Configuration:
+
+ PACKAGE: ${PACKAGE}
+ VERSION: ${VERSION}
+
+ COMPILER: ${CXX}
+ CXXFLAGS: ${CXXFLAGS}
+
+ PREFIX: ${prefix}
+ LIBDIR: ${libdir}
+
+"
+echo
+
Added: branches/tmp/schubi/dialogsolver/libzypp-qdialogsolver.spec.in
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/libzypp-qdialogsolver.spec.in?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/libzypp-qdialogsolver.spec.in (added)
+++ branches/tmp/schubi/dialogsolver/libzypp-qdialogsolver.spec.in Mon Jul 16 11:31:11 2007
@@ -0,0 +1,87 @@
+#
+# spec file for package libzypp-zmd-backend (Version 7.1.1.0)
+#
+# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# This file and all modifications and additions to the pristine
+# package are under the same license as the package itself.
+#
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+# norootforbuild
+
+Name: libzypp-zmd-backend
+Version: @VERSION@
+Release: 0
+License: GPL
+Group: System/Management
+Summary: ZMD backend for Package, Patch, Pattern, and Product Management
+Requires: libzypp >= %( echo `rpm -q --queryformat '%{VERSION}-%{RELEASE}' libzypp`)
+Provides: zmd-backend
+Provides: zmd-librc-backend
+Obsoletes: zmd-librc-backend
+Autoreqprov: on
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildRequires: dejagnu gcc-c++
+
+%if %suse_version > 1010
+BuildRequires: sqlite-zmd sqlite-zmd-devel
+%else
+BuildRequires: sqlite sqlite-devel
+%endif
+
+# API Changes in zypp 2.1
+BuildRequires: libzypp-devel >= 2.8.7
+BuildRequires: libzypp >= 2.8.7
+Requires: libzypp >= 2.8.7
+
+Source: zmd-backend-%{version}.tar.bz2
+Prefix: /usr
+
+%description
+This package provides binaries which enable the ZENworks daemon (ZMD)
+to perform its management tasks on the system.
+
+
+
+Authors:
+--------
+ Klaus Kaempf
+
+%prep
+%setup -q -n zmd-backend-%{version}
+
+%build
+sed -i '/devel\//d' configure.ac
+cp /usr/share/gettext/config.rpath .
+autoreconf --force --install --symlink --verbose
+
+%{?suse_update_config:%{suse_update_config -f}}
+CXXFLAGS="$RPM_OPT_FLAGS" \
+./configure --prefix=%{prefix} --libdir=%{_libdir} --mandir=%{_mandir} --disable-static
+make %{?jobs:-j %jobs}
+#make check
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
+install -m 644 logrotate_zmd_backend $RPM_BUILD_ROOT/etc/logrotate.d/zmd-backend
+
+# bug 256399 - zmd stops working after update
+# we install a fake query system as the solution
+install -m 755 src/query-system.sh $RPM_BUILD_ROOT/%{_libdir}/zmd/query-system
+
+# Create filelist with translatins
+#%{find_lang} zypp
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%{_libdir}/libzmd-backend.*
+%dir %{_libdir}/zmd
+%{_libdir}/zmd/*
+%dir %{prefix}/include/zmd-backend
+%{prefix}/include/zmd-backend/*
+/etc/logrotate.d/zmd-backend
Added: branches/tmp/schubi/dialogsolver/mkinstalldirs
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/mkinstalldirs?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/mkinstalldirs (added)
+++ branches/tmp/schubi/dialogsolver/mkinstalldirs Mon Jul 16 11:31:11 2007
@@ -0,0 +1,158 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2005-06-29.22
+
+# Original author: Noah Friedman
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to or send patches to
+# .
+
+errstatus=0
+dirmode=
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to ."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage"
+ exit $?
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --version)
+ echo "$0 $scriptversion"
+ exit $?
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error. This is a problem when calling mkinstalldirs
+# from a parallel make. We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+ '')
+ if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ test -d ./-p && rmdir ./-p
+ test -d ./--version && rmdir ./--version
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+ test ! -d ./--version; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ else
+ # Clean up after NextStep and OpenStep mkdir.
+ for d in ./-m ./-p ./--version "./$dirmode";
+ do
+ test -d $d && rmdir $d
+ done
+ fi
+ ;;
+esac
+
+for file
+do
+ case $file in
+ /*) pathcomp=/ ;;
+ *) pathcomp= ;;
+ esac
+ oIFS=$IFS
+ IFS=/
+ set fnord $file
+ shift
+ IFS=$oIFS
+
+ for d
+ do
+ test "x$d" = x && continue
+
+ pathcomp=$pathcomp$d
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp=$pathcomp/
+ done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
Added: branches/tmp/schubi/dialogsolver/package/libzypp-qdialogsolver.changes
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/package/libzypp-qdialogsolver.changes?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/package/libzypp-qdialogsolver.changes (added)
+++ branches/tmp/schubi/dialogsolver/package/libzypp-qdialogsolver.changes Mon Jul 16 11:31:11 2007
@@ -0,0 +1 @@
+
Added: branches/tmp/schubi/dialogsolver/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/Makefile.am?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/Makefile.am (added)
+++ branches/tmp/schubi/dialogsolver/src/Makefile.am Mon Jul 16 11:31:11 2007
@@ -0,0 +1,61 @@
+#
+# Makefile.am for qdialogsolver
+#
+SUBDIRS =
+
+AM_CXXFLAGS = -DY2LOG=\"ui-qt\" \
+ -DQT_THREAD_SUPPORT \
+ -DLOCALEDIR=\"${localedir}\" \
+ -DQT_LOCALEDIR=\"$(QTDIR)/translations\" \
+ -DICONDIR=\"${themedir}/current\" \
+ -DTHEMEDIR=\"${themedir}/current\" \
+ -DHELPIMAGEDIR=\"${imagedir}\" \
+ -DQTLIBDIR=\"$(QTLIBDIR)\" \
+ -fmessage-length=0
+
+
+MOC = $(QTDIR)/bin/moc
+
+
+# plugin, libtool forces 'lib' prefix
+plugin_LTLIBRARIES = libqdialogsolver.la
+libqdialogsolver_la_LDFLAGS = -version-info 1:0
+
+libqdialogsolver_la_LIBADD = \
+ -L$(libdir) \
+ -L$(QTLIBDIR) -lqt-mt \
+ -lX11 -lXext -lSM -lICE
+
+
+libqdialogsolver_la_SOURCES = \
+ drawparams.cpp \
+ pannerview.cpp \
+ resgraphview.cpp \
+ solvertree.cpp \
+ graphtreelabel.cpp \
+ QZyppSolverDialog.cpp \
+ restreewidget.cpp
+
+
+BUILT_SOURCES = \
+ pannerview.moc \
+ QZyppSolverDialog.moc \
+ resgraphview.moc \
+ restreewidget.moc
+
+pannerview.o pannerview.lo: pannerview.moc
+QZyppSolverDialog.o QZyppSolverDialog.lo: QZyppSolverDialog.moc
+resgraphview.o resgraphview.lo: resgraphview.moc
+restreewidget.o restreewidget.lo: restreewidget.moc
+
+pannerview.moc: pannerview.h
+QZyppSolverDialog.moc: QZyppSolverDialog.h
+resgraphview.moc: resgraphview.h
+restreewidget.moc: restreewidget.h
+
+%.moc: %.h
+ $(MOC) $< -o $@
+
+CLEANFILES = *.moc
+
+INCLUDES = -I$(QTDIR)/include
Added: branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,25 @@
+#include
+#include
+#include
+#include
+#include
+
+#include "QZyppSolverDialog.h"
+#include "solvertree.h"
+
+
+QZyppSolverDialog::QZyppSolverDialog(zypp::solver::detail::Resolver_Ptr r)
+ : QDialog(0,"Solvertree",true)
+ , resolver (r)
+{
+ QHBoxLayout* layout = new QHBoxLayout (this);
+ SolverTree *solvertree = new SolverTree(this, resolver);
+ layout->addWidget( solvertree->getView());
+}
+
+
+QZyppSolverDialog::~QZyppSolverDialog()
+{
+}
+
+#include "QZyppSolverDialog.moc"
Added: branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.h (added)
+++ branches/tmp/schubi/dialogsolver/src/QZyppSolverDialog.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,21 @@
+#ifndef QZYPPSOLVERDIALOG_H
+#define QZYPPSOLVERDIALOG_H
+
+#include
+#include "zypp/solver/detail/Resolver.h"
+
+
+class QZyppSolverDialog : public QDialog{
+ Q_OBJECT
+
+protected:
+ zypp::solver::detail::Resolver_Ptr resolver;
+
+public:
+ QZyppSolverDialog(zypp::solver::detail::Resolver_Ptr r = NULL);
+ ~QZyppSolverDialog();
+
+
+};
+
+#endif
Added: branches/tmp/schubi/dialogsolver/src/drawparams.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/drawparams.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/drawparams.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/drawparams.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,703 @@
+/* This file is part of KCachegrind.
+ Copyright (C) 2002, 2003 Josef Weidendorfer
+ Adapted for the needs of kdesvn by Rajko Albrecht
+
+ KCachegrind 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, version 2.
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/*
+ * A Widget for visualizing hierarchical metrics as areas.
+ * The API is similar to QListView.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "drawparams.h"
+
+
+// set this to 1 to enable debug output
+#define DEBUG_DRAWING 0
+#define MAX_FIELD 12
+
+
+//
+// StoredDrawParams
+//
+StoredDrawParams::StoredDrawParams()
+{
+ _selected = false;
+ _current = false;
+ _shaded = true;
+ _rotated = false;
+
+ _backColor = Qt::white;
+
+ // field array has size 0
+}
+
+StoredDrawParams::StoredDrawParams(QColor c,
+ bool selected, bool current)
+{
+ _backColor = c;
+
+ _selected = selected;
+ _current = current;
+ _shaded = true;
+ _rotated = false;
+ _drawFrame = true;
+
+ // field array has size 0
+}
+
+QString StoredDrawParams::text(int f) const
+{
+ if ((f<0) || (f >= (int)_field.size()))
+ return QString::null;
+
+ return _field[f].text;
+}
+
+QPixmap StoredDrawParams::pixmap(int f) const
+{
+ if ((f<0) || (f >= (int)_field.size()))
+ return QPixmap();
+
+ return _field[f].pix;
+}
+
+DrawParams::Position StoredDrawParams::position(int f) const
+{
+ if ((f<0) || (f >= (int)_field.size()))
+ return Default;
+
+ return _field[f].pos;
+}
+
+int StoredDrawParams::maxLines(int f) const
+{
+ if ((f<0) || (f >= (int)_field.size()))
+ return 0;
+
+ return _field[f].maxLines;
+}
+
+const QFont& StoredDrawParams::font() const
+{
+ static QFont* f = 0;
+ if (!f) f = new QFont(QApplication::font());
+
+ return *f;
+}
+
+void StoredDrawParams::ensureField(int f)
+{
+ static Field* def = 0;
+ if (!def) {
+ def = new Field();
+ def->pos = Default;
+ def->maxLines = 0;
+ }
+
+ if (f<0 || f>=MAX_FIELD) return;
+
+ if ((int)_field.size() < f+1) _field.resize(f+1, *def);
+}
+
+
+void StoredDrawParams::setField(int f, QString t, QPixmap pm,
+ Position p, int maxLines)
+{
+ if (f<0 || f>=MAX_FIELD) return;
+ ensureField(f);
+
+ _field[f].text = t;
+ _field[f].pix = pm;
+ _field[f].pos = p;
+ _field[f].maxLines = maxLines;
+}
+
+void StoredDrawParams::setText(int f, QString t)
+{
+ if (f<0 || f>=MAX_FIELD) return;
+ ensureField(f);
+
+ _field[f].text = t;
+}
+
+void StoredDrawParams::setPixmap(int f, QPixmap pm)
+{
+ if (f<0 || f>=MAX_FIELD) return;
+ ensureField(f);
+
+ _field[f].pix = pm;
+}
+
+void StoredDrawParams::setPosition(int f, Position p)
+{
+ if (f<0 || f>=MAX_FIELD) return;
+ ensureField(f);
+
+ _field[f].pos = p;
+}
+
+void StoredDrawParams::setMaxLines(int f, int m)
+{
+ if (f<0 || f>=MAX_FIELD) return;
+ ensureField(f);
+
+ _field[f].maxLines = m;
+}
+
+
+
+//
+// RectDrawing
+//
+
+RectDrawing::RectDrawing(QRect r)
+{
+ _fm = 0;
+ _dp = 0;
+ setRect(r);
+}
+
+
+RectDrawing::~RectDrawing()
+{
+ delete _fm;
+ delete _dp;
+}
+
+DrawParams* RectDrawing::drawParams()
+{
+ if (!_dp)
+ _dp = new StoredDrawParams();
+
+ return _dp;
+}
+
+
+void RectDrawing::setDrawParams(DrawParams* dp)
+{
+ if (_dp) delete _dp;
+ _dp = dp;
+}
+
+void RectDrawing::setRect(QRect r)
+{
+ _rect = r;
+
+ _usedTopLeft = 0;
+ _usedTopCenter = 0;
+ _usedTopRight = 0;
+ _usedBottomLeft = 0;
+ _usedBottomCenter = 0;
+ _usedBottomRight = 0;
+
+ _fontHeight = 0;
+}
+
+QRect RectDrawing::remainingRect(DrawParams* dp)
+{
+ if (!dp) dp = drawParams();
+
+ if ((_usedTopLeft >0) ||
+ (_usedTopCenter >0) ||
+ (_usedTopRight >0)) {
+ if (dp->rotated())
+ _rect.setLeft(_rect.left() + _fontHeight);
+ else
+ _rect.setTop(_rect.top() + _fontHeight);
+ }
+
+ if ((_usedBottomLeft >0) ||
+ (_usedBottomCenter >0) ||
+ (_usedBottomRight >0)) {
+ if (dp->rotated())
+ _rect.setRight(_rect.right() - _fontHeight);
+ else
+ _rect.setBottom(_rect.bottom() - _fontHeight);
+ }
+ return _rect;
+}
+
+
+void RectDrawing::drawBack(QPainter* p, DrawParams* dp)
+{
+ if (!dp) dp = drawParams();
+ if (_rect.width()<=0 || _rect.height()<=0) return;
+
+ QRect r = _rect;
+ QColor normal = dp->backColor();
+ if (dp->selected()) normal = normal.light();
+ bool isCurrent = dp->current();
+
+ if (dp->drawFrame() || isCurrent) {
+ // 3D raised/sunken frame effect...
+ QColor high = normal.light();
+ QColor low = normal.dark();
+ p->setPen( isCurrent ? low:high);
+ p->drawLine(r.left(), r.top(), r.right(), r.top());
+ p->drawLine(r.left(), r.top(), r.left(), r.bottom());
+ p->setPen( isCurrent ? high:low);
+ p->drawLine(r.right(), r.top(), r.right(), r.bottom());
+ p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+ r.setRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2);
+ }
+ if (r.width()<=0 || r.height()<=0) return;
+
+ if (dp->shaded()) {
+ // some shading
+ bool goDark = qGray(normal.rgb())>128;
+ int rBase, gBase, bBase;
+ normal.rgb(&rBase, &gBase, &bBase);
+ p->setBrush(QBrush::NoBrush);
+
+ // shade parameters:
+ int d = 7;
+ float factor = 0.1, forth=0.7, back1 =0.9, toBack2 = .7, back2 = 0.97;
+
+ // coefficient corrections because of rectangle size
+ int s = r.width();
+ if (s > r.height()) s = r.height();
+ if (s<100) {
+ forth -= .3 * (100-s)/100;
+ back1 -= .2 * (100-s)/100;
+ back2 -= .02 * (100-s)/100;
+ }
+
+
+ // maximal color difference
+ int rDiff = goDark ? -rBase/d : (255-rBase)/d;
+ int gDiff = goDark ? -gBase/d : (255-gBase)/d;
+ int bDiff = goDark ? -bBase/d : (255-bBase)/d;
+
+ QColor shadeColor;
+ while (factor<.95) {
+ shadeColor.setRgb((int)(rBase+factor*rDiff+.5),
+ (int)(gBase+factor*gDiff+.5),
+ (int)(bBase+factor*bDiff+.5));
+ p->setPen(shadeColor);
+ p->drawRect(r);
+ r.setRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2);
+ if (r.width()<=0 || r.height()<=0) return;
+ factor = 1.0 - ((1.0 - factor) * forth);
+ }
+
+ // and back (1st half)
+ while (factor>toBack2) {
+ shadeColor.setRgb((int)(rBase+factor*rDiff+.5),
+ (int)(gBase+factor*gDiff+.5),
+ (int)(bBase+factor*bDiff+.5));
+ p->setPen(shadeColor);
+ p->drawRect(r);
+ r.setRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2);
+ if (r.width()<=0 || r.height()<=0) return;
+ factor = 1.0 - ((1.0 - factor) / back1);
+ }
+
+ // and back (2nd half)
+ while ( factor>.01) {
+ shadeColor.setRgb((int)(rBase+factor*rDiff+.5),
+ (int)(gBase+factor*gDiff+.5),
+ (int)(bBase+factor*bDiff+.5));
+ p->setPen(shadeColor);
+ p->drawRect(r);
+ r.setRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2);
+ if (r.width()<=0 || r.height()<=0) return;
+
+ factor = factor * back2;
+ }
+ }
+
+ // fill inside
+ p->setPen(QPen::NoPen);
+ p->setBrush(normal);
+ p->drawRect(r);
+}
+
+
+bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp)
+{
+ if (!dp) dp = drawParams();
+
+ if (!_fm) {
+ _fm = new QFontMetrics(dp->font());
+ _fontHeight = _fm->height();
+ }
+
+ QRect r = _rect;
+
+// if (0) Debug(90100) << "DrawField: Rect " << r.x() << "/" << r.y()
+// << " - " << r.width() << "x" << r.height() << endl;
+
+ int h = _fontHeight;
+ bool rotate = dp->rotated();
+ int width = (rotate ? r.height() : r.width()) -4;
+ int height = (rotate ? r.width() : r.height());
+ int lines = height / h;
+
+ // stop if we have no space available
+ if (lines<1) return false;
+
+ // calculate free space in first line (<unused>)
+ int pos = dp->position(f);
+ if (pos == DrawParams::Default) {
+ switch(f%4) {
+ case 0: pos = DrawParams::TopLeft; break;
+ case 1: pos = DrawParams::TopRight; break;
+ case 2: pos = DrawParams::BottomRight; break;
+ case 3: pos = DrawParams::BottomLeft; break;
+ }
+ }
+
+ int unused = 0;
+ bool isBottom = false;
+ bool isCenter = false;
+ bool isRight = false;
+ int* used = 0;
+ switch(pos) {
+ case DrawParams::TopLeft:
+ used = &_usedTopLeft;
+ if (_usedTopLeft == 0) {
+ if (_usedTopCenter)
+ unused = (width - _usedTopCenter)/2;
+ else
+ unused = width - _usedTopRight;
+ }
+ break;
+
+ case DrawParams::TopCenter:
+ isCenter = true;
+ used = &_usedTopCenter;
+ if (_usedTopCenter == 0) {
+ if (_usedTopLeft > _usedTopRight)
+ unused = width - 2 * _usedTopLeft;
+ else
+ unused = width - 2 * _usedTopRight;
+ }
+ break;
+
+ case DrawParams::TopRight:
+ isRight = true;
+ used = &_usedTopRight;
+ if (_usedTopRight == 0) {
+ if (_usedTopCenter)
+ unused = (width - _usedTopCenter)/2;
+ else
+ unused = width - _usedTopLeft;
+ }
+ break;
+
+ case DrawParams::BottomLeft:
+ isBottom = true;
+ used = &_usedBottomLeft;
+ if (_usedBottomLeft == 0) {
+ if (_usedBottomCenter)
+ unused = (width - _usedBottomCenter)/2;
+ else
+ unused = width - _usedBottomRight;
+ }
+ break;
+
+ case DrawParams::BottomCenter:
+ isCenter = true;
+ isBottom = true;
+ used = &_usedBottomCenter;
+ if (_usedBottomCenter == 0) {
+ if (_usedBottomLeft > _usedBottomRight)
+ unused = width - 2 * _usedBottomLeft;
+ else
+ unused = width - 2 * _usedBottomRight;
+ }
+ break;
+
+ case DrawParams::BottomRight:
+ isRight = true;
+ isBottom = true;
+ used = &_usedBottomRight;
+ if (_usedBottomRight == 0) {
+ if (_usedBottomCenter)
+ unused = (width - _usedBottomCenter)/2;
+ else
+ unused = width - _usedBottomLeft;
+ }
+ break;
+ }
+
+ if (isBottom) {
+ if ((_usedTopLeft >0) ||
+ (_usedTopCenter >0) ||
+ (_usedTopRight >0))
+ lines--;
+ }
+ else if (!isBottom) {
+ if ((_usedBottomLeft >0) ||
+ (_usedBottomCenter >0) ||
+ (_usedBottomRight >0))
+ lines--;
+ }
+ if (lines<1) return false;
+
+
+ int y = isBottom ? height - h : 0;
+
+ if (unused < 0) unused = 0;
+ if (unused == 0) {
+ // no space available in last line at this position
+ y = isBottom ? (y-h) : (y+h);
+ lines--;
+
+ if (lines<1) return false;
+
+ // new line: reset used space
+ if (isBottom)
+ _usedBottomLeft = _usedBottomCenter = _usedBottomRight = 0;
+ else
+ _usedTopLeft = _usedTopCenter = _usedTopRight = 0;
+
+ unused = width;
+ }
+
+ // stop as soon as possible when there's no space for "..."
+ static int dotW = 0;
+ if (!dotW) dotW = _fm->width("...");
+ if (width < dotW) return false;
+
+ // get text and pixmap now, only if we need to, because it is possible
+ // that they are calculated on demand (and this can take some time)
+ QString name = dp->text(f);
+ if (name.isEmpty()) return 0;
+ QPixmap pix = dp->pixmap(f);
+
+ // check if pixmap can be drawn
+ int pixW = pix.width();
+ int pixH = pix.height();
+ int pixY = 0;
+ bool pixDrawn = true;
+ if (pixW>0) {
+ pixW += 2; // X distance from pix
+ if ((width < pixW + dotW) || (height < pixH)) {
+ // don't draw
+ pixW = 0;
+ }
+ else
+ pixDrawn = false;
+ }
+
+ // width of text and pixmap to be drawn
+ int w = pixW + _fm->width(name);
+
+// if (0) Debug(90100) << " For '" << name << "': Unused " << unused
+// << ", StrW " << w << ", Width " << width << endl;
+
+ // if we have limited space at 1st line:
+ // use it only if whole name does fit in last line...
+ if ((unused < width) && (w > unused)) {
+ y = isBottom ? (y-h) : (y+h);
+ lines--;
+
+ if (lines<1) return false;
+
+ // new line: reset used space
+ if (isBottom)
+ _usedBottomLeft = _usedBottomCenter = _usedBottomRight = 0;
+ else
+ _usedTopLeft = _usedTopCenter = _usedTopRight = 0;
+ }
+
+ p->save();
+ p->setPen( (qGray(dp->backColor().rgb())>100) ? Qt::black : Qt::white);
+ p->setFont(dp->font());
+ if (rotate) {
+ //p->translate(r.x()+2, r.y()+r.height());
+ p->translate(r.x(), r.y()+r.height()-2);
+ p->rotate(270);
+ }
+ else
+ p->translate(r.x()+2, r.y());
+
+
+ // adjust available lines according to maxLines
+ int max = dp->maxLines(f);
+ if ((max > 0) && (lines>max)) lines = max;
+
+ /* loop over name parts to break up string depending on available width.
+ * every char category change is supposed a possible break,
+ * with the exception Uppercase=>Lowercase.
+ * It's good enough for numbers, Symbols...
+ *
+ * If the text is to be written at the bottom, we start with the
+ * end of the string (so everything is reverted)
+ */
+ QString remaining;
+ int origLines = lines;
+ while (lines>0) {
+
+ if (w>width && lines>1) {
+ int lastBreakPos = name.length(), lastWidth = w;
+ int len = name.length();
+ QChar::Category caOld, ca;
+
+ if (!isBottom) {
+ // start with comparing categories of last 2 chars
+ caOld = name[len-1].category();
+ while (len>2) {
+ len--;
+ ca = name[len-1].category();
+ if (ca != caOld) {
+ // "Aa" has no break between...
+ if (ca == QChar::Letter_Uppercase &&
+ caOld == QChar::Letter_Lowercase) {
+ caOld = ca;
+ continue;
+ }
+ caOld = ca;
+ lastBreakPos = len;
+ w = pixW + _fm->width(name, len);
+ lastWidth = w;
+ if (w <= width) break;
+ }
+ }
+ w = lastWidth;
+ remaining = name.mid(lastBreakPos);
+ // remove space on break point
+ if (name[lastBreakPos-1].category() == QChar::Separator_Space)
+ name = name.left(lastBreakPos-1);
+ else
+ name = name.left(lastBreakPos);
+ }
+ else { // bottom
+ int l = len;
+ caOld = name[l-len].category();
+ while (len>2) {
+ len--;
+ ca = name[l-len].category();
+
+ if (ca != caOld) {
+ // "Aa" has no break between...
+ if (caOld == QChar::Letter_Uppercase &&
+ ca == QChar::Letter_Lowercase) {
+ caOld = ca;
+ continue;
+ }
+ caOld = ca;
+ lastBreakPos = len;
+ w = pixW + _fm->width(name.right(len));
+ lastWidth = w;
+ if (w <= width) break;
+ }
+ }
+ w = lastWidth;
+ remaining = name.left(l-lastBreakPos);
+ // remove space on break point
+ if (name[l-lastBreakPos].category() == QChar::Separator_Space)
+ name = name.right(lastBreakPos-1);
+ else
+ name = name.right(lastBreakPos);
+ }
+ }
+ else
+ remaining = QString::null;
+
+ /* truncate and add ... if needed */
+ if (w>width) {
+ int len = name.length();
+ w += dotW;
+ while (len>2 && (w > width)) {
+ len--;
+ w = pixW + _fm->width(name, len) + dotW;
+ }
+ // stop drawing: we cannot draw 2 chars + "..."
+ if (w>width) break;
+
+ name = name.left(len) + "...";
+ }
+
+ int x = 0;
+ if (isCenter)
+ x = (width - w)/2;
+ else if (isRight)
+ x = width - w;
+
+ if (!pixDrawn) {
+ pixY = y+(h-pixH)/2; // default: center vertically
+ if (pixH > h) pixY = isBottom ? y-(pixH-h) : y;
+
+ p->drawPixmap( x, pixY, pix);
+
+ // for distance to next text
+ pixY = isBottom ? (pixY - h - 2) : (pixY + pixH + 2);
+ pixDrawn = true;
+ }
+
+
+// if (0) Debug(90100) << " Drawing '" << name << "' at "
+// << x+pixW << "/" << y << endl;
+
+ p->drawText( x+pixW, y,
+ width - pixW, h,
+ Qt::AlignLeft, name);
+ y = isBottom ? (y-h) : (y+h);
+ lines--;
+
+ if (remaining.isEmpty()) break;
+ name = remaining;
+ w = pixW + _fm->width(name);
+ }
+
+ // make sure the pix stays visible
+ if (pixDrawn && (pixY>0)) {
+ if (isBottom && (pixYy)) y = pixY;
+ }
+
+ if (origLines > lines) {
+ // if only 1 line written, don't reset _used* vars
+ if (lines - origLines >1) {
+ if (isBottom)
+ _usedBottomLeft = _usedBottomCenter = _usedBottomRight = 0;
+ else
+ _usedTopLeft = _usedTopCenter = _usedTopRight = 0;
+ }
+
+ // take back one line
+ y = isBottom ? (y+h) : (y-h);
+ if (used) *used = w;
+ }
+
+ // update free space
+ if (!isBottom) {
+ if (rotate)
+ _rect.setRect(r.x()+y, r.y(), r.width()-y, r.height());
+ else
+ _rect.setRect(r.x(), r.y()+y, r.width(), r.height()-y);
+ }
+ else {
+ if (rotate)
+ _rect.setRect(r.x(), r.y(), y+h, r.height());
+ else
+ _rect.setRect(r.x(), r.y(), r.width(), y+h);
+ }
+
+ p->restore();
+
+ return true;
+}
Added: branches/tmp/schubi/dialogsolver/src/drawparams.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/drawparams.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/drawparams.h (added)
+++ branches/tmp/schubi/dialogsolver/src/drawparams.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,200 @@
+/* This file is part of KCachegrind.
+ Copyright (C) 2002, 2003 Josef Weidendorfer
+ Adapted for the needs of kdesvn by Rajko Albrecht
+
+ KCachegrind 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, version 2.
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * A Widget for visualizing hierarchical metrics as areas.
+ * The API is similar to QListView.
+ *
+ * This file defines the following classes:
+ * DrawParams, RectDrawing, TreeMapItem, TreeMapWidget
+ *
+ * DrawParams/RectDrawing allows reusing of TreeMap drawing
+ * functions in other widgets.
+ */
+
+#ifndef DRAWPARAMS_H
+#define DRAWPARAMS_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class QPopupMenu;
+class QString;
+
+class KConfigGroup;
+
+
+/**
+ * Drawing parameters for an object.
+ * A Helper Interface for RectDrawing.
+ */
+class DrawParams
+{
+public:
+ /**
+ * Positions for drawing into a rectangle.
+ *
+ * The specified position assumes no rotation.
+ * If there is more than one text for one position, it is put
+ * nearer to the center of the item.
+ *
+ * Drawing at top positions cuts free space from top,
+ * drawing at bottom positions cuts from bottom.
+ * Default usually gives positions clockwise according to field number.
+ */
+ enum Position { TopLeft, TopCenter, TopRight,
+ BottomLeft, BottomCenter, BottomRight,
+ Default, Unknown};
+
+ // no constructor as this is an abstract class
+ virtual ~DrawParams() {}
+
+ virtual QString text(int) const = 0;
+ virtual QPixmap pixmap(int) const = 0;
+ virtual Position position(int) const = 0;
+ // 0: no limit, negative: leave at least -maxLines() free
+ virtual int maxLines(int) const { return 0; }
+ virtual int fieldCount() const { return 0; }
+
+ virtual QColor backColor() const { return Qt::white; }
+ virtual const QFont& font() const = 0;
+
+ virtual bool selected() const { return false; }
+ virtual bool current() const { return false; }
+ virtual bool shaded() const { return true; }
+ virtual bool rotated() const { return false; }
+ virtual bool drawFrame() const { return true; }
+};
+
+
+/*
+ * DrawParam with attributes stored
+ */
+class StoredDrawParams: public DrawParams
+{
+public:
+ StoredDrawParams();
+ StoredDrawParams(QColor c,
+ bool selected = false, bool current = false);
+
+ // getters
+ QString text(int) const;
+ QPixmap pixmap(int) const;
+ Position position(int) const;
+ int maxLines(int) const;
+ int fieldCount() const { return _field.size(); }
+
+ QColor backColor() const { return _backColor; }
+ bool selected() const { return _selected; }
+ bool current() const { return _current; }
+ bool shaded() const { return _shaded; }
+ bool rotated() const { return _rotated; }
+ bool drawFrame() const { return _drawFrame; }
+
+ const QFont& font() const;
+
+ // attribute setters
+ void setField(int f, QString t, QPixmap pm = QPixmap(),
+ Position p = Default, int maxLines = 0);
+ void setText(int f, QString);
+ void setPixmap(int f, QPixmap);
+ void setPosition(int f, Position);
+ void setMaxLines(int f, int);
+ void setBackColor(QColor c) { _backColor = c; }
+ void setSelected(bool b) { _selected = b; }
+ void setCurrent(bool b) { _current = b; }
+ void setShaded(bool b) { _shaded = b; }
+ void setRotated(bool b) { _rotated = b; }
+ void drawFrame(bool b) { _drawFrame = b; }
+
+protected:
+ QColor _backColor;
+ bool _selected :1;
+ bool _current :1;
+ bool _shaded :1;
+ bool _rotated :1;
+ bool _drawFrame :1;
+
+private:
+ // resize field array if needed to allow to access field <f>
+ void ensureField(int f);
+
+ struct Field {
+ QString text;
+ QPixmap pix;
+ Position pos;
+ int maxLines;
+ };
+
+ QValueVector<Field> _field;
+};
+
+
+/* State for drawing on a rectangle.
+ *
+ * Following drawing functions are provided:
+ * - background drawing with shading and 3D frame
+ * - successive pixmap/text drawing at various positions with wrap-around
+ * optimized for minimal space usage (e.g. if a text is drawn at top right
+ * after text on top left, the same line is used if space allows)
+ *
+ */
+class RectDrawing
+{
+public:
+ RectDrawing(QRect);
+ ~RectDrawing();
+
+ // The default DrawParams object used.
+ DrawParams* drawParams();
+ // we take control over the given object (i.e. delete at destruction)
+ void setDrawParams(DrawParams*);
+
+ // draw on a given QPainter, use this class as info provider per default
+ void drawBack(QPainter*, DrawParams* dp = 0);
+ /* Draw field at position() from pixmap()/text() with maxLines().
+ * Returns true if something was drawn
+ */
+ bool drawField(QPainter*, int f, DrawParams* dp = 0);
+
+ // resets rectangle for free space
+ void setRect(QRect);
+
+ // Returns the rectangle area still free of text/pixmaps after
+ // a number of drawText() calls.
+ QRect remainingRect(DrawParams* dp = 0);
+
+private:
+ int _usedTopLeft, _usedTopCenter, _usedTopRight;
+ int _usedBottomLeft, _usedBottomCenter, _usedBottomRight;
+ QRect _rect;
+
+ // temporary
+ int _fontHeight;
+ QFontMetrics* _fm;
+ DrawParams* _dp;
+};
+
+#endif
Added: branches/tmp/schubi/dialogsolver/src/graphtree_defines.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/graphtree_defines.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/graphtree_defines.h (added)
+++ branches/tmp/schubi/dialogsolver/src/graphtree_defines.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,31 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 __GRAPHTREE_DEFINES
+#define __GRAPHTREE_DEFINES
+
+enum {
+ GRAPHTREE_LABEL = 1100,
+ GRAPHTREE_LINE,
+ GRAPHTREE_ARROW,
+ GRAPHTREE_MARK
+};
+
+#endif
Added: branches/tmp/schubi/dialogsolver/src/graphtreelabel.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/graphtreelabel.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/graphtreelabel.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/graphtreelabel.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,220 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 "graphtreelabel.h"
+#include "graphtree_defines.h"
+#include
+
+GraphTreeLabel::GraphTreeLabel(const QString&text, const QString&_nodename,const QRect&r,QCanvas*c)
+ : QCanvasRectangle(r,c),StoredDrawParams()
+{
+ m_Nodename = _nodename;
+ m_SourceNode = QString::null;
+ setText(0,text);
+ setPosition(0, DrawParams::TopCenter);
+ drawFrame(true);
+}
+
+GraphTreeLabel::~GraphTreeLabel()
+{
+}
+
+const QString&GraphTreeLabel::nodename()const
+{
+ return m_Nodename;
+}
+
+int GraphTreeLabel::rtti()const
+{
+ return GRAPHTREE_LABEL;
+}
+
+void GraphTreeLabel::setBgColor(const QColor&c)
+{
+ _backColor=c;
+}
+
+void GraphTreeLabel::drawShape(QPainter& p)
+{
+ QRect r = rect();
+/*
+ p.setPen(blue);
+ p.drawRect(r);
+*/
+ RectDrawing d(r);
+ d.drawBack(&p,this);
+ d.drawField(&p, 0, this);
+ d.drawField(&p, 1, this);
+}
+
+void GraphTreeLabel::setSelected(bool s)
+{
+ QCanvasRectangle::setSelected(s);
+ StoredDrawParams::setSelected(s);
+ update();
+}
+
+const QString&GraphTreeLabel::source()const
+{
+ return m_SourceNode;
+}
+
+void GraphTreeLabel::setSource(const QString&_s)
+{
+ m_SourceNode=_s;
+}
+
+GraphEdge::GraphEdge(QCanvas*c)
+ : QCanvasSpline(c)
+{
+}
+
+GraphEdge::~GraphEdge()
+{
+}
+
+void GraphEdge::drawShape(QPainter& p)
+{
+ p.drawPolyline(poly);
+}
+
+QPointArray GraphEdge::areaPoints() const
+{
+ int minX = poly[0].x(), minY = poly[0].y();
+ int maxX = minX, maxY = minY;
+ int i;
+
+ if (0) qDebug("GraphEdge::areaPoints\n P 0: %d/%d", minX, minY);
+ int len = poly.count();
+ for (i=1;i maxX) maxX = poly[i].x();
+ if (poly[i].y() > maxY) maxY = poly[i].y();
+ if (0) qDebug(" P %d: %d/%d", i, poly[i].x(), poly[i].y());
+ }
+ QPointArray a = poly.copy(), b = poly.copy();
+ if (minX == maxX) {
+ a.translate(-2, 0);
+ b.translate(2, 0);
+ }
+ else {
+ a.translate(0, -2);
+ b.translate(0, 2);
+ }
+ a.resize(2*len);
+ for (i=0;iv2) {
+ r.setRect(r.x()-d, r.y()-d, r.width()+2*d, r.height()+2*d);
+ v /= f;
+ }
+
+ _p = new QPixmap(r.size());
+ _p->fill(Qt::white);
+ QPainter p(_p);
+ p.setPen(Qt::NoPen);
+
+ r.moveBy(-r.x(), -r.y());
+
+ while (vwidth(), _p->height());
+ move(n->rect().center().x()-_p->width()/2,
+ n->rect().center().y()-_p->height()/2);
+}
+
+GraphMark::~ GraphMark()
+{
+}
+
+bool GraphMark::hit(const QPoint&)const
+{
+ return false;
+}
+
+int GraphMark::rtti()const
+{
+ return GRAPHTREE_MARK;
+}
+
+void GraphMark::drawShape(QPainter&p)
+{
+ p.drawPixmap( int(x()), int(y()), *_p );
+}
Added: branches/tmp/schubi/dialogsolver/src/graphtreelabel.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/graphtreelabel.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/graphtreelabel.h (added)
+++ branches/tmp/schubi/dialogsolver/src/graphtreelabel.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 GRAPHTREELABEL_H
+#define GRAPHTREELABEL_H
+
+#include "drawparams.h"
+#include
+
+/**
+ @author Rajko Albrecht
+*/
+class GraphTreeLabel : public QCanvasRectangle,StoredDrawParams
+{
+public:
+ GraphTreeLabel(const QString&,const QString&,const QRect&r,QCanvas*c);
+ virtual ~GraphTreeLabel();
+
+ virtual int rtti()const;
+ virtual void drawShape(QPainter& p);
+
+ void setBgColor(const QColor&);
+
+ const QString&nodename()const;
+ const QString&source()const;
+ void setSource(const QString&);
+ virtual void setSelected(bool);
+
+protected:
+ QString m_Nodename;
+ QString m_SourceNode;
+};
+
+class GraphEdge;
+
+class GraphEdgeArrow:public QCanvasPolygon
+{
+public:
+ GraphEdgeArrow(GraphEdge*,QCanvas*);
+ GraphEdge*edge();
+ virtual void drawShape(QPainter&);
+ virtual int rtti()const;
+
+private:
+ GraphEdge*_edge;
+};
+
+/* line */
+class GraphEdge:public QCanvasSpline
+{
+public:
+ GraphEdge(QCanvas*);
+ virtual ~GraphEdge();
+
+ virtual void drawShape(QPainter&);
+ QPointArray areaPoints() const;
+ virtual int rtti()const;
+};
+
+class GraphMark:public QCanvasRectangle
+{
+public:
+ GraphMark(GraphTreeLabel*,QCanvas*);
+ virtual ~GraphMark();
+ virtual int rtti()const;
+ virtual bool hit(const QPoint&)const;
+
+ virtual void drawShape(QPainter&);
+private:
+ static QPixmap*_p;
+};
+
+#endif
Added: branches/tmp/schubi/dialogsolver/src/pannerview.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/pannerview.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/pannerview.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/pannerview.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 "pannerview.h"
+#include
+
+PannerView::PannerView(QWidget* parent, const char* name)
+ : QCanvasView(parent, name,WNoAutoErase | WStaticContents )
+{
+ m_Moving = false;
+ viewport()->setBackgroundMode(Qt::NoBackground);
+ setBackgroundMode(Qt::NoBackground);
+}
+
+PannerView::~PannerView()
+{
+}
+
+void PannerView::drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph)
+{
+ p->save();
+ QCanvasView::drawContents(p,clipx,clipy,clipw,cliph);
+ p->restore();
+ if (m_ZoomRect.isValid()) {
+ p->setPen(red.dark());
+ p->drawRect(m_ZoomRect);
+ p->setPen( red);
+ p->drawRect(QRect(m_ZoomRect.x()+1, m_ZoomRect.y()+1,
+ m_ZoomRect.width()-2, m_ZoomRect.height()-2));
+ }
+}
+
+void PannerView::setZoomRect(const QRect& theValue)
+{
+ QRect oldRect = m_ZoomRect;
+ m_ZoomRect = theValue;
+ updateContents(oldRect);
+ updateContents(m_ZoomRect);
+}
+
+/*!
+ \fn PannerView::contentsMouseMoveEvent(QMouseEvent* e)
+ */
+void PannerView::contentsMouseMoveEvent(QMouseEvent* e)
+{
+ if (m_Moving) {
+ emit zoomRectMoved(e->pos().x() - m_LastPos.x(), e->pos().y() - m_LastPos.y());
+ m_LastPos = e->pos();
+ }
+}
+
+/*!
+ \fn PannerView::contentsMousePressEvent(QMouseEvent* e)
+ */
+void PannerView::contentsMousePressEvent(QMouseEvent* e)
+{
+ if (m_ZoomRect.isValid()) {
+ if (!m_ZoomRect.contains(e->pos())) {
+ emit zoomRectMoved(e->pos().x() - m_ZoomRect.center().x(),
+ e->pos().y() - m_ZoomRect.center().y());
+ }
+ m_Moving = true;
+ m_LastPos = e->pos();
+ }
+}
+
+/*!
+ \fn PannerView::contentsMouseReleaseEvent(QMouseEvent*)
+ */
+void PannerView::contentsMouseReleaseEvent(QMouseEvent*)
+{
+ m_Moving = false;
+ emit zoomRectMoveFinished();
+}
+
+/*!
+ \fn PannerView::updateCurrentRect()
+ */
+void PannerView::updateCurrentRect()
+{
+ if (m_ZoomRect.isValid()) updateContents(m_ZoomRect);
+}
+
+#include "pannerview.moc"
+
Added: branches/tmp/schubi/dialogsolver/src/pannerview.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/pannerview.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/pannerview.h (added)
+++ branches/tmp/schubi/dialogsolver/src/pannerview.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 PANNERVIEW_H
+#define PANNERVIEW_H
+
+#include
+
+/**
+ @author Rajko Albrecht
+*/
+class PannerView : public QCanvasView
+{
+Q_OBJECT
+public:
+ PannerView(QWidget* parent=0, const char* name=0);
+ virtual ~PannerView();
+
+ void setZoomRect(const QRect& theValue);
+ void updateCurrentRect();
+
+signals:
+ void zoomRectMoved(int dx, int dy);
+ void zoomRectMoveFinished();
+
+protected:
+ virtual void drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph);
+ virtual void contentsMouseMoveEvent(QMouseEvent* e);
+ virtual void contentsMousePressEvent(QMouseEvent* e);
+ virtual void contentsMouseReleaseEvent(QMouseEvent*);
+protected:
+ QRect m_ZoomRect;
+ bool m_Moving;
+ QPoint m_LastPos;
+};
+
+#endif
Added: branches/tmp/schubi/dialogsolver/src/resgraphview.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/resgraphview.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/resgraphview.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/resgraphview.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,856 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 "resgraphview.h"
+#include "graphtreelabel.h"
+#include "pannerview.h"
+#include "graphtree_defines.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+#include
+
+
+#define LABEL_WIDTH 160
+#define LABEL_HEIGHT 90
+#define i18n(MSG) QString(MSG)
+
+static int globalDirection = 0;
+
+class GraphViewTipSolver:public QToolTip
+{
+public:
+ GraphViewTipSolver( QWidget* p ):QToolTip(p) {}
+ virtual ~GraphViewTipSolver(){}
+
+protected:
+ void maybeTip( const QPoint & );
+};
+
+void GraphViewTipSolver::maybeTip( const QPoint & pos)
+{
+ if (!parentWidget()->inherits( "ResGraphView" )) return;
+ ResGraphView* cgv = (ResGraphView*)parentWidget();
+ QPoint cPos = cgv->viewportToContents(pos);
+ QCanvasItemList l = cgv->canvas()->collisions(cPos);
+ if (l.count() == 0) return;
+ QCanvasItem* i = l.first();
+ if (i->rtti() == GRAPHTREE_LABEL) {
+ GraphTreeLabel*tl = (GraphTreeLabel*)i;
+ QString nm = tl->nodename();
+ QString tipStr = cgv->toolTip(nm);
+ if (tipStr.length()>0) {
+ QPoint vPosTL = cgv->contentsToViewport(i->boundingRect().topLeft());
+ QPoint vPosBR = cgv->contentsToViewport(i->boundingRect().bottomRight());
+ tip(QRect(vPosTL, vPosBR), tipStr);
+ }
+ }
+}
+
+ResGraphView::ResGraphView(QWidget * parent, const char * name, WFlags f)
+ : QCanvasView(parent,name,f)
+{
+ m_Canvas = 0L;
+ dotTmpFile = 0;
+ m_Selected = 0;
+ renderProcess = 0;
+ m_Marker = 0;
+ m_Tip = new GraphViewTipSolver(this);
+ m_CompleteView = new PannerView(this);
+
+ m_CompleteView->setVScrollBarMode(QScrollView::AlwaysOff);
+ m_CompleteView->setHScrollBarMode(QScrollView::AlwaysOff);
+ m_CompleteView->raise();
+ m_CompleteView->hide();
+ connect(this, SIGNAL(contentsMoving(int,int)),
+ this, SLOT(contentsMovingSlot(int,int)));
+ connect(m_CompleteView, SIGNAL(zoomRectMoved(int,int)),
+ this, SLOT(zoomRectMoved(int,int)));
+ connect(m_CompleteView, SIGNAL(zoomRectMoveFinished()),
+ this, SLOT(zoomRectMoveFinished()));
+ m_LastAutoPosition = TopLeft;
+ _isMoving = false;
+ _noUpdateZoomerPos = false;
+ m_LabelMap[""]="";
+}
+
+ResGraphView::~ResGraphView()
+{
+ setCanvas(0);
+ delete m_Canvas;
+ delete dotTmpFile;
+ delete m_CompleteView;
+ delete m_Tip;
+ delete renderProcess;
+}
+
+void ResGraphView::showText(const QString&s)
+{
+ clear();
+ m_Canvas = new QCanvas(QApplication::desktop()->width(),
+ QApplication::desktop()->height());
+
+ QCanvasText* t = new QCanvasText(s, m_Canvas);
+ t->move(5, 5);
+ t->show();
+ center(0,0);
+ setCanvas(m_Canvas);
+ m_Canvas->update();
+ m_CompleteView->hide();
+}
+
+void ResGraphView::clear()
+{
+ if (m_Selected) {
+ m_Selected->setSelected(false);
+ m_Selected=0;
+ }
+ if (m_Marker) {
+ m_Marker->hide();
+ delete m_Marker;
+ m_Marker=0;
+ }
+ if (!m_Canvas) return;
+ delete m_Canvas;
+ m_Canvas = 0;
+ setCanvas(0);
+ m_CompleteView->setCanvas(0);
+}
+
+void ResGraphView::beginInsert()
+{
+ viewport()->setUpdatesEnabled(false);
+}
+
+void ResGraphView::endInsert()
+{
+ if (m_Canvas) {
+ _cvZoomH = 0;
+ _cvZoomW = 0;
+ updateSizes();
+ m_Canvas->update();
+ }
+ viewport()->setUpdatesEnabled(true);
+}
+
+void ResGraphView::dotExit()
+{
+
+ dotOutput+=QString::fromLocal8Bit(renderProcess->readStdout());
+
+ // remove line breaks when lines to long
+ QRegExp endslash("\\\\\\n");
+ dotOutput.replace(endslash,"");
+
+#if 0
+ QFile *dot = new QFile("dotoutput");
+ dot->open(IO_ReadWrite);
+ QTextStream stream(dot);
+ stream << dotOutput << flush;
+ dot->close();
+#endif
+
+ double scale = 1.0, scaleX = 1.0, scaleY = 1.0;
+ double dotWidth, dotHeight;
+ QTextStream* dotStream;
+ dotStream = new QTextStream(dotOutput, IO_ReadOnly);
+ QString line,cmd;
+ int lineno=0;
+ clear();
+ beginInsert();
+ /* mostly taken from kcachegrind */
+ while (1) {
+ line = dotStream->readLine();
+ if (line.isNull()) break;
+ lineno++;
+ if (line.isEmpty()) continue;
+ QTextStream lineStream(line, IO_ReadOnly);
+ lineStream >> cmd;
+ if (cmd == "stop") {break; }
+
+ if (cmd == "graph") {
+ lineStream >> scale >> dotWidth >> dotHeight;
+ scaleX = scale * 60; scaleY = scale * 100;
+ int w = (int)(scaleX * dotWidth);
+ int h = (int)(scaleY * dotHeight);
+
+ _xMargin = 50;
+ if (w < QApplication::desktop()->width())
+ _xMargin += (QApplication::desktop()->width()-w)/2;
+ _yMargin = 50;
+ if (h < QApplication::desktop()->height())
+ _yMargin += (QApplication::desktop()->height()-h)/2;
+ m_Canvas = new QCanvas(int(w+2*_xMargin), int(h+2*_yMargin));
+ continue;
+ }
+ if ((cmd != "node") && (cmd != "edge")) {
+// kdWarning() << "Ignoring unknown command '" << cmd << "' from dot ("
+// << dotTmpFile->name() << ":" << lineno << ")" << endl;
+ continue;
+ }
+ if (cmd=="node") {
+ QString nodeName, label;
+ QString _x,_y,_w,_h;
+ double x, y, width, height;
+ lineStream >> nodeName >> _x >> _y >> _w >> _h;
+ x=_x.toDouble();
+ y=_y.toDouble();
+ width=_w.toDouble();
+ height=_h.toDouble();
+ // better here 'cause dot may scramble utf8 labels so we regenerate it better
+ // and do not read it in.
+ label = getLabelstring(nodeName);
+ int xx = (int)(scaleX * x + _xMargin);
+ int yy = (int)(scaleY * (dotHeight - y) + _yMargin);
+ int w = (int)(scaleX * width);
+ int h = (int)(scaleY * height);
+ QRect r(xx-w/2, yy-h/2, w, h);
+ GraphTreeLabel*t=new GraphTreeLabel(label,nodeName,r,m_Canvas);
+ if (isStart(nodeName)) {
+ ensureVisible(r.x(),r.y());
+ }
+ t->setBgColor(getBgColor(nodeName));
+ t->setZ(1.0);
+ t->show();
+ m_NodeList[nodeName]=t;
+ } else {
+ QString node1Name, node2Name, label;
+ QString _x,_y;
+ double x, y;
+ QPointArray pa;
+ int points, i;
+ lineStream >> node1Name >> node2Name;
+ lineStream >> points;
+ pa.resize(points);
+ for (i=0;i> _x >> _y;
+ x=_x.toDouble();
+ y=_y.toDouble();
+ int xx = (int)(scaleX * x + _xMargin);
+ int yy = (int)(scaleY * (dotHeight - y) + _yMargin);
+
+ if (0) qDebug(" P %d: ( %f / %f ) => ( %d / %d)",
+ i, x, y, xx, yy);
+ pa.setPoint(i, xx, yy);
+ }
+ if (i < points) {
+ qDebug("CallGraphView: Can't read %d spline points (%d)",
+ points, lineno);
+ continue;
+ }
+
+ GraphEdge * n = new GraphEdge(m_Canvas);
+ QColor arrowColor = Qt::black;
+ n->setPen(QPen(arrowColor,1));
+ n->setControlPoints(pa,false);
+ n->setZ(0.5);
+ n->show();
+
+ /* arrow */
+ QPoint arrowDir;
+ int indexHead = -1;
+
+ QMap::Iterator it;
+ it = m_NodeList.find(node2Name);
+ if (it!=m_NodeList.end()) {
+ it.data()->setSource(node1Name);
+ }
+ it = m_NodeList.find(node1Name);
+ if (it!=m_NodeList.end()) {
+ GraphTreeLabel*tlab = it.data();
+ if (tlab) {
+ QPoint toCenter = tlab->rect().center();
+ int dx0 = pa.point(0).x() - toCenter.x();
+ int dy0 = pa.point(0).y() - toCenter.y();
+ int dx1 = pa.point(points-1).x() - toCenter.x();
+ int dy1 = pa.point(points-1).y() - toCenter.y();
+ if (dx0*dx0+dy0*dy0 > dx1*dx1+dy1*dy1) {
+ // start of spline is nearer to call target node
+ indexHead=-1;
+ while(arrowDir.isNull() && (indexHead1)) {
+ indexHead--;
+ arrowDir = pa.point(indexHead) - pa.point(indexHead-1);
+ }
+ }
+ if (!arrowDir.isNull()) {
+ arrowDir *= 10.0/sqrt(double(arrowDir.x()*arrowDir.x() +
+ arrowDir.y()*arrowDir.y()));
+ QPointArray a(3);
+ a.setPoint(0, pa.point(indexHead) + arrowDir);
+ a.setPoint(1, pa.point(indexHead) + QPoint(arrowDir.y()/2,
+ -arrowDir.x()/2));
+ a.setPoint(2, pa.point(indexHead) + QPoint(-arrowDir.y()/2,
+ arrowDir.x()/2));
+ GraphEdgeArrow* aItem = new GraphEdgeArrow(n,m_Canvas);
+ aItem->setPoints(a);
+ aItem->setBrush(arrowColor);
+ aItem->setZ(1.5);
+ aItem->show();
+// sItem->setArrow(aItem);
+ }
+ }
+ }
+ if (!m_Canvas) {
+ QString s = i18n("Error running the graph layouting tool.\n");
+ s += i18n("Please check that 'dot' is installed (package GraphViz).");
+ showText(s);
+ } else {
+ setCanvas(m_Canvas);
+ m_CompleteView->setCanvas(m_Canvas);
+ }
+ endInsert();
+ renderProcess=0;
+}
+
+bool ResGraphView::isStart(const QString&nodeName)const
+{
+ bool res = false;
+ trevTree::ConstIterator it;
+ it = m_Tree.find(nodeName);
+ if (it==m_Tree.end()) {
+ return res;
+ }
+
+ return res;
+}
+
+
+QColor ResGraphView::getBgColor(const QString&nodeName)const
+{
+ trevTree::ConstIterator it;
+ it = m_Tree.find(nodeName);
+ QColor res = Qt::white;
+ if (it==m_Tree.end()) {
+ return res;
+ }
+#if 0
+ switch (it.data().Action) {
+ case 'D':
+ res = Kdesvnsettings::tree_delete_color();
+ break;
+ case 'R':
+ case 'M':
+ res = Kdesvnsettings::tree_modify_color();
+ break;
+ case 'A':
+ res = Kdesvnsettings::tree_add_color();
+ break;
+ case 'C':
+ case 1:
+ res = Kdesvnsettings::tree_copy_color();
+ break;
+ case 2:
+ res = Kdesvnsettings::tree_rename_color();
+ break;
+ default:
+ res = Kdesvnsettings::tree_modify_color();
+ break;
+ }
+#endif
+ return res;
+}
+
+const QString&ResGraphView::getLabelstring(const QString&nodeName)
+{
+ QMap::ConstIterator nIt;
+ nIt = m_LabelMap.find(nodeName);
+ if (nIt!=m_LabelMap.end()) {
+ return nIt.data();
+ }
+ trevTree::ConstIterator it1;
+ it1 = m_Tree.find(nodeName);
+ if (it1==m_Tree.end()) {
+ return m_LabelMap[""];
+ }
+
+ m_LabelMap[nodeName]=it1.data().name + "-" + it1.data().version;
+ return m_LabelMap[nodeName];
+}
+
+void ResGraphView::dumpRevtree()
+{
+
+ delete dotTmpFile;
+ clear();
+ dotOutput = "";
+ QString filename = zypp::filesystem::TmpFile().path().asString();
+ dotTmpFile = new QFile(filename);
+
+ if (!dotTmpFile->open(IO_ReadWrite)) {
+ showText(i18n("Could not open tempfile %1 for writing.").arg(filename));
+ return;
+ }
+
+ QTextStream stream(dotTmpFile);
+
+ stream << "digraph \"callgraph\" {\n";
+ stream << " bgcolor=\"transparent\";\n";
+ int dir = globalDirection;
+ stream << QString(" rankdir=\"");
+ switch (dir) {
+ case 3:
+ stream << "TB";
+ break;
+ case 2:
+ stream << "RL";
+ break;
+ case 1:
+ stream << "BT";
+ break;
+ case 0:
+ default:
+ stream << "LR";
+ break;
+ }
+ stream << "\";\n";
+
+ //*stream << QString(" overlap=false;\n splines=true;\n");
+
+ ResGraphView::trevTree::ConstIterator it1;
+ for (it1=m_Tree.begin();it1!=m_Tree.end();++it1) {
+ stream << " " << it1.key()
+ << "[ "
+ << "shape=box, "
+ << "label=\""<"<<" "<addArgument( "dot" );
+ renderProcess->addArgument( filename );
+ renderProcess->addArgument( "-Tplain");
+
+ QStringList envs;
+ envs << "LANG" << "C";
+
+ connect(renderProcess,SIGNAL(processExited()),this,SLOT(dotExit()));
+
+ if (!renderProcess->start(&envs)) {
+ QString argu;
+ for (unsigned c=0;c<renderProcess->arguments().count();++c) {
+ argu+=QString(" %1").arg(renderProcess->arguments()[c]);
+ }
+ QString error = i18n("Could not start process \"%1\".").arg(argu);
+ showText(error);
+ renderProcess=0;
+ //delete renderProcess;<
+ }
+}
+
+QString ResGraphView::toolTip(const QString&_nodename,bool full)const
+{
+ QString res = QString::null;
+ trevTree::ConstIterator it;
+ it = m_Tree.find(_nodename);
+ if (it==m_Tree.end()) {
+ return res;
+ }
+ QStringList sp = QStringList::split("\n",it.data().description);
+ QString sm;
+ if (sp.count()==0) {
+ sm = it.data().description;
+ } else {
+ if (!full) {
+ sm = sp[0]+"...";
+ } else {
+ for (unsigned j = 0; j0) sm+="<br>";
+ sm+=sp[j];
+ }
+ }
+ }
+ if (!full && sm.length()>50) {
+ sm.truncate(47);
+ sm+="...";
+ }
+ static QString csep = "</td><td>";
+ static QString rend = "</td></tr>";
+ static QString rstart = "<tr><td>";
+ res = QString("<html><body>");
+
+ if (!full) {
+ res+=QString("<b>%1</b>").arg(it.data().name);
+ res += i18n("<br>Kind: %1<br>Version: %2<br>Source: %3<br>Description: %4</html>")
+ .arg(it.data().kind)
+ .arg(it.data().version)
+ .arg(it.data().source)
+ .arg(sm);
+ } else {
+ res+="<table><tr><b>"+it.data().name+"</b></th></tr>";
+ res+=rstart;
+ res+=i18n("<b>Kind</b>%1%2%3").arg(csep).arg(it.data().kind).arg(rend);
+ res+=rstart+i18n("<b>Version</b>%1%2%3").arg(csep).arg(it.data().version).arg(rend);
+ res+=rstart+i18n("<b>Source</b>%1%2%3").arg(csep).arg(it.data().source).arg(rend);
+ res+=rstart+i18n("<b>Description</b>%1%2%3").arg(csep).arg(sm).arg(rend);
+ res+="</table></body></html>";
+ }
+ return res;
+}
+
+void ResGraphView::updateSizes(QSize s)
+{
+ if (!m_Canvas) return;
+ if (s == QSize(0,0)) s = size();
+
+ // the part of the canvas that should be visible
+ int cWidth = m_Canvas->width() - 2*_xMargin + 100;
+ int cHeight = m_Canvas->height() - 2*_yMargin + 100;
+
+ // hide birds eye view if no overview needed
+ if (((cWidth < s.width()) && cHeight < s.height())||m_NodeList.count()==0) {
+ m_CompleteView->hide();
+ return;
+ }
+
+ m_CompleteView->show();
+
+ // first, assume use of 1/3 of width/height (possible larger)
+ double zoom = .33 * s.width() / cWidth;
+ if (zoom * cHeight < .33 * s.height()) zoom = .33 * s.height() / cHeight;
+
+ // fit to widget size
+ if (cWidth * zoom > s.width()) zoom = s.width() / (double)cWidth;
+ if (cHeight * zoom > s.height()) zoom = s.height() / (double)cHeight;
+
+ // scale to never use full height/width
+ zoom = zoom * 3/4;
+
+ // at most a zoom of 1/3
+ if (zoom > .33) zoom = .33;
+
+ double cvZoomW = zoom;
+ double cvZoomH = zoom;
+
+ // show at least 1/20 of the frame
+ if (cWidth * cvZoomW < s.width()/20) cvZoomW = s.width() / (double)cWidth / 20;
+ if (cHeight * cvZoomH < s.height()/20) cvZoomH = s.height() / (double)cHeight / 20;
+
+ if (cvZoomW != _cvZoomW
+ || cvZoomH != _cvZoomH) {
+ _cvZoomW = cvZoomW;
+ _cvZoomH = cvZoomH;
+
+ if (1) qDebug("Canvas Size: %dx%d, Visible: %dx%d, ZoomH: %f, ZoomW: %f",
+ m_Canvas->width(), m_Canvas->height(),
+ cWidth, cHeight, cvZoomH, cvZoomW);
+
+ QWMatrix wm;
+ wm.scale( _cvZoomW, _cvZoomH );
+ m_CompleteView->setWorldMatrix(wm);
+
+ // make it a little bigger to compensate for widget frame
+ m_CompleteView->resize(int(cWidth * _cvZoomW) + 4,
+ int(cHeight * _cvZoomH) + 4);
+
+ // update ZoomRect in completeView
+ contentsMovingSlot(contentsX(), contentsY());
+ }
+
+ m_CompleteView->setContentsPos(int(_cvZoomW*(_xMargin-50)),
+ int(_cvZoomH*(_yMargin-50)));
+ updateZoomerPos();
+}
+
+void ResGraphView::updateZoomerPos()
+{
+ int cvW = m_CompleteView->width();
+ int cvH = m_CompleteView->height();
+ int x = width()- cvW - verticalScrollBar()->width() -2;
+ int y = height()-cvH - horizontalScrollBar()->height() -2;
+
+ QPoint oldZoomPos = m_CompleteView->pos();
+ QPoint newZoomPos = QPoint(0,0);
+
+#if 0
+ ZoomPosition zp = _zoomPosition;
+ if (zp == Auto) {
+#else
+ ZoomPosition zp = m_LastAutoPosition;
+#endif
+ QPoint tl1Pos = viewportToContents(QPoint(0,0));
+ QPoint tl2Pos = viewportToContents(QPoint(cvW,cvH));
+ QPoint tr1Pos = viewportToContents(QPoint(x,0));
+ QPoint tr2Pos = viewportToContents(QPoint(x+cvW,cvH));
+ QPoint bl1Pos = viewportToContents(QPoint(0,y));
+ QPoint bl2Pos = viewportToContents(QPoint(cvW,y+cvH));
+ QPoint br1Pos = viewportToContents(QPoint(x,y));
+ QPoint br2Pos = viewportToContents(QPoint(x+cvW,y+cvH));
+ int tlCols = m_Canvas->collisions(QRect(tl1Pos,tl2Pos)).count();
+ int trCols = m_Canvas->collisions(QRect(tr1Pos,tr2Pos)).count();
+ int blCols = m_Canvas->collisions(QRect(bl1Pos,bl2Pos)).count();
+ int brCols = m_Canvas->collisions(QRect(br1Pos,br2Pos)).count();
+ int minCols = tlCols;
+ zp = m_LastAutoPosition;
+ switch(zp) {
+ case TopRight: minCols = trCols; break;
+ case BottomLeft: minCols = blCols; break;
+ case BottomRight: minCols = brCols; break;
+ default:
+ case TopLeft: minCols = tlCols; break;
+ }
+ if (minCols > tlCols) { minCols = tlCols; zp = TopLeft; }
+ if (minCols > trCols) { minCols = trCols; zp = TopRight; }
+ if (minCols > blCols) { minCols = blCols; zp = BottomLeft; }
+ if (minCols > brCols) { minCols = brCols; zp = BottomRight; }
+
+ m_LastAutoPosition = zp;
+#if 0
+ }
+#endif
+ switch(zp) {
+ case TopRight:
+ newZoomPos = QPoint(x,0);
+ break;
+ case BottomLeft:
+ newZoomPos = QPoint(0,y);
+ break;
+ case BottomRight:
+ newZoomPos = QPoint(x,y);
+ break;
+ default:
+ break;
+ }
+ if (newZoomPos != oldZoomPos) m_CompleteView->move(newZoomPos);
+}
+
+void ResGraphView::contentsMovingSlot(int x,int y)
+{
+ QRect z(int(x * _cvZoomW), int(y * _cvZoomH),
+ int(visibleWidth() * _cvZoomW)-1, int(visibleHeight() * _cvZoomH)-1);
+ if (0) qDebug("moving: (%d,%d) => (%d/%d - %dx%d)",
+ x, y, z.x(), z.y(), z.width(), z.height());
+ m_CompleteView->setZoomRect(z);
+ if (!_noUpdateZoomerPos) {
+ updateZoomerPos();
+ }
+}
+
+void ResGraphView::zoomRectMoved(int dx,int dy)
+{
+ if (leftMargin()>0) dx = 0;
+ if (topMargin()>0) dy = 0;
+ _noUpdateZoomerPos = true;
+ scrollBy(int(dx/_cvZoomW),int(dy/_cvZoomH));
+ _noUpdateZoomerPos = false;
+}
+
+void ResGraphView::zoomRectMoveFinished()
+{
+#if 0
+ if (_zoomPosition == Auto)
+#endif
+ updateZoomerPos();
+}
+
+void ResGraphView::resizeEvent(QResizeEvent*e)
+{
+ QCanvasView::resizeEvent(e);
+ if (m_Canvas) updateSizes(e->size());
+}
+
+void ResGraphView::makeSelected(GraphTreeLabel*gtl)
+{
+ if (m_Selected) {
+ m_Selected->setSelected(false);
+ }
+ m_Selected=gtl;
+ if (m_Marker) {
+ m_Marker->hide();
+ delete m_Marker;
+ m_Marker=0;
+ }
+ if (gtl) {
+ m_Marker = new GraphMark(gtl,m_Canvas);
+ m_Marker->setZ(-1);
+ m_Marker->show();
+ m_Selected->setSelected(true);
+ }
+ m_Canvas->update();
+ m_CompleteView->updateCurrentRect();
+}
+
+void ResGraphView::contentsMouseDoubleClickEvent ( QMouseEvent * e )
+{
+ setFocus();
+ if (e->button() == Qt::LeftButton) {
+ QCanvasItemList l = canvas()->collisions(e->pos());
+ if (l.count()>0) {
+ QCanvasItem* i = l.first();
+ if (i->rtti()==GRAPHTREE_LABEL) {
+ makeSelected( (GraphTreeLabel*)i);
+ emit dispDetails(toolTip(((GraphTreeLabel*)i)->nodename(),true));
+ }
+ }
+ }
+}
+
+void ResGraphView::contentsMousePressEvent ( QMouseEvent * e )
+{
+ setFocus();
+ _isMoving = true;
+ _lastPos = e->globalPos();
+}
+
+void ResGraphView::contentsMouseReleaseEvent ( QMouseEvent * )
+{
+ _isMoving = false;
+ updateZoomerPos();
+}
+
+void ResGraphView::contentsMouseMoveEvent ( QMouseEvent * e )
+{
+ if (_isMoving) {
+ int dx = e->globalPos().x() - _lastPos.x();
+ int dy = e->globalPos().y() - _lastPos.y();
+ _noUpdateZoomerPos = true;
+ scrollBy(-dx, -dy);
+ _noUpdateZoomerPos = false;
+ _lastPos = e->globalPos();
+ }
+}
+
+void ResGraphView::setNewDirection(int dir)
+{
+ if (dir<0)dir=3;
+ else if (dir>3)dir=0;
+ globalDirection = dir;
+ dumpRevtree();
+}
+
+void ResGraphView::contentsContextMenuEvent(QContextMenuEvent* e)
+{
+ if (!m_Canvas) return;
+ QCanvasItemList l = canvas()->collisions(e->pos());
+ QCanvasItem* i = (l.count() == 0) ? 0 : l.first();
+
+ QPopupMenu popup;
+ if (i && i->rtti()==GRAPHTREE_LABEL) {
+ if (m_Selected == i) {
+ popup.insertItem(i18n("Unselect item"),401);
+ } else {
+ popup.insertItem(i18n("Select item"),402);
+ }
+ popup.insertSeparator();
+ popup.insertItem(i18n("Display details"),403);
+ popup.insertSeparator();
+ }
+ popup.insertItem(i18n("Rotate counter-clockwise"),101);
+ popup.insertItem(i18n("Rotate clockwise"),102);
+ popup.insertSeparator();
+ popup.setCheckable(true);
+ popup.insertItem(i18n("Save tree as png"),201);
+
+ int r = popup.exec(e->globalPos());
+
+ switch (r) {
+ case 101:
+ {
+ int dir = globalDirection;
+ setNewDirection(++dir);
+ }
+ break;
+ case 102:
+ {
+ int dir = globalDirection;
+ setNewDirection(--dir);
+ }
+ break;
+ case 201:
+ {
+ QString fn = QFileDialog::getSaveFileName(
+ "/home",
+ "Images (*.png *.xpm *.jpg)",
+ this,
+ "save file dialog",
+ "Choose a filename to save under" );
+ if (!fn.isEmpty()) {
+ if (m_Marker) {
+ m_Marker->hide();
+ }
+ if (m_Selected) {
+ m_Selected->setSelected(false);
+ }
+ QPixmap pix(m_Canvas->size());
+ QPainter p(&pix);
+ m_Canvas->drawArea( m_Canvas->rect(), &p );
+ pix.save(fn,"PNG");
+ if (m_Marker) {
+ m_Marker->show();
+ }
+ if (m_Selected) {
+ m_Selected->setSelected(true);
+ m_Canvas->update();
+ m_CompleteView->updateCurrentRect();
+ }
+ }
+ }
+ case 401:
+ makeSelected(0);
+ break;
+ case 402:
+ makeSelected((GraphTreeLabel*)i);
+ break;
+ case 403:
+ emit dispDetails(toolTip(((GraphTreeLabel*)i)->nodename(),true));
+ break;
+ default:
+ break;
+ }
+}
+
+
+void ResGraphView::setBasePath(const QString&_path)
+{
+ _basePath = _path;
+}
+
+void ResGraphView::slotClientException(const QString&what)
+{
+ QMessageBox::critical(0,"Critical",what, QMessageBox::Ok,
+ QMessageBox::Cancel);
+}
+
+#include "resgraphview.moc"
Added: branches/tmp/schubi/dialogsolver/src/resgraphview.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/resgraphview.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/resgraphview.h (added)
+++ branches/tmp/schubi/dialogsolver/src/resgraphview.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,142 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 RESGRAPHVIEW_H
+#define RESGRAPHVIEW_H
+
+
+#include
+#include
+#include
+
+namespace svn {
+ class LogEntry;
+ class Client;
+}
+class RevisionTree;
+class SolverTree;
+class GraphTreeLabel;
+class GraphViewTipSolver;
+class GraphMark;
+class PannerView;
+class CContextListener;
+
+/**
+ @author Rajko Albrecht
+*/
+class ResGraphView : public QCanvasView
+{
+ Q_OBJECT
+public:
+ enum ZoomPosition { TopLeft, TopRight, BottomLeft, BottomRight, Auto };
+ /* avoid large copy operations */
+ friend class RevisionTree;
+ friend class SolverTree;
+
+ ResGraphView(QWidget * parent = 0, const char * name = 0, WFlags f = 0);
+ virtual ~ResGraphView();
+
+ void showText(const QString&s);
+ void clear();
+
+ void beginInsert();
+ void endInsert();
+
+ struct targetData {
+ QString key;
+ targetData(const QString&n)
+ {
+ key = n;
+ }
+ targetData(){key="";}
+ };
+ typedef QValueList<targetData> tlist;
+
+ struct keyData {
+ QString name,
+ kind,
+ source,
+ version,
+ description;
+ tlist targets;
+ };
+
+ typedef QMap trevTree;
+
+ QString toolTip(const QString&nodename,bool full=false)const;
+
+ void setBasePath(const QString&);
+ void dumpRevtree();
+
+signals:
+ void dispDetails(const QString&);
+
+public slots:
+ virtual void contentsMovingSlot(int,int);
+ virtual void zoomRectMoved(int,int);
+ virtual void zoomRectMoveFinished();
+ virtual void slotClientException(const QString&what);
+
+protected slots:
+ virtual void dotExit();
+
+protected:
+ QCanvas*m_Canvas;
+ GraphMark*m_Marker;
+ GraphTreeLabel*m_Selected;
+ QFile*dotTmpFile;
+ QString dotOutput;
+ QProcess*renderProcess;
+ trevTree m_Tree;
+ QColor getBgColor(const QString&nodeName)const;
+ bool isStart(const QString&nodeName)const;
+ const QString&getLabelstring(const QString&nodeName);
+
+ QMap m_NodeList;
+ QMap m_LabelMap;
+
+ int _xMargin,_yMargin;
+ GraphViewTipSolver*m_Tip;
+ PannerView*m_CompleteView;
+ double _cvZoomW;
+ double _cvZoomH;
+ ZoomPosition m_LastAutoPosition;
+
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void contentsMousePressEvent ( QMouseEvent * e );
+ virtual void contentsMouseReleaseEvent ( QMouseEvent * e );
+ virtual void contentsMouseMoveEvent ( QMouseEvent*e);
+ virtual void contentsContextMenuEvent(QContextMenuEvent*e);
+ virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e );
+
+ bool _isMoving;
+ QPoint _lastPos;
+
+ bool _noUpdateZoomerPos;
+
+ QString _basePath;
+
+private:
+ void updateSizes(QSize s = QSize(0,0));
+ void updateZoomerPos();
+ void setNewDirection(int dir);
+ void makeSelected(GraphTreeLabel*);
+};
+
+#endif
Added: branches/tmp/schubi/dialogsolver/src/restreewidget.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/restreewidget.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/restreewidget.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/restreewidget.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 "restreewidget.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "resgraphview.h"
+
+/*
+ * Constructs a ResTreeWidget as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+ResTreeWidget::ResTreeWidget(QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "ResTreeWidget" );
+ ResTreeWidgetLayout = new QVBoxLayout( this, 11, 6, "ResTreeWidgetLayout");
+
+ m_Splitter = new QSplitter( this, "m_Splitter" );
+ m_Splitter->setOrientation( QSplitter::Vertical );
+
+ m_RevGraphView = new ResGraphView(m_Splitter, "m_RevGraphView" );
+ m_RevGraphView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 2, m_RevGraphView->sizePolicy().hasHeightForWidth() ) );
+ connect(m_RevGraphView,SIGNAL(dispDetails(const QString&)),this,SLOT(setDetailText(const QString&)));
+
+ m_Detailstext = new QTextBrowser( m_Splitter, "m_Detailstext" );
+ m_Detailstext->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, m_Detailstext->sizePolicy().hasHeightForWidth() ) );
+ m_Detailstext->setResizePolicy( QTextBrowser::Manual );
+ ResTreeWidgetLayout->addWidget( m_Splitter );
+// resize( QSize(600, 480).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+ResTreeWidget::~ResTreeWidget()
+{
+}
+
+void ResTreeWidget::dumpRevtree()
+{
+ m_RevGraphView->dumpRevtree();
+}
+
+void ResTreeWidget::setDetailText(const QString&_s)
+{
+ m_Detailstext->setText(_s);
+ QValueList<int> list = m_Splitter->sizes();
+ if (list.count()!=2) return;
+ if (list[1]==0) {
+ int h = height();
+ int th = h/10;
+ list[0]=h-th;
+ list[1]=th;
+ m_Splitter->setSizes(list);
+ }
+}
+
+#include "restreewidget.moc"
+
Added: branches/tmp/schubi/dialogsolver/src/restreewidget.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/restreewidget.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/restreewidget.h (added)
+++ branches/tmp/schubi/dialogsolver/src/restreewidget.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * Copyright (C) 2006-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 RESTREEWIDGET_H
+#define RESTREEWIDGET_H
+
+
+#include
+#include
+#include
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QSpacerItem;
+class ResGraphView;
+class QSplitter;
+class QTextBrowser;
+
+namespace svn {
+ class LogEntry;
+ class Client;
+}
+
+class ResTreeWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ResTreeWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~ResTreeWidget();
+
+ QSplitter* m_Splitter;
+ ResGraphView* m_RevGraphView;
+
+ void dumpRevtree();
+
+protected:
+ QVBoxLayout* ResTreeWidgetLayout;
+ QTextBrowser* m_Detailstext;
+
+
+protected slots:
+ virtual void setDetailText(const QString&);
+
+private:
+ QPixmap image0;
+
+};
+
+#endif // RESTREEWIDGET_H
Added: branches/tmp/schubi/dialogsolver/src/solvertree.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/solvertree.cpp?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/solvertree.cpp (added)
+++ branches/tmp/schubi/dialogsolver/src/solvertree.cpp Mon Jul 16 11:31:11 2007
@@ -0,0 +1,261 @@
+/***************************************************************************
+ * Copyright (C) 2005-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 <iostream>
+#include <fstream>
+#include <sstream>
+#include <streambuf>
+
+
+#include "solvertree.h"
+#include "restreewidget.h"
+#include "resgraphview.h"
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+class StreeData
+{
+public:
+ StreeData();
+ virtual ~StreeData();
+
+ QTime m_stopTick;
+
+ ResTreeWidget *m_TreeDisplay;
+
+};
+
+StreeData::StreeData()
+{
+ m_TreeDisplay = 0;
+}
+
+StreeData::~StreeData()
+{
+}
+
+
+
+SolverTree::SolverTree( QWidget*treeParent,
+ zypp::solver::detail::Resolver_Ptr r)
+ :m_Valid(false)
+ ,resolver(r)
+{
+ m_Data = new StreeData;
+
+ unsigned count = 0;
+ m_Data->m_stopTick.restart();
+ m_Data->m_TreeDisplay=new ResTreeWidget(treeParent);
+ m_Data->m_TreeDisplay->setMinimumSize ( 700, 700 );
+
+ if (resolver == NULL) { // testcase
+
+ QString n12 = "product2";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n12].name="SuSE Linux 10.2";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n12].kind="Product";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n12].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n12].version="4.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n12].description="Opensuse 10.2";
+
+ for (count=1; count <= 4 ; ++count) {
+
+ QString n2;
+
+ n2.setNum(count+1000);
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n12].targets.append(ResGraphView::targetData(n2));
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].name="Pattern " + n2;
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].kind="Pattern";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].version="1.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].description="Patterndescription for " + n2;
+
+
+ for (int count2=1; count2 <= 4 ; ++count2) {
+
+ QString n3;
+
+ n3.setNum(count*10+count2+1000);
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].targets.append(ResGraphView::targetData(n3));
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].name="Package " + n3;
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].kind="Package";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].version="1.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].description="Packagedescription for " + n3;
+
+ for (int count3=1; count3 <= count2 ; ++count3) {
+
+ QString n4;
+
+ n4.setNum(count*100+count2*10+count3+1000);
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].targets.append(ResGraphView::targetData(n4));
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].name="Package " + n4;
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].kind="Package";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].version="1.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].description="Packagedescription for " + n4;
+
+ }
+ }
+ }
+
+
+ QString n1 = "product";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n1].name="SuSE SLES10";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n1].kind="Product";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n1].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n1].version="4.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n1].description="Enterprise Server 10";
+
+ for (count=1; count <= 4 ; ++count) {
+
+ QString n2;
+
+ n2.setNum(count);
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n1].targets.append(ResGraphView::targetData(n2));
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].name="Pattern " + n2;
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].kind="Pattern";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].version="1.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].description="Patterndescription for " + n2;
+
+
+ for (int count2=1; count2 <= 4 ; ++count2) {
+
+ QString n3;
+
+ n3.setNum(count*10+count2);
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n2].targets.append(ResGraphView::targetData(n3));
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].name="Package " + n3;
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].kind="Package";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].version="1.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].description="Packagedescription for " + n3;
+
+ for (int count3=1; count3 <= count2 ; ++count3) {
+
+ QString n4;
+
+ n4.setNum(count*100+count2*10+count3);
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n3].targets.append(ResGraphView::targetData(n4));
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].name="Package " + n4;
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].kind="Package";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].source="nfs:://mounts/dist/....";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].version="1.0";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[n4].description="Packagedescription for " + n4;
+
+ }
+ }
+ }
+ } else {
+ int id = 0;
+ for (zypp::ResPool::const_iterator it = resolver->pool().begin();
+ it != resolver->pool().end();
+ ++it)
+ { // find all root items and generate
+ if (it->status().isToBeInstalled()) {
+
+ zypp::ResObject::constPtr r = it->resolvable();
+ bool rootfound = false;
+ zypp::solver::detail::ItemCapKindList isInstalledList = resolver->isInstalledBy (*it);
+ if (isInstalledList.empty()) {
+ rootfound = true;
+ } else {
+ rootfound = true;
+ for (zypp::solver::detail::ItemCapKindList::const_iterator isInstall = isInstalledList.begin();
+ isInstall != isInstalledList.end(); isInstall++) {
+ if (isInstall->initialInstallation) {
+ rootfound = false;
+ }
+ }
+ }
+
+ if (rootfound) {
+ zypp::ResObject::constPtr res = it->resolvable();
+ QString idStr = QString( "%1" ).arg( id++ );
+
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].name=res->name();
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].kind=res->kind().asString();
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].source="";
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].version=res->edition().asString()+"."+res->arch().asString();
+ m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].description=res->description();
+ // we have found a root; collect all trees
+ buildTree ( m_Data, m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].targets, *it, id);
+ }
+ }
+ }
+ }
+
+ m_Valid=true;
+ m_Data->m_TreeDisplay->dumpRevtree();
+}
+
+SolverTree::~SolverTree()
+{
+ delete m_Data;
+}
+
+
+bool SolverTree::isValid()const
+{
+ return m_Valid;
+}
+
+
+void SolverTree::buildTree ( StreeData *data, ResGraphView::tlist &childList, const zypp::PoolItem_Ref item, int &id) {
+ // generate the branches
+ zypp::solver::detail::ItemCapKindList installList = resolver->installs (item);
+ for (zypp::solver::detail::ItemCapKindList::const_iterator it = installList.begin();
+ it != installList.end(); it++) {
+ if (it->initialInstallation) {
+ // This item will REALLY triggered by the given root item (not only due required dependencies)
+ QString idStr = QString( "%1" ).arg( id++ );
+
+ childList.append(ResGraphView::targetData(idStr));
+ data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].name=it->item->name();
+ data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].kind=it->item->kind().asString();
+ data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].source="";
+ data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].version=it->item->edition().asString()+"."+it->item->arch().asString();
+ data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].description=it->item->description();
+
+ // we have found a root; collect all trees
+ buildTree ( data, data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].targets, it->item, id);
+ }
+ }
+}
+
+
+QWidget*SolverTree::getView()
+{
+ return m_Data->m_TreeDisplay;
+}
+
Added: branches/tmp/schubi/dialogsolver/src/solvertree.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/dialogsolver/src/solvertree.h?rev=6014&view=auto
==============================================================================
--- branches/tmp/schubi/dialogsolver/src/solvertree.h (added)
+++ branches/tmp/schubi/dialogsolver/src/solvertree.h Mon Jul 16 11:31:11 2007
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2005-2007 by Rajko Albrecht *
+ * ral@alwins-world.de *
+ * *
+ * 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 SOLVERTREE_H
+#define SOLVERTREE_H
+
+#include "zypp/solver/detail/Resolver.h"
+#include "resgraphview.h"
+
+class StreeData;
+class QWidget;
+
+/**
+ @author Rajko Albrecht
+*/
+class SolverTree{
+public:
+ SolverTree( QWidget*treeParent,
+ zypp::solver::detail::Resolver_Ptr r = NULL);
+ virtual ~SolverTree();
+
+ bool isValid()const;
+ QWidget*getView();
+
+protected:
+ bool m_Valid;
+ zypp::solver::detail::Resolver_Ptr resolver;
+ StreeData*m_Data;
+
+ void buildTree ( StreeData *data, ResGraphView::tlist &childList, const zypp::PoolItem_Ref item, int &id);
+
+};
+
+#endif
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org
|