CC-1695 Remove Campcaster Studio and make install easier

Started removing stuff.
This commit is contained in:
paul.baranowski 2010-09-30 13:31:38 -04:00
parent dfe86e4423
commit 3f5b1a1c92
482 changed files with 0 additions and 79963 deletions

View file

@ -1,89 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
#-------------------------------------------------------------------------------
package="Authentication"
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
usrdir=`cd $basedir/../../../usr; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
tmpdir=$basedir/tmp
cd "$tmpdir"
DIE=0
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
echo "Generating configuration files for $package, please wait...."
configure_ac=${etcdir}/configure.ac
configure=${tmpdir}/configure
aclocal_m4=${tmpdir}/aclocal.m4
# copy over configure.ac and acinlclude.m4 from etc to tmp,
# as aclocal >= 1.8 is sooo unbelivably stupid that it will simply try to
# look for configure.ac in the current directory, and include acinclude.m4
# in aclocal.m4 it without a directory path in front
ACLOCAL_FLAGS="-I ${tmpdir} --acdir=${tmpdir} --output=${aclocal_m4}"
echo " aclocal $ACLOCAL_FLAGS"
cp -f ${configure_ac} ${tmpdir}
cp -f ${etcdir}/acinclude.m4 ${tmpdir}
aclocal $ACLOCAL_FLAGS
echo " autoheader ${configure_ac}"
autoheader ${configure_ac}
echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}"
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}

View file

@ -1,75 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script generates code coverage data for the module
#-------------------------------------------------------------------------------
module="Campcaster Authentication"
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
docdir=$basedir/doc
tmpdir=$basedir/tmp
usrdir=`cd $basedir/../../../usr; pwd;`
coverage_report_dir=$docdir/coverage
raw_coverage_file=$tmpdir/raw_coverage.info
coverage_file=$tmpdir/coverage.info
lcov=$usrdir/bin/lcov
genhtml=$usrdir/bin/genhtml
cd $basedir
#-------------------------------------------------------------------------------
# Re-configure with covarege collection enabled, compile and run the tests
#-------------------------------------------------------------------------------
$bindir/autogen.sh --enable-coverage
make clean
make check
#-------------------------------------------------------------------------------
# Generate some symlinks so that the sources are visible from tmpdir
#-------------------------------------------------------------------------------
ln -s $basedir/include $tmpdir/include
ln -s $basedir/src $tmpdir/src
#-------------------------------------------------------------------------------
# Use lcov to generate an HTML report on the coverage data
#-------------------------------------------------------------------------------
$lcov -d $tmpdir -c > $raw_coverage_file
$lcov -e $raw_coverage_file "$tmpdir/*" > $coverage_file
rm -rf $coverage_report_dir
mkdir -p $coverage_report_dir
$genhtml -t "$module" -o $coverage_report_dir $coverage_file
#-------------------------------------------------------------------------------
# Clean up
#-------------------------------------------------------------------------------
rm -f $tmpdir/include
rm -f $tmpdir/src

View file

@ -1,47 +0,0 @@
#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this script to configure the environment.
#
# This script in effect calls the real automake / autoconf configure script
#-------------------------------------------------------------------------------
# assume we're in $basedir
reldir=`dirname $0`
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
bindir=$basedir/bin
tmpdir=$basedir/tmp
autogen=$bindir/autogen.sh
configure=$tmpdir/configure
if [ ! -x $configure ]; then
(cd $basedir && $autogen "$@")
fi
(cd $tmpdir && $configure "$@")

View file

@ -1 +0,0 @@
keep me

View file

@ -1,176 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# @configure_input@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# General command definitions
#-------------------------------------------------------------------------------
MKDIR = mkdir -p
RM = rm -f
RMDIR = rm -rf
DOXYGEN = doxygen
CP = cp -f
#-------------------------------------------------------------------------------
# Basic directory and file definitions
#-------------------------------------------------------------------------------
BASE_DIR = @builddir@
DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen
COVERAGE_DIR = ${DOC_DIR}/coverage
ETC_DIR = ${BASE_DIR}/etc
INCLUDE_DIR = ${BASE_DIR}/include
LIB_DIR = ${BASE_DIR}/lib
SRC_DIR = ${BASE_DIR}/src
TMP_DIR = ${BASE_DIR}/tmp
prefix = @prefix@
USR_DIR = ${prefix}
USR_INCLUDE_DIR = ${USR_DIR}/include
USR_LIB_DIR = ${USR_DIR}/lib
MODULES_DIR = ${BASE_DIR}/..
CORE_DIR = ${MODULES_DIR}/core
CORE_INCLUDE_DIR = ${CORE_DIR}/include
CORE_LIB_DIR = ${CORE_DIR}/lib
CORE_LIB = livesupport_core
CORE_LIB_FILE = ${CORE_LIB_DIR}/lib${CORE_LIB}.a
STORAGE_SERVER_DIR = ${MODULES_DIR}/storageServer
VPATH = ${SRC_DIR}
LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@
LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
TEST_RESULTS = ${DOC_DIR}/testResults.xml
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
TEST_XSLT = ../etc/testResultToHtml.xsl
AUTHENTICATION_LIB = livesupport_authentication
AUTHENTICATION_LIB_FILE = ${LIB_DIR}/lib${AUTHENTICATION_LIB}.a
TEST_RUNNER = ${TMP_DIR}/testRunner
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
export LD_LIBRARY_PATH:=${USR_LIB_DIR}:${LD_LIBRARY_PATH}
#-------------------------------------------------------------------------------
# Configuration parameters
#-------------------------------------------------------------------------------
CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \
-pedantic -Wall -Wno-long-long \
${LIBXMLPP_CFLAGS} \
-I${USR_INCLUDE_DIR} \
-I${CORE_INCLUDE_DIR} \
-I${INCLUDE_DIR} -I${TMP_DIR}
LDFLAGS = @LDFLAGS@ -pthread \
${LIBXMLPP_LIBS} \
-L${USR_LIB_DIR} \
-L${CORE_LIB_DIR} \
-L${LIB_DIR}
#-------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------
AUTHENTICATION_LIB_OBJS = ${TMP_DIR}/AuthenticationClientFactory.o \
${TMP_DIR}/TestAuthenticationClient.o \
${TMP_DIR}/WebAuthenticationClient.o
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
${TMP_DIR}/TestAuthenticationClientTest.o \
${TMP_DIR}/WebAuthenticationClientTest.o \
${TMP_DIR}/AuthenticationClientFactoryTest.o
TEST_RUNNER_LIBS = -l${AUTHENTICATION_LIB} -l${CORE_LIB} \
-lcppunit -ldl -lxmlrpc++ -lssl
#-------------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean check install
all: dir_setup ${AUTHENTICATION_LIB_FILE}
dir_setup: ${TMP_DIR} ${DOXYGEN_DIR}
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
clean:
${RM} ${AUTHENTICATION_LIB_OBJS} ${AUTHENTICATION_LIB_FILE}
${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER}
${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info
docclean:
${RMDIR} ${DOXYGEN_DIR}/html
${RMDIR} ${COVERAGE_DIR}/*
${RM} ${TEST_RESULTS}
depclean: clean
distclean: clean docclean
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te* ${TMP_DIR}/ac*.m4
check: all ${TEST_RUNNER}
${MAKE} -C ${STORAGE_SERVER_DIR}
${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT}
install: all
${MKDIR} ${USR_INCLUDE_DIR}/LiveSupport/Authentication
${CP} ${INCLUDE_DIR}/LiveSupport/Authentication/*.h \
${USR_INCLUDE_DIR}/LiveSupport/Authentication
${CP} ${AUTHENTICATION_LIB_FILE} ${USR_LIB_DIR}
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
${AUTHENTICATION_LIB_FILE}: ${AUTHENTICATION_LIB_OBJS}
${AR} crus $@ $^
${TMP_DIR}:
${MKDIR} ${TMP_DIR}
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${TEST_RUNNER}: ${CORE_LIB_FILE} ${TEST_RUNNER_OBJS} ${AUTHENTICATION_LIB_FILE}
${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS}
${CORE_LIB_FILE}:
${MAKE} -C ${CORE_DIR}
#-------------------------------------------------------------------------------
# Pattern rules
#-------------------------------------------------------------------------------
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<

View file

@ -1,87 +0,0 @@
dnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl Macro to check for available modules using pkg-conf
dnl
dnl usage:
dnl PKG_CHECK_MODULES(GSTUFF,[gtk+-2.0 >= 1.3], action-if, action-not)
dnl
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
dnl
dnl This function was taken from the glade-- project
dnl-----------------------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE authenticationClientFactory [
<!ELEMENT authenticationClientFactory (testAuthentication|
webAuthentication)>
<!ELEMENT testAuthentication (user) >
<!ELEMENT user EMPTY >
<!ATTLIST user login CDATA #REQUIRED >
<!ATTLIST user password CDATA #REQUIRED >
]>
<authenticationClientFactory>
<testAuthentication>
<user login="root" password="q" />
</testAuthentication>
</authenticationClientFactory>

View file

@ -1,104 +0,0 @@
dnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl NOTE: Run all configure related scripts from the tmp directory of the
dnl project.
dnl This is due to the fact that configure spreads a lot of trash around,
dnl like atom4te cache directories, config.* files, etc. into the directory
dnl it is being run from. We clearly don't want these in our base directory.
dnl-----------------------------------------------------------------------------
AC_INIT(Authentication, 0.0, support@sourcefabric.org)
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL])
AC_REVISION($Revision$)
AC_CONFIG_SRCDIR(../src/AuthenticationClientFactory.cxx)
AC_CONFIG_HEADERS(configure.h)
AC_PROG_CXX()
AC_CHECK_HEADERS(getopt.h)
dnl-----------------------------------------------------------------------------
dnl specify whether debug info should be compiled into the executable
dnl-----------------------------------------------------------------------------
AC_SUBST(CXXFLAGS)
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [compile with debug info (no)]),
[],
[enable_debug=no])
if test "x${enable_debug}" = "xyes"; then
CXXFLAGS="-g -O0"
AC_DEFINE( YDEBUG, 1, [Debug is on] )
else
CXXFLAGS="-O3"
fi
AC_MSG_RESULT([using compiler options: ${CXXFLAGS}])
dnl-----------------------------------------------------------------------------
dnl specify the pkg-config path
dnl-----------------------------------------------------------------------------
AC_ARG_WITH([pkg-config-path],
AC_HELP_STRING([--with-pkg-config-path],
[use the pkg-config path (prefix/lib/pkgconfig)]),
[PKG_CONFIG_PATH=${withval}],
[PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:$PKG_CONFIG_PATH])
AC_MSG_RESULT([using pkg-config path: ${PKG_CONFIG_PATH}])
export PKG_CONFIG_PATH
export PATH=${prefix}/bin:${PATH}
PKG_CHECK_MODULES(LIBXMLPP,[libxml++-2.6 >= 2.8.1])
AC_SUBST(LIBXMLPP_CFLAGS)
AC_SUBST(LIBXMLPP_LIBS)
dnl-----------------------------------------------------------------------------
dnl enable compilaton for code coverage data
dnl-----------------------------------------------------------------------------
AC_SUBST(COVERAGE_CXXFLAGS)
AC_ARG_ENABLE( coverage,
[ --enable-coverage enable code coverage data generaton (no) ],
ENABLE_COVERAGE=${enableval}, ENABLE_COVERAGE="no" )
if test "x${ENABLE_COVERAGE}" == "xyes" ; then
COVERAGE_CXXFLAGS="-fprofile-arcs -ftest-coverage"
AC_MSG_RESULT([compiling in code coverage mode])
else
AC_MSG_RESULT([not compiling in code coverage mode])
fi
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
AC_OUTPUT()

File diff suppressed because it is too large Load diff

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE testAuthentication [
<!ELEMENT testAuthentication (user) >
<!ELEMENT user EMPTY >
<!ATTLIST user login CDATA #REQUIRED >
<!ATTLIST user password CDATA #REQUIRED >
]>
<testAuthentication>
<user login="root" password="q" />
</testAuthentication>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE webAuthentication [
<!ELEMENT webAuthentication (location) >
<!ELEMENT location EMPTY >
<!ATTLIST location server CDATA #REQUIRED >
<!ATTLIST location port NMTOKEN #REQUIRED >
<!ATTLIST location path CDATA #REQUIRED >
]>
<webAuthentication>
<location server="localhost" port="80"
path="/campcasterStorageServer/xmlrpc/xrLocStor.php" />
</webAuthentication>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE webAuthentication [
<!ELEMENT webAuthentication (location) >
<!ELEMENT location EMPTY >
<!ATTLIST location server CDATA #REQUIRED >
<!ATTLIST location port NMTOKEN #REQUIRED >
<!ATTLIST location path CDATA #REQUIRED >
]>
<webAuthentication>
<location server="ls_php_host" port="ls_php_port"
path="/ls_php_urlPrefix/storageServer/var/ls_alib_xmlRpcPrefix"/>
</webAuthentication>

View file

@ -1,187 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Authentication_AuthenticationClientFactory_h
#define LiveSupport_Authentication_AuthenticationClientFactory_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Authentication/AuthenticationClientInterface.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* The factory to create AuthenticationClientInterface objects.
*
* This object has to be configured with an XML configuration element
* called authenticationClientFactory. This element contains a child element
* specifying and configuring the kind of AuthenticationClient that the
* factory builds. This client is either a TestAuthenticationClient or
* a WebAuthenticationClient, and the child element name is either
* testAuthentication or webAuthentication, correspondingly.
*
* An authenticationClientFactory configuration element may look like
* the following:
*
* <pre><code>
* &lt;authenticationClientFactory&gt;
* &lt;webAuthentication&gt;
* ...
* &lt;/webAuthentication&gt;
* &lt;/authenticationClientFactory&gt;
* </code></pre>
*
* For detais of the testAuthentication and webAuthentication elements, see the
* documentation for the TestAuthenticationClient and WebAuthenticationClient
* classes.
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT authenticationClientFactory (testAuthentication|
* webAuthentication) &gt;
* </code></pre>
*
* @see TestAuthenticationClient
* @see WebAuthenticationClient
*/
class AuthenticationClientFactory :
virtual public Configurable
{
private:
/**
* The name of the configuration XML elmenent used by this object.
*/
static const std::string configElementNameStr;
/**
* The singleton instance of this object.
*/
static Ptr<AuthenticationClientFactory>::Ref singleton;
/**
* The authentication client created by this factory.
*/
Ptr<AuthenticationClientInterface>::Ref authenticationClient;
/**
* The default constructor.
*/
AuthenticationClientFactory(void) throw()
{
}
public:
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~AuthenticationClientFactory(void) throw ()
{
}
/**
* Return the name of the XML element this object expects
* to be sent to a call to configure().
*
* @return the name of the expected XML configuration element.
*/
static const std::string
getConfigElementName(void) throw ()
{
return configElementNameStr;
}
/**
* Returns the singleton instance of this object.
*
* @return the singleton instance of this object.
*/
static Ptr<AuthenticationClientFactory>::Ref
getInstance() throw ();
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the object has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error);
/**
* Return an authentication client.
*
* @return the appropriate authentication client, according to the
* configuration of this factory.
*/
Ptr<AuthenticationClientInterface>::Ref
getAuthenticationClient(void) throw ()
{
return authenticationClient;
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // LiveSupport_Authentication_AuthenticationClientFactory_h

View file

@ -1,231 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Authentication_AuthenticationClientInterface_h
#define LiveSupport_Authentication_AuthenticationClientInterface_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <glibmm/ustring.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Core/XmlRpcException.h"
#include "LiveSupport/Core/XmlRpcInvalidArgumentException.h"
#include "LiveSupport/Core/XmlRpcCommunicationException.h"
#include "LiveSupport/Core/XmlRpcMethodFaultException.h"
#include "LiveSupport/Core/XmlRpcMethodResponseException.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* An interface for authentication clients.
*/
class AuthenticationClientInterface
{
public:
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException)
= 0;
/**
* Login to the authentication server.
* Returns a new session ID; in case of an error, throws
* AuthenticationException or one of its subclasses.
* Note that an incorrect login or password is considered an error
* and will throw an XmlRpcException (in the case of WebStorageClient,
* an XmlRpcMethodFaultException, which is also an XmlRpcException).
*
* @param login the login to the server
* @param password the password to the server
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @exception XmlRpcException other error
* (TestAuthenticationClient only)
* @return the new session ID
*/
virtual Ptr<SessionId>::Ref
login(const std::string &login, const std::string &password)
throw (XmlRpcException)
= 0;
/**
* Logout from the authentication server.
*
* @param sessionId the ID of the session to end
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @exception XmlRpcException other error
* (TestAuthenticationClient only)
*/
virtual void
logout(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException)
= 0;
/**
* Load a `user preferences' item from the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
*
* @exception std::invalid_argument
* no such preference key found
* @exception XmlRpcInvalidArgumentException
* bad sessionId argument
* @exception XmlRpcCommunicationException
* problem with performing XML-RPC call
* @exception XmlRpcMethodFaultException
* XML-RPC method returned fault response
* @exception XmlRpcMethodResponseException
* response from XML-RPC method is incorrect
* @exception XmlRpcException other error
* (TestAuthenticationClient only)
*/
virtual Ptr<Glib::ustring>::Ref
loadPreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException,
std::invalid_argument)
= 0;
/**
* Store a `user preferences' item on the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
* @param value the (new) value of the item
*
* @exception XmlRpcInvalidArgumentException
* bad sessionId or value argument
* @exception XmlRpcCommunicationException
* problem with performing XML-RPC call
* @exception XmlRpcMethodFaultException
* XML-RPC method returned fault response
* @exception XmlRpcMethodResponseException
* response from XML-RPC method is incorrect
* @exception XmlRpcException other error
* (TestAuthenticationClient only)
*/
virtual void
savePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key,
Ptr<const Glib::ustring>::Ref value)
throw (XmlRpcException)
= 0;
/**
* Delete a `user preferences' item from the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
*
* @exception XmlRpcInvalidArgumentException
* bad sessionId argument
* @exception XmlRpcCommunicationException
* problem with performing XML-RPC call
* @exception XmlRpcMethodFaultException
* XML-RPC method returned fault response
* @exception XmlRpcMethodResponseException
* response from XML-RPC method is incorrect
* @exception XmlRpcException other error
* (TestAuthenticationClient only)
*/
virtual void
deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException)
= 0;
/**
* Reset the authentication client.
* Invalidates all active session IDs, and resets the list of
* preferences to its initial (empty) state.
*
* @exception XmlRpcException if the server returns an error.
*/
virtual void
reset(void)
throw (XmlRpcException)
= 0;
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~AuthenticationClientInterface(void) throw ()
{
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // LiveSupport_Authentication_AuthenticationClientInterface_h

View file

@ -1 +0,0 @@
keep me

View file

@ -1,117 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "TestAuthenticationClient.h"
#include "WebAuthenticationClient.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Authentication;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/*------------------------------------------------------------------------------
* The name of the config element for this class
*----------------------------------------------------------------------------*/
const std::string AuthenticationClientFactory::configElementNameStr =
"authenticationClientFactory";
/*------------------------------------------------------------------------------
* The singleton instance of AuthenticationClientFactory
*----------------------------------------------------------------------------*/
Ptr<AuthenticationClientFactory>::Ref AuthenticationClientFactory::singleton;
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Return the singleton instance to AuthenticationClientFactory
*----------------------------------------------------------------------------*/
Ptr<AuthenticationClientFactory>::Ref
AuthenticationClientFactory :: getInstance(void) throw ()
{
if (!singleton.get()) {
singleton.reset(new AuthenticationClientFactory());
}
return singleton;
}
/*------------------------------------------------------------------------------
* Configure the test authentication client.
*----------------------------------------------------------------------------*/
void
AuthenticationClientFactory :: configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error)
{
if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element ";
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
authenticationClient.reset();
// try to look for a TestAuthenticationClient configuration element
xmlpp::Node::NodeList nodes =
element.get_children(TestAuthenticationClient::getConfigElementName());
if (nodes.size() >= 1) {
const xmlpp::Element * configElement =
dynamic_cast<const xmlpp::Element*> (*(nodes.begin()));
Ptr<TestAuthenticationClient>::Ref tac(new TestAuthenticationClient());
tac->configure(*configElement);
authenticationClient = tac;
return;
}
// try to look for a WebAuthenticationClient configuration element
nodes =
element.get_children(WebAuthenticationClient::getConfigElementName());
if (nodes.size() >= 1) {
const xmlpp::Element * configElement =
dynamic_cast<const xmlpp::Element*> (*(nodes.begin()));
Ptr<WebAuthenticationClient>::Ref wac(new WebAuthenticationClient());
wac->configure(*configElement);
authenticationClient = wac;
return;
}
throw std::invalid_argument("no authentication client configuration found");
}

View file

@ -1,252 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <string>
#include <fstream>
#include <iostream>
#include "LiveSupport/Core/SessionId.h"
#include "AuthenticationClientFactoryTest.h"
using namespace std;
using namespace LiveSupport::Core;
using namespace LiveSupport::Authentication;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
CPPUNIT_TEST_SUITE_REGISTRATION(AuthenticationClientFactoryTest);
/**
* The name of the configuration file for the authentication client factory.
*/
static const std::string configFileName = "authenticationClient.xml";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Set up the test environment
*----------------------------------------------------------------------------*/
void
AuthenticationClientFactoryTest :: setUp(void) throw ()
{
Ptr<AuthenticationClientFactory>::Ref
acf = AuthenticationClientFactory::getInstance();
try {
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
acf->configure(*root);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL("error parsing configuration file");
}
}
/*------------------------------------------------------------------------------
* Clean up the test environment
*----------------------------------------------------------------------------*/
void
AuthenticationClientFactoryTest :: tearDown(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Test to see if we can log on and off
*----------------------------------------------------------------------------*/
void
AuthenticationClientFactoryTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<AuthenticationClientFactory>::Ref
acf = AuthenticationClientFactory::getInstance();
Ptr<AuthenticationClientInterface>::Ref
authentication = acf->getAuthenticationClient();
CPPUNIT_ASSERT_NO_THROW(
authentication->reset()
);
Ptr<SessionId>::Ref sessionId;
try {
sessionId = authentication->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(sessionId);
try {
authentication->logout(sessionId);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
}
/*------------------------------------------------------------------------------
* Test to see if we can save and load user preferences.
*----------------------------------------------------------------------------*/
void
AuthenticationClientFactoryTest :: preferencesTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<AuthenticationClientFactory>::Ref
acf = AuthenticationClientFactory::getInstance();
Ptr<AuthenticationClientInterface>::Ref
authentication = acf->getAuthenticationClient();
CPPUNIT_ASSERT_NO_THROW(
authentication->reset()
);
Ptr<SessionId>::Ref sessionId;
Ptr<const Glib::ustring>::Ref prefValue;
// check "please log in" error
try {
prefValue = authentication->loadPreferencesItem(sessionId, "something");
CPPUNIT_FAIL("Allowed operation without login.");
} catch (XmlRpcException &e) {
}
// log in
try {
sessionId = authentication->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// check "no such key" error
try {
prefValue = authentication->loadPreferencesItem(sessionId, "eye_color");
CPPUNIT_FAIL("Retrieved non-existent user preferences item.");
} catch (std::invalid_argument &e) {
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// check normal save and load
prefValue.reset(new const Glib::ustring("chyornye"));
try {
authentication->savePreferencesItem(sessionId, "eye_color", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
Ptr<const Glib::ustring>::Ref newPrefValue;
try {
newPrefValue = authentication->loadPreferencesItem(sessionId, "eye_color");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
// try some unicode characters
prefValue.reset(new const Glib::ustring("страстные"));
try {
authentication->savePreferencesItem(sessionId, "eye_color", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = authentication->loadPreferencesItem(sessionId, "eye_color");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == "страстные");
// check another normal save and load...
prefValue.reset(new const Glib::ustring("ne dobryj"));
try {
authentication->savePreferencesItem(sessionId, "hour", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// ... but now change session ID in the middle
try {
authentication->logout(sessionId);
sessionId = authentication->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = authentication->loadPreferencesItem(sessionId, "hour");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
// check the delete method
try {
authentication->deletePreferencesItem(sessionId, "hour");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = authentication->loadPreferencesItem(sessionId, "hour");
CPPUNIT_FAIL("Allowed to load preference after it was deleted");
} catch (std::invalid_argument &e) {
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// and log out
try {
authentication->logout(sessionId);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
}

View file

@ -1,113 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef AuthenticationClientFactoryTest_h
#define AuthenticationClientFactoryTest_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Unit test for the AuthenticationClientFactory class.
*
* @see AuthenticationClientFactory
*/
class AuthenticationClientFactoryTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(AuthenticationClientFactoryTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END();
protected:
/**
* A simple test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test saving and load of user preferences.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
preferencesTest(void) throw (CPPUNIT_NS::Exception);
public:
/**
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
/**
* Clean up the environment after the test case.
*/
void
tearDown(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // AuthenticationClientFactoryTest_h

View file

@ -1,294 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <fstream>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <XmlRpcClient.h>
#include <XmlRpcValue.h>
#include "TestAuthenticationClient.h"
using namespace boost::posix_time;
using namespace XmlRpc;
using namespace LiveSupport::Core;
using namespace LiveSupport::Authentication;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ configuration file constants */
/*------------------------------------------------------------------------------
* The name of the config element for this class
*----------------------------------------------------------------------------*/
const std::string TestAuthenticationClient::configElementNameStr
= "testAuthentication";
namespace {
/*------------------------------------------------------------------------------
* The name of the config child element for the login and password
*----------------------------------------------------------------------------*/
const std::string userConfigElementName = "user";
/*------------------------------------------------------------------------------
* The name of the config element attribute for the login
*----------------------------------------------------------------------------*/
const std::string userLoginAttrName = "login";
/*------------------------------------------------------------------------------
* The name of the config element attribute for the password
*----------------------------------------------------------------------------*/
const std::string userPasswordAttrName = "password";
/*------------------------------------------------------------------------------
* The dummy sessionId string returned by this authentication client
*----------------------------------------------------------------------------*/
const std::string dummySessionIdString = "dummySessionId";
/*------------------------------------------------------------------------------
* The version string, returned by getVersion
*----------------------------------------------------------------------------*/
const std::string versionStr = "TestAuthentication";
}
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Configure the test storage client.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClient :: configure(const xmlpp::Element & element)
throw (std::invalid_argument)
{
if (element.get_name() != configElementNameStr) {
std::string eMsg = "bad configuration element ";
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
const xmlpp::Attribute * attribute = 0;
// read the user data
xmlpp::Node::NodeList childNodes
= element.get_children(userConfigElementName);
xmlpp::Node::NodeList::iterator it = childNodes.begin();
if (it == childNodes.end()) {
std::string eMsg = "missing ";
eMsg += userConfigElementName;
eMsg += " XML element";
throw std::invalid_argument(eMsg);
}
const xmlpp::Element * userConfigElement
= dynamic_cast<const xmlpp::Element*> (*it);
if (!(attribute = userConfigElement
->get_attribute(userLoginAttrName))) {
std::string eMsg = "missing attribute ";
eMsg += userLoginAttrName;
throw std::invalid_argument(eMsg);
}
userLogin = attribute->get_value();
if (!(attribute = userConfigElement
->get_attribute(userPasswordAttrName))) {
std::string eMsg = "missing attribute ";
eMsg += userPasswordAttrName;
throw std::invalid_argument(eMsg);
}
userPassword = attribute->get_value();
++it;
if (it != childNodes.end()) {
std::string eMsg = "more than one ";
eMsg += userConfigElementName;
eMsg += " XML element";
throw std::invalid_argument(eMsg);
}
versionString.reset(new Glib::ustring(versionStr));
sessionIdList.clear();
sessionCounter = 0;
}
/*------------------------------------------------------------------------------
* Return the version string of the test storage.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
TestAuthenticationClient :: getVersion(void)
throw (Core::XmlRpcException)
{
return versionString;
}
/*------------------------------------------------------------------------------
* Login to the authentication server.
*----------------------------------------------------------------------------*/
Ptr<SessionId>::Ref
TestAuthenticationClient :: login(const std::string & login,
const std::string & password)
throw (XmlRpcException)
{
Ptr<SessionId>::Ref sessionId;
if (login == userLogin && password == userPassword) {
std::stringstream sessionIdStream;
sessionIdStream << dummySessionIdString
<< sessionCounter++
<< '-'
<< rand();
sessionIdList.insert(sessionIdStream.str());
sessionId.reset(new SessionId(sessionIdStream.str()));
return sessionId;
} else {
throw XmlRpcException("incorrect login or password");
}
}
/*------------------------------------------------------------------------------
* Logout from the authentication server.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException)
{
// this returns the number of entries found and erased
if (!sessionId || sessionIdList.erase(sessionId->getId())) {
return;
} else {
throw XmlRpcException("logout() called without previous login()");
}
}
/*------------------------------------------------------------------------------
* Load a `user preferences' item from the server.
*----------------------------------------------------------------------------*/
Ptr<Glib::ustring>::Ref
TestAuthenticationClient :: loadPreferencesItem(
Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException,
std::invalid_argument)
{
if (!sessionId
|| sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
throw XmlRpcException("bad session ID");
}
PreferencesType::iterator it;
if ((it = preferences.find(key)) == preferences.end()) {
throw std::invalid_argument("no such user preferences item");
}
Ptr<Glib::ustring>::Ref value(new Glib::ustring(*it->second));
return value;
}
/*------------------------------------------------------------------------------
* Store a `user preferences' item on the server.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClient :: savePreferencesItem(
Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key,
Ptr<const Glib::ustring>::Ref value)
throw (XmlRpcException)
{
if (!sessionId
|| sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
throw XmlRpcException("bad session ID");
}
if (sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
throw XmlRpcException("loadPreferences() called before login()");
}
preferences[key] = value;
}
/*------------------------------------------------------------------------------
* Delete a `user preferences' item from the server.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClient :: deletePreferencesItem(
Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException)
{
if (!sessionId
|| sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
throw XmlRpcException("bad session ID");
}
PreferencesType::iterator it;
if ((it = preferences.find(key)) == preferences.end()) {
throw XmlRpcException("no such user preferences item");
}
preferences.erase(it);
}
/*------------------------------------------------------------------------------
* Reset the list of preferences to its initial (empty) state.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClient :: reset(void)
throw (XmlRpcException)
{
sessionIdList.clear();
sessionCounter = 0;
preferences.clear();
}

View file

@ -1,280 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef TestAuthenticationClient_h
#define TestAuthenticationClient_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <string>
#include <set>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Authentication/AuthenticationClientInterface.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A dummy authentication client. It only supports one user, whose name and
* password are read from a configuration file. It issues session IDs when
* login() is called, and deletes these session IDs when logout() is called.
* It also stores (key, value) pairs of user preferences for this one user.
*
* This object has to be configured with an XML configuration element
* called testAuthentication. This element contains a child element
* specifying the login and password.
*
* A testAuthentication configuration element may look like the following:
*
* <pre><code>
* &lt;testAuthentication&gt;
* &lt;user
* login="root"
* password="q"
* /&gt;
* &lt;/testAuthentication&gt;
* </code></pre>
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT testAuthentication (user) &gt;
* &lt;!ELEMENT user EMPTY &gt;
* &lt;!ATTLIST user login CDATA #REQUIRED &gt;
* &lt;!ATTLIST user password CDATA #REQUIRED &gt;
* </code></pre>
*/
class TestAuthenticationClient :
virtual public Configurable,
virtual public AuthenticationClientInterface
{
private:
/**
* The name of the configuration XML elmenent used by
* TestAuthenticationClient
*/
static const std::string configElementNameStr;
/**
* The version string of the test storage client.
*/
Ptr<const Glib::ustring>::Ref versionString;
/**
* The login name of the (one) authorized test user.
*/
std::string userLogin;
/**
* The password for the test user.
*/
std::string userPassword;
/**
* A type for the list of sessionId's.
*/
typedef std::set<std::string>
SessionIdListType;
/**
* A list of the sessionId's we have issued.
*/
SessionIdListType sessionIdList;
/**
* The number of the sessionId's we have issued.
*/
int sessionCounter;
/**
* A type for the list of user preferences.
*/
typedef std::map<const Glib::ustring, Ptr<const Glib::ustring>::Ref>
PreferencesType;
/**
* A list of the user preferences items stored.
*/
PreferencesType preferences;
public:
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~TestAuthenticationClient(void) throw ()
{
}
/**
* Return the name of the XML element this object expects
* to be sent to a call to configure().
*
* @return the name of the expected XML configuration element.
*/
static const std::string
getConfigElementName(void) throw ()
{
return configElementNameStr;
}
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the scheduler daemon has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument);
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException);
/**
* Login to the authentication server, using the data read from the
* configuration file.
* Returns a new session ID; in case of an error, returns a
* null pointer.
* Note that an incorrect login or password is considered an error
* and will throw an XmlRpcException.
*
* @return the new session ID
* @exception XmlRpcException login or password is incorrect
* (does not match those given in the configuration file)
*/
virtual Ptr<SessionId>::Ref
login(const std::string &login, const std::string &password)
throw (XmlRpcException);
/**
* Logout from the authentication server.
*
* @param sessionId the ID of the session to end
* @exception XmlRpcException the sessionId does not match
* one issued by login()
*/
virtual void
logout(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException);
/**
* Load a `user preferences' item from the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
* @exception XmlRpcException invalid session ID
* @exception std::invalid_argument no such preference key found
*/
virtual Ptr<Glib::ustring>::Ref
loadPreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException,
std::invalid_argument);
/**
* Store a `user preferences' item on the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
* @param value the (new) value of the item
* @exception XmlRpcException invalid session ID
*/
virtual void
savePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key,
Ptr<const Glib::ustring>::Ref value)
throw (XmlRpcException);
/**
* Delete a `user preferences' item from the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
* @exception XmlRpcException invalid session ID, or no such key
*/
virtual void
deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException);
/**
* Reset the authentication client.
* Invalidates all active session IDs, and resets the list of
* preferences to its initial (empty) state.
*
* @exception XmlRpcException if the server returns an error.
*/
virtual void
reset(void)
throw (XmlRpcException);
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // TestAuthenticationClient_h

View file

@ -1,271 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <string>
#include <fstream>
#include <iostream>
#include "LiveSupport/Core/SessionId.h"
#include "TestAuthenticationClientTest.h"
using namespace std;
using namespace LiveSupport::Core;
using namespace LiveSupport::Authentication;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
CPPUNIT_TEST_SUITE_REGISTRATION(TestAuthenticationClientTest);
/**
* The name of the configuration file for the authentication client factory.
*/
static const std::string configFileName = "../etc/testAuthentication.xml";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Set up the test environment
*----------------------------------------------------------------------------*/
void
TestAuthenticationClientTest :: setUp(void) throw ()
{
try {
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
tac.reset(new TestAuthenticationClient());
tac->configure(*root);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL("error parsing configuration file");
}
}
/*------------------------------------------------------------------------------
* Clean up the test environment
*----------------------------------------------------------------------------*/
void
TestAuthenticationClientTest :: tearDown(void) throw ()
{
tac.reset();
}
/*------------------------------------------------------------------------------
* Test to see if we can log on and off
*----------------------------------------------------------------------------*/
void
TestAuthenticationClientTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<SessionId>::Ref sessionId;
try {
sessionId = tac->login("Piszkos Fred", "malnaszor");
CPPUNIT_FAIL("Allowed login with incorrect login and password.");
} catch (XmlRpcException &e) {
}
// TODO: this call writes some garbage to cerr; it should be told not to
sessionId.reset(new SessionId("ceci n'est pas un session ID"));
try {
tac->logout(sessionId);
CPPUNIT_FAIL("Allowed logout without previous login.");
} catch (XmlRpcException &e) {
}
try {
sessionId = tac->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
tac->logout(sessionId);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
tac->logout(sessionId);
CPPUNIT_FAIL("Allowed to logout twice.");
} catch (XmlRpcException &e) {
}
}
/*------------------------------------------------------------------------------
* Test the getVersion function
*----------------------------------------------------------------------------*/
void
TestAuthenticationClientTest :: getVersionTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<const Glib::ustring>::Ref version;
try {
version = tac->getVersion();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(version.get());
CPPUNIT_ASSERT(*version == "TestAuthentication");
}
/*------------------------------------------------------------------------------
* Test to see if we can save and load user preferences.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClientTest :: preferencesTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<SessionId>::Ref sessionId;
Ptr<const Glib::ustring>::Ref prefValue;
// check "please log in" error
try {
prefValue = tac->loadPreferencesItem(sessionId, "something");
CPPUNIT_FAIL("Allowed operation without login.");
} catch (XmlRpcException &e) {
}
// log in
try {
sessionId = tac->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// check "no such key" error
try {
prefValue = tac->loadPreferencesItem(sessionId, "eye_color");
CPPUNIT_FAIL("Retrieved non-existent user preferences item.");
} catch (std::invalid_argument &e) {
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// check normal save and load
prefValue.reset(new const Glib::ustring("chyornye"));
try {
tac->savePreferencesItem(sessionId, "eye_color", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
Ptr<const Glib::ustring>::Ref newPrefValue;
try {
newPrefValue = tac->loadPreferencesItem(sessionId, "eye_color");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
// try some unicode characters
prefValue.reset(new const Glib::ustring("страстные"));
try {
tac->savePreferencesItem(sessionId, "eye_color", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = tac->loadPreferencesItem(sessionId, "eye_color");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == "страстные");
// check another normal save and load...
prefValue.reset(new const Glib::ustring("ne dobryj"));
try {
tac->savePreferencesItem(sessionId, "hour", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// ... but now change session ID in the middle
try {
tac->logout(sessionId);
sessionId = tac->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = tac->loadPreferencesItem(sessionId, "hour");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
// check the delete method
try {
tac->deletePreferencesItem(sessionId, "hour");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = tac->loadPreferencesItem(sessionId, "hour");
CPPUNIT_FAIL("Allowed to load preference after it was deleted");
} catch (std::invalid_argument &e) {
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// and log out
try {
tac->logout(sessionId);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
}

View file

@ -1,128 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef TestAuthenticationClientTest_h
#define TestAuthenticationClientTest_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
#include "TestAuthenticationClient.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Unit test for the TestAuthenticationClient class.
*
* @see TestAuthenticationClient
*/
class TestAuthenticationClientTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(TestAuthenticationClientTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END();
private:
/**
* The TestAuthenticationClient instance to test.
*/
Ptr<TestAuthenticationClient>::Ref tac;
protected:
/**
* A simple test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test the gerVersion() function.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
getVersionTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test saving and load of user preferences.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
preferencesTest(void) throw (CPPUNIT_NS::Exception);
public:
/**
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
/**
* Clean up the environment after the test case.
*/
void
tearDown(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // TestAuthenticationClientTest_h

View file

@ -1,276 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#if HAVE_GETOPT_H
#include <getopt.h>
#else
#error "Need getopt.h"
#endif
#include <fstream>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/XmlOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include "LiveSupport/Core/Ptr.h"
using namespace LiveSupport::Core;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/**
* Our copyright notice, should be at most 80 columns
*/
static const char copyrightNotice[] =
"Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL";
/**
* String describing the short options.
*/
static const char options[] = "ho:s:v";
/**
* Structure describing the long options
*/
static const struct option longOptions[] = {
{ "help", no_argument, 0, 'h' },
{ "output", required_argument, 0, 'o' },
{ "stylesheet", required_argument, 0, 's' },
{ "version", no_argument, 0, 'v' },
{ 0, 0, 0, 0 }
};
/**
* The encoding to use for the output file.
*/
static const std::string encoding = "utf-8";
/**
* The output XML file name.
*/
static Ptr<std::string>::Ref xmlOutFileName;
/**
* The XSLT attached to the output file.
*/
static Ptr<std::string>::Ref xsltFileName;
/* =============================================== local function prototypes */
/**
* Print program version.
*
* @param os the std::ostream to print to.
*/
static void
printVersion ( std::ostream & os );
/**
* Print program usage information.
*
* @param invocation the command line command used to invoke this program.
* @param os the std::ostream to print to.
*/
static void
printUsage ( const char invocation[],
std::ostream & os );
/**
* Process command line arguments.
*
* @param argc the number of arguments.
* @param argv the arguments themselves.
* @return true of all went well, false in case the program should exit
* after this call.
*/
static bool
processArguments(int argc, char *argv[]);
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Run all tests
*----------------------------------------------------------------------------*/
int
main( int argc,
char * argv[] ) throw ()
{
if (!processArguments(argc, argv)) {
return 0;
}
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.setLocationFormat("%p:%l:");
outputter.write();
// also generate an XML document as an output
std::ofstream xmlOutFile(xmlOutFileName->c_str());
CPPUNIT_NS::XmlOutputter xmlOutputter(&result, xmlOutFile, encoding);
xmlOutputter.setStandalone(false);
if (xsltFileName) {
xmlOutputter.setStyleSheet(*xsltFileName);
}
xmlOutputter.write();
xmlOutFile.flush();
xmlOutFile.close();
return result.wasSuccessful() ? 0 : 1;
}
/*------------------------------------------------------------------------------
* Process command line arguments.
*----------------------------------------------------------------------------*/
static bool
processArguments(int argc, char *argv[])
{
int i;
while ((i = getopt_long(argc, argv, options, longOptions, 0)) != -1) {
switch (i) {
case 'h':
printUsage(argv[0], std::cout);
return false;
case 'o':
xmlOutFileName.reset(new std::string(optarg));
break;
case 's':
xsltFileName.reset(new std::string(optarg));
break;
case 'v':
printVersion(std::cout);
return false;
default:
printUsage(argv[0], std::cout);
return false;
}
}
if (optind < argc) {
std::cerr << "error processing command line arguments" << std::endl;
printUsage(argv[0], std::cout);
return false;
}
if (!xmlOutFileName) {
std::cerr << "mandatory option output file name not specified"
<< std::endl;
printUsage(argv[0], std::cout);
return false;
}
std::cerr << "writing output to '" << *xmlOutFileName << '\'' << std::endl;
if (xsltFileName) {
std::cerr << "using XSLT file '" << *xsltFileName << '\'' << std::endl;
}
return true;
}
/*------------------------------------------------------------------------------
* Print program version.
*----------------------------------------------------------------------------*/
static void
printVersion ( std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
<< "Unit test runner" << std::endl
<< copyrightNotice << std::endl;
}
/*------------------------------------------------------------------------------
* Print program usage.
*----------------------------------------------------------------------------*/
static void
printUsage ( const char invocation[],
std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
<< "Unit test runner" << std::endl
<< std::endl
<< "Usage: " << invocation << " [OPTION]"
<< std::endl
<< " mandatory options:" << std::endl
<< " -o, --output=file.name write test results into this XML file"
<< std::endl
<< " optional options:" << std::endl
<< " -s, --stylesheet specify this XSLT for the output file"
<< std::endl
<< " this is either an absolute URI, or a"
<< std::endl
<< " relative path for the output document"
<< std::endl
<< " -h, --help display this help and exit" << std::endl
<< " -v, --version display version information and exit"
<< std::endl
<< std::endl
<< "Report bugs to " << PACKAGE_BUGREPORT << std::endl;
}

View file

@ -1,658 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <fstream>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <XmlRpcClient.h>
#include <XmlRpcValue.h>
#include "WebAuthenticationClient.h"
using namespace boost::posix_time;
using namespace XmlRpc;
using namespace LiveSupport::Core;
using namespace LiveSupport::Authentication;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ configuration file constants */
/*------------------------------------------------------------------------------
* The name of the config element for this class
*----------------------------------------------------------------------------*/
const std::string WebAuthenticationClient::configElementNameStr
= "webAuthentication";
namespace {
/*------------------------------------------------------------------------------
* The name of the config child element for the authentication server location
*----------------------------------------------------------------------------*/
const std::string locationConfigElementName = "location";
/*------------------------------------------------------------------------------
* The name of the config element attribute for the server name
*----------------------------------------------------------------------------*/
const std::string locationServerAttrName = "server";
/*------------------------------------------------------------------------------
* The name of the config element attribute for the server port
*----------------------------------------------------------------------------*/
const std::string locationPortAttrName = "port";
/*------------------------------------------------------------------------------
* The name of the config element attribute for the server php page
*----------------------------------------------------------------------------*/
const std::string locationPathAttrName = "path";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ authentication server constants: login */
/*------------------------------------------------------------------------------
* The name of the get version method on the storage server
*----------------------------------------------------------------------------*/
const std::string getVersionMethodName = "locstor.getVersion";
/*------------------------------------------------------------------------------
* The name of version return parameter for getVersion
*----------------------------------------------------------------------------*/
const std::string getVersionResultParamName = "version";
/*------------------------------------------------------------------------------
* The name of the login method on the server
*----------------------------------------------------------------------------*/
const std::string loginMethodName = "locstor.login";
/*------------------------------------------------------------------------------
* The name of the login parameter in the input structure
*----------------------------------------------------------------------------*/
const std::string loginParamName = "login";
/*------------------------------------------------------------------------------
* The name of the password parameter in the input structure
*----------------------------------------------------------------------------*/
const std::string passwordParamName = "pass";
/*------------------------------------------------------------------------------
* The name of the session ID parameter in the output structure
*----------------------------------------------------------------------------*/
const std::string outputSessionIdParamName = "sessid";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ authentication server constants: logout */
/*------------------------------------------------------------------------------
* The name of the logout method on the server
*----------------------------------------------------------------------------*/
const std::string logoutMethodName = "locstor.logout";
/*------------------------------------------------------------------------------
* The name of the session ID parameter in the input structure
*----------------------------------------------------------------------------*/
const std::string inputSessionIdParamName = "sessid";
/*------------------------------------------------------------------------------
* The name of the status parameter in the output structure
*----------------------------------------------------------------------------*/
const std::string statusParamName = "status";
/* ~~~~~~~~~~~~~~~~~~ authentication server constants: load/save preferences */
/*------------------------------------------------------------------------------
* The name of the load preferences method on the server
*----------------------------------------------------------------------------*/
const std::string loadPreferencesMethodName = "locstor.loadPref";
/*------------------------------------------------------------------------------
* The name of the save preferences method on the server
*----------------------------------------------------------------------------*/
const std::string savePreferencesMethodName = "locstor.savePref";
/*------------------------------------------------------------------------------
* The name of the delete preferences method on the server
*----------------------------------------------------------------------------*/
const std::string deletePreferencesMethodName = "locstor.delPref";
/*------------------------------------------------------------------------------
* The name of the session ID parameter in the input structure
*----------------------------------------------------------------------------*/
const std::string preferencesSessionIdParamName = "sessid";
/*------------------------------------------------------------------------------
* The name of the key parameter in the input structure
*----------------------------------------------------------------------------*/
const std::string preferencesKeyParamName = "key";
/*------------------------------------------------------------------------------
* The name of the value parameter for both save and load methods
*----------------------------------------------------------------------------*/
const std::string preferencesValueParamName = "value";
/*------------------------------------------------------------------------------
* The name of the return parameter for the save method
*----------------------------------------------------------------------------*/
const std::string preferencesStatusParamName = "status";
/*------------------------------------------------------------------------------
* The name of the fault code parameter
*----------------------------------------------------------------------------*/
const std::string faultCodeParamName = "faultCode";
/*------------------------------------------------------------------------------
* The fault code for the "invalid preference key" error
*----------------------------------------------------------------------------*/
const int invalidPreferenceKeyFaultCode = 849;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~ authentication server constants: resetStorage */
/*------------------------------------------------------------------------------
* The name of the reset storage method on the server
*----------------------------------------------------------------------------*/
const std::string resetStorageMethodName = "locstor.resetStorage";
/*------------------------------------------------------------------------------
* The name of the result parameter returned by the method (ignored here)
*----------------------------------------------------------------------------*/
const std::string resetStorageResultParamName = "results";
/*------------------------------------------------------------------------------
* The name of the count parameter returned by the method (ignored here)
*----------------------------------------------------------------------------*/
const std::string resetStorageCountParamName = "cnt";
}
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Configure the web storage client.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClient :: configure(const xmlpp::Element & element)
throw (std::invalid_argument)
{
if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element ";
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
const xmlpp::Attribute * attribute = 0;
// read the storage server location
xmlpp::Node::NodeList childNodes
= element.get_children(locationConfigElementName);
xmlpp::Node::NodeList::iterator it = childNodes.begin();
if (it == childNodes.end()) {
std::string eMsg = "missing ";
eMsg += locationConfigElementName;
eMsg += " XML element";
throw std::invalid_argument(eMsg);
}
const xmlpp::Element * locationConfigElement
= dynamic_cast<const xmlpp::Element*> (*it);
if (!(attribute = locationConfigElement
->get_attribute(locationServerAttrName))) {
std::string eMsg = "Missing attribute ";
eMsg += locationServerAttrName;
throw std::invalid_argument(eMsg);
}
storageServerName = attribute->get_value();
if (!(attribute = locationConfigElement
->get_attribute(locationPortAttrName))) {
std::string eMsg = "Missing attribute ";
eMsg += locationPortAttrName;
throw std::invalid_argument(eMsg);
}
std::stringstream storageServerPortValue(attribute->get_value());
storageServerPortValue >> storageServerPort;
if (!(attribute = locationConfigElement
->get_attribute(locationPathAttrName))) {
std::string eMsg = "Missing attribute ";
eMsg += locationPathAttrName;
throw std::invalid_argument(eMsg);
}
storageServerPath = attribute->get_value();
++it;
if (it != childNodes.end()) {
std::string eMsg = "more than one ";
eMsg += locationConfigElementName;
eMsg += " XML element";
throw std::invalid_argument(eMsg);
}
}
/*------------------------------------------------------------------------------
* Return the version string of the test storage.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
WebAuthenticationClient :: getVersion(void)
throw (Core::XmlRpcException)
{
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
// add a dummy parameter, as this is the only way to enforce parameters
// to be of XML-RPC type struct
parameters["dummy"] = 0;
result.clear();
if (!xmlRpcClient.execute(getVersionMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getVersionMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< getVersionMethodName
<< "' returned error message:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (!result.hasMember(getVersionResultParamName)
|| result[getVersionResultParamName].getType()
!= XmlRpcValue::TypeString) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< getVersionMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
Ptr<Glib::ustring>::Ref version(new Glib::ustring(
result[getVersionResultParamName]));
xmlRpcClient.close();
return version;
}
/*------------------------------------------------------------------------------
* Login to the authentication server.
*----------------------------------------------------------------------------*/
Ptr<SessionId>::Ref
WebAuthenticationClient :: login(const std::string & login,
const std::string & password)
throw (XmlRpcException)
{
XmlRpcValue parameters;
XmlRpcValue result;
Ptr<SessionId>::Ref sessionId;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[loginParamName] = login;
parameters[passwordParamName] = password;
result.clear();
if (!xmlRpcClient.execute(loginMethodName.c_str(), parameters, result)) {
xmlRpcClient.close();
throw Authentication::XmlRpcCommunicationException("Login failed.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "Login method returned fault response:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(outputSessionIdParamName)) {
std::stringstream eMsg;
eMsg << "Login method returned unexpected response:\n"
<< result;
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
if (result[outputSessionIdParamName].getType() != XmlRpcValue::TypeString) {
std::stringstream eMsg;
eMsg << "Login method returned unexpected response:\n"
<< result;
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
sessionId.reset(new SessionId(result[outputSessionIdParamName]));
return sessionId;
}
/*------------------------------------------------------------------------------
* Logout from the authentication server.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException)
{
if (!sessionId) {
throw Core::XmlRpcInvalidArgumentException("Missing session ID.");
}
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[inputSessionIdParamName] = sessionId->getId();
result.clear();
if (!xmlRpcClient.execute(logoutMethodName.c_str(), parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException("Logout failed.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "Logout method returned fault response:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(statusParamName)
|| result[statusParamName].getType() != XmlRpcValue::TypeBoolean
|| ! bool(result[statusParamName])) {
std::stringstream eMsg;
eMsg << "Logout method returned unexpected response:\n"
<< result;
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
}
/*------------------------------------------------------------------------------
* Load a `user preferences' item from the server.
*----------------------------------------------------------------------------*/
Ptr<Glib::ustring>::Ref
WebAuthenticationClient :: loadPreferencesItem(
Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException,
std::invalid_argument)
{
if (!sessionId) {
throw Core::XmlRpcInvalidArgumentException("Missing session ID.");
}
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[preferencesSessionIdParamName] = sessionId->getId();
parameters[preferencesKeyParamName] = std::string(key);
result.clear();
if (!xmlRpcClient.execute(loadPreferencesMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method "
<< loadPreferencesMethodName
<< " returned fault response:\n"
<< result;
if (result.hasMember(faultCodeParamName)
&& result[faultCodeParamName].getType()
== XmlRpcValue::TypeInt
&& int(result[faultCodeParamName])
== invalidPreferenceKeyFaultCode) {
throw std::invalid_argument(eMsg.str());
} else {
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
}
if (! result.hasMember(preferencesValueParamName)
|| result[preferencesValueParamName].getType()
!= XmlRpcValue::TypeString) {
std::stringstream eMsg;
eMsg << "XML-RPC method "
<< loadPreferencesMethodName
<< " returned unexpected response:\n"
<< result;
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
Ptr<Glib::ustring>::Ref value(new Glib::ustring(std::string(
result[preferencesValueParamName] )));
return value;
}
/*------------------------------------------------------------------------------
* Store a `user preferences' item on the server.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClient :: savePreferencesItem(
Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key,
Ptr<const Glib::ustring>::Ref value)
throw (XmlRpcException)
{
if (!sessionId) {
throw Core::XmlRpcInvalidArgumentException("Missing session ID.");
}
if (!value) {
throw Core::XmlRpcInvalidArgumentException("Missing value argument.");
}
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[preferencesSessionIdParamName] = sessionId->getId();
parameters[preferencesKeyParamName] = std::string(key);
parameters[preferencesValueParamName] = std::string(*value);
result.clear();
if (!xmlRpcClient.execute(savePreferencesMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method "
<< savePreferencesMethodName
<< " returned fault response:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(preferencesStatusParamName)
|| result[preferencesStatusParamName].getType()
!= XmlRpcValue::TypeBoolean
|| ! bool(result[preferencesStatusParamName])) {
std::stringstream eMsg;
eMsg << "XML-RPC method "
<< savePreferencesMethodName
<< " returned unexpected response:\n"
<< result;
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
}
/*------------------------------------------------------------------------------
* Delete a `user preferences' item from the server.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClient :: deletePreferencesItem(
Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException)
{
if (!sessionId) {
throw Core::XmlRpcInvalidArgumentException("Missing session ID.");
}
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[preferencesSessionIdParamName] = sessionId->getId();
parameters[preferencesKeyParamName] = std::string(key);
result.clear();
if (!xmlRpcClient.execute(deletePreferencesMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method "
<< deletePreferencesMethodName
<< " returned fault response:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(preferencesStatusParamName)
|| result[preferencesStatusParamName].getType()
!= XmlRpcValue::TypeBoolean
|| ! bool(result[preferencesStatusParamName])) {
std::stringstream eMsg;
eMsg << "XML-RPC method "
<< deletePreferencesMethodName
<< " returned unexpected response:\n"
<< result;
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
}
/*------------------------------------------------------------------------------
* Reset the list of preferences to its initial (empty) state.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClient :: reset(void)
throw (Core::XmlRpcException)
{
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters["dummy_param"] = "dummy_value";
result.clear();
if (!xmlRpcClient.execute(resetStorageMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< resetStorageMethodName
<< "' returned error message:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(resetStorageResultParamName)
|| result[resetStorageResultParamName].getType()
!= XmlRpcValue::TypeArray
|| ! result.hasMember(resetStorageCountParamName)
|| result[resetStorageCountParamName].getType()
!= XmlRpcValue::TypeInt) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< resetStorageMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
}

View file

@ -1,289 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef WebAuthenticationClient_h
#define WebAuthenticationClient_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Authentication/AuthenticationClientInterface.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* An interface to the authentication methods on the php authentication
* server (which is currently the same as the storage server).
*
* This object has to be configured with an XML configuration element
* called webAuthentication. This element contains a child element
* specifying the location of the authentication server.
*
* A webAuthentication configuration element may look like the following:
*
* <pre><code>
* &lt;webAuthentication&gt;
* &lt;location
* server="localhost"
* port="80"
* path="/livesupportStorageServer/xmlrpc/xrLocStor.php"
* /&gt;
* &lt;/webAuthentication&gt;
* </code></pre>
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT webAuthentication (location) &gt;
* &lt;!ELEMENT location EMPTY &gt;
* &lt;!ATTLIST location server CDATA #REQUIRED &gt;
* &lt;!ATTLIST location port NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST location path CDATA #REQUIRED &gt;
* </code></pre>
*/
class WebAuthenticationClient :
virtual public Configurable,
virtual public AuthenticationClientInterface
{
private:
/**
* The name of the configuration XML elmenent used by
* WebAuthenticationClient
*/
static const std::string configElementNameStr;
/**
* The name of the authentication server, e.g.
* "myserver.mycompany.com".
*/
std::string storageServerName;
/**
* The port wher the authentication server is listening
* (default is 80).
*/
int storageServerPort;
/**
* The path to the authentication server php page.
*/
std::string storageServerPath;
public:
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~WebAuthenticationClient(void) throw ()
{
}
/**
* Return the name of the XML element this object expects
* to be sent to a call to configure().
*
* @return the name of the expected XML configuration element.
*/
static const std::string
getConfigElementName(void) throw ()
{
return configElementNameStr;
}
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the scheduler daemon has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument);
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException);
/**
* Login to the authentication server, using the data read from the
* configuration file.
* Returns a new session ID; in case of an error, throws one of three
* types of AuthenticationException.
* Note that an incorrect login or password is considered an error
* and will throw an XmlRpcMethodFaultException.
*
* @param login the login to the server
* @param password the password to the server
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @return the new session ID
*/
virtual Ptr<SessionId>::Ref
login(const std::string &login, const std::string &password)
throw (XmlRpcException);
/**
* Logout from the authentication server.
*
* @param sessionId the ID of the session to end
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @return true if logged out successfully, false if not
*/
virtual void
logout(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException);
/**
* Load a `user preferences' item from the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
*
* @exception std::invalid_argument
* no such preference key found
* @exception XmlRpcInvalidArgumentException
* bad sessionId argument
* @exception XmlRpcCommunicationException
* problem with performing XML-RPC call
* @exception XmlRpcMethodFaultException
* XML-RPC method returned fault response
* @exception XmlRpcMethodResponseException
* response from XML-RPC method is incorrect
*/
virtual Ptr<Glib::ustring>::Ref
loadPreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException,
std::invalid_argument);
/**
* Store a `user preferences' item on the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
* @param value the (new) value of the item
*
* @exception XmlRpcInvalidArgumentException
* bad sessionId or value argument
* @exception XmlRpcCommunicationException
* problem with performing XML-RPC call
* @exception XmlRpcMethodFaultException
* XML-RPC method returned fault response
* @exception XmlRpcMethodResponseException
* response from XML-RPC method is incorrect
*/
virtual void
savePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key,
Ptr<const Glib::ustring>::Ref value)
throw (XmlRpcException);
/**
* Delete a `user preferences' item from the server.
*
* @param sessionId the ID of the current session (from login())
* @param key the name of the item
*
* @exception XmlRpcInvalidArgumentException
* bad sessionId argument
* @exception XmlRpcCommunicationException
* problem with performing XML-RPC call
* @exception XmlRpcMethodFaultException
* XML-RPC method returned fault response
* @exception XmlRpcMethodResponseException
* response from XML-RPC method is incorrect
*/
virtual void
deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key)
throw (XmlRpcException);
/**
* Reset the authentication client.
* Invalidates all active session IDs, and resets the list of
* preferences to its initial (empty) state.
*
* @exception XmlRpcException if the server returns an error.
*/
virtual void
reset(void)
throw (XmlRpcException);
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // WebAuthenticationClient_h

View file

@ -1,276 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <string>
#include <fstream>
#include <iostream>
#include "LiveSupport/Core/SessionId.h"
#include "WebAuthenticationClientTest.h"
using namespace std;
using namespace LiveSupport::Core;
using namespace LiveSupport::Authentication;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
CPPUNIT_TEST_SUITE_REGISTRATION(WebAuthenticationClientTest);
/**
* The name of the configuration file for the authentication client factory.
*/
static const std::string configFileName = "webAuthentication.xml";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Set up the test environment.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClientTest :: setUp(void) throw ()
{
try {
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
wac.reset(new WebAuthenticationClient());
wac->configure(*root);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL("error parsing configuration file");
}
}
/*------------------------------------------------------------------------------
* Clean up the test environment.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClientTest :: tearDown(void) throw ()
{
wac.reset();
}
/*------------------------------------------------------------------------------
* Test to see if we can log on and off.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClientTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<SessionId>::Ref sessionId;
try {
sessionId = wac->login("Piszkos Fred", "malnaszor");
CPPUNIT_FAIL("Allowed login with incorrect login and password.");
} catch (XmlRpcException &e) {
}
sessionId.reset(new SessionId("bad_session_ID"));
try {
wac->logout(sessionId);
CPPUNIT_FAIL("Allowed logout without previous login.");
} catch (XmlRpcException &e) {
}
try {
sessionId = wac->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
wac->logout(sessionId);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
wac->logout(sessionId);
CPPUNIT_FAIL("Allowed to logout twice.");
} catch (XmlRpcException &e) {
}
}
/*------------------------------------------------------------------------------
* Test the getVersion function
*----------------------------------------------------------------------------*/
void
WebAuthenticationClientTest :: getVersionTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<const Glib::ustring>::Ref version;
try {
version = wac->getVersion();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(version.get());
}
/*------------------------------------------------------------------------------
* Test to see if we can save and load user preferences.
*----------------------------------------------------------------------------*/
void
WebAuthenticationClientTest :: preferencesTest(void)
throw (CPPUNIT_NS::Exception)
{
try {
wac->reset();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
Ptr<SessionId>::Ref sessionId;
Ptr<const Glib::ustring>::Ref prefValue;
// check "please log in" error
try {
prefValue = wac->loadPreferencesItem(sessionId, "something");
CPPUNIT_FAIL("Allowed operation without login.");
} catch (XmlRpcException &e) {
}
// log in
try {
sessionId = wac->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// check "no such key" error
try {
prefValue = wac->loadPreferencesItem(sessionId, "eye_color");
CPPUNIT_FAIL("Retrieved non-existent user preferences item");
} catch (std::invalid_argument &e) {
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// check normal save and load
prefValue.reset(new const Glib::ustring("chjornyje"));
try {
wac->savePreferencesItem(sessionId, "eye_color", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
Ptr<const Glib::ustring>::Ref newPrefValue;
try {
newPrefValue = wac->loadPreferencesItem(sessionId, "eye_color");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
// try some unicode characters
prefValue.reset(new const Glib::ustring("страстные"));
try {
wac->savePreferencesItem(sessionId, "eye_color", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = wac->loadPreferencesItem(sessionId, "eye_color");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == "страстные");
// check another normal save and load ...
prefValue.reset(new const Glib::ustring("ne dobryj"));
try {
wac->savePreferencesItem(sessionId, "hour", prefValue);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// ... but now change session ID in the middle
try {
wac->logout(sessionId);
sessionId = wac->login("root", "q");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = wac->loadPreferencesItem(sessionId, "hour");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
// check the delete method
try {
wac->deletePreferencesItem(sessionId, "hour");
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
try {
newPrefValue = wac->loadPreferencesItem(sessionId, "hour");
CPPUNIT_FAIL("Allowed to load preference after it was deleted");
} catch (std::invalid_argument &e) {
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
// and log out
try {
wac->logout(sessionId);
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
}

View file

@ -1,128 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef WebAuthenticationClientTest_h
#define WebAuthenticationClientTest_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
#include "WebAuthenticationClient.h"
namespace LiveSupport {
namespace Authentication {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Unit test for the WebAuthenticationClient class.
*
* @see WebAuthenticationClient
*/
class WebAuthenticationClientTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(WebAuthenticationClientTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END();
private:
/**
* The WebAuthenticationClient instance to test.
*/
Ptr<WebAuthenticationClient>::Ref wac;
protected:
/**
* A simple test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test the getVersion() function.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
getVersionTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test saving and load of user preferences.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
preferencesTest(void) throw (CPPUNIT_NS::Exception);
public:
/**
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
/**
* Clean up the environment after the test case.
*/
void
tearDown(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // WebAuthenticationClientTest_h

View file

@ -1 +0,0 @@
keep me

View file

@ -1,90 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
#-------------------------------------------------------------------------------
package="Db"
# assume we're in $basedir/bin
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
usrdir=`cd $basedir/../../../usr; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
tmpdir=$basedir/tmp
cd "$tmpdir"
DIE=0
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
echo "Generating configuration files for $package, please wait...."
configure_ac=${etcdir}/configure.ac
configure=${tmpdir}/configure
aclocal_m4=${tmpdir}/aclocal.m4
# copy over configure.ac and acinlclude.m4 from etc to tmp,
# as aclocal >= 1.8 is sooo unbelivably stupid that it will simply try to
# look for configure.ac in the current directory, and include acinclude.m4
# in aclocal.m4 it without a directory path in front
ACLOCAL_FLAGS="-I ${tmpdir} --acdir=${tmpdir} --output=${aclocal_m4}"
echo " aclocal $ACLOCAL_FLAGS"
cp -f ${configure_ac} ${tmpdir}
cp -f ${etcdir}/acinclude.m4 ${tmpdir}
aclocal $ACLOCAL_FLAGS
echo " autoheader ${configure_ac}"
autoheader ${configure_ac}
echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}"
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}

View file

@ -1,75 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script generates code coverage data for the module
#-------------------------------------------------------------------------------
module="Campcaster Db"
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
docdir=$basedir/doc
tmpdir=$basedir/tmp
usrdir=`cd $basedir/../../../usr; pwd;`
coverage_report_dir=$docdir/coverage
raw_coverage_file=$tmpdir/raw_coverage.info
coverage_file=$tmpdir/coverage.info
lcov=$usrdir/bin/lcov
genhtml=$usrdir/bin/genhtml
cd $basedir
#-------------------------------------------------------------------------------
# Re-configure with covarege collection enabled, compile and run the tests
#-------------------------------------------------------------------------------
$bindir/autogen.sh --enable-coverage
make clean
make check
#-------------------------------------------------------------------------------
# Generate some symlinks so that the sources are visible from tmpdir
#-------------------------------------------------------------------------------
ln -s $basedir/include $tmpdir/include
ln -s $basedir/src $tmpdir/src
#-------------------------------------------------------------------------------
# Use lcov to generate an HTML report on the coverage data
#-------------------------------------------------------------------------------
$lcov -d $tmpdir -c > $raw_coverage_file
$lcov -e $raw_coverage_file "$tmpdir/*" > $coverage_file
rm -rf $coverage_report_dir
mkdir -p $coverage_report_dir
$genhtml -t "$module" -o $coverage_report_dir $coverage_file
#-------------------------------------------------------------------------------
# Clean up
#-------------------------------------------------------------------------------
rm -f $tmpdir/include
rm -f $tmpdir/src

View file

@ -1,47 +0,0 @@
#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.campware.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this script to configure the environment.
#
# This script in effect calls the real automake / autoconf configure script
#-------------------------------------------------------------------------------
# assume we're in $basedir
reldir=`dirname $0`
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
bindir=$basedir/bin
tmpdir=$basedir/tmp
autogen=$bindir/autogen.sh
configure=$tmpdir/configure
if [ ! -x $configure ]; then
(cd $basedir && $autogen "$@")
fi
(cd $tmpdir && $configure "$@")

View file

@ -1 +0,0 @@
keep me

View file

@ -1,174 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# @configure_input@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# General command definitions
#-------------------------------------------------------------------------------
MKDIR = mkdir -p
RM = rm -f
RMDIR = rm -rf
DOXYGEN = doxygen
CP = cp -f
#-------------------------------------------------------------------------------
# Basic directory and file definitions
#-------------------------------------------------------------------------------
BASE_DIR = @builddir@
DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen
COVERAGE_DIR = ${DOC_DIR}/coverage
BIN_DIR = ${BASE_DIR}/bin
ETC_DIR = ${BASE_DIR}/etc
INCLUDE_DIR = ${BASE_DIR}/include
LIB_DIR = ${BASE_DIR}/lib
SRC_DIR = ${BASE_DIR}/src
TMP_DIR = ${BASE_DIR}/tmp
prefix = @prefix@
USR_DIR = ${prefix}
USR_INCLUDE_DIR = ${USR_DIR}/include
USR_LIB_DIR = ${USR_DIR}/lib
MODULES_DIR = ${BASE_DIR}/..
CORE_DIR = ${MODULES_DIR}/core
CORE_INCLUDE_DIR = ${CORE_DIR}/include
CORE_LIB_DIR = ${CORE_DIR}/lib
CORE_LIB = livesupport_core
CORE_LIB_FILE = ${CORE_LIB_DIR}/lib${CORE_LIB}.a
VPATH = ${SRC_DIR}
LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@
LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
LIBODBCXX_CFLAGS=@LIBODBCXX_CFLAGS@
LIBODBCXX_LIBS=@LIBODBCXX_LIBS@
TEST_RESULTS = ${DOC_DIR}/testResults.xml
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
TEST_XSLT = ../etc/testResultToHtml.xsl
DB_LIB = livesupport_db
DB_LIB_FILE = ${LIB_DIR}/lib${DB_LIB}.a
TEST_RUNNER = ${TMP_DIR}/testRunner
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
export LD_LIBRARY_PATH:=${LD_LIBRARY_PATH}:${USR_LIB_DIR}
#-------------------------------------------------------------------------------
# Configuration parameters
#-------------------------------------------------------------------------------
CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \
-pedantic -Wall -Wno-long-long \
${LIBXMLPP_CFLAGS} \
${LIBODBCXX_CFLAGS} \
-I${USR_INCLUDE_DIR} \
-I${CORE_INCLUDE_DIR} \
-I${INCLUDE_DIR} -I${TMP_DIR}
LDFLAGS = @LDFLAGS@ -pthread \
${LIBXMLPP_LIBS} \
${LIBODBCXX_LIBS} \
-L${USR_LIB_DIR} \
-L${CORE_LIB_DIR} \
-L${LIB_DIR}
#-------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------
DB_LIB_OBJS = ${TMP_DIR}/SimpleConnectionManager.o \
${TMP_DIR}/ConnectionManagerFactory.o \
${TMP_DIR}/Conversion.o
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
${TMP_DIR}/SimpleConnectionManagerTest.o \
${TMP_DIR}/ConnectionManagerFactoryTest.o
TEST_RUNNER_LIBS = -l${DB_LIB} -l${CORE_LIB} -lcppunit -ldl
#-------------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean check install
all: dir_setup ${DB_LIB_FILE}
dir_setup: ${TMP_DIR} ${DOXYGEN_DIR}
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
clean:
${RM} ${DB_LIB_OBJS} ${DB_LIB_FILE}
${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER}
${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info
docclean:
${RMDIR} ${DOXYGEN_DIR}/html
${RMDIR} ${COVERAGE_DIR}/*
${RM} ${TEST_RESULTS}
depclean: clean
distclean: clean docclean
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te* ${TMP_DIR}/ac*.m4
check: all ${TEST_RUNNER}
${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT}
install: all
${MKDIR} ${USR_INCLUDE_DIR}/LiveSupport/Db
${CP} ${INCLUDE_DIR}/LiveSupport/Db/*.h \
${USR_INCLUDE_DIR}/LiveSupport/Db
${CP} ${DB_LIB_FILE} ${USR_LIB_DIR}
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
${DB_LIB_FILE}: ${DB_LIB_OBJS}
${AR} crus $@ $^
${TMP_DIR}:
${MKDIR} ${TMP_DIR}
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${TEST_RUNNER}: ${CORE_LIB_FILE} ${TEST_RUNNER_OBJS} ${DB_LIB_FILE}
${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS}
${CORE_LIB_FILE}:
${MAKE} -C ${CORE_DIR}
#-------------------------------------------------------------------------------
# Pattern rules
#-------------------------------------------------------------------------------
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<

View file

@ -1,87 +0,0 @@
dnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl Macro to check for available modules using pkg-conf
dnl
dnl usage:
dnl PKG_CHECK_MODULES(GSTUFF,[gtk+-2.0 >= 1.3], action-if, action-not)
dnl
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
dnl
dnl This function was taken from the glade-- project
dnl-----------------------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])

View file

@ -1,106 +0,0 @@
dnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl NOTE: Run all configure related scripts from the tmp directory of the
dnl project.
dnl This is due to the fact that configure spreads a lot of trash around,
dnl like atom4te cache directories, config.* files, etc. into the directory
dnl it is being run from. We clearly don't want these in our base directory.
dnl-----------------------------------------------------------------------------
AC_INIT(Db, 0.0, bugs@campware.org)
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL])
AC_REVISION($Revision$)
AC_CONFIG_SRCDIR(../include/LiveSupport/Db/ConnectionManagerInterface.h)
AC_CONFIG_HEADERS(configure.h)
AC_PROG_CXX()
AC_CHECK_HEADERS(getopt.h)
dnl-----------------------------------------------------------------------------
dnl specify whether debug info should be compiled into the executable
dnl-----------------------------------------------------------------------------
AC_SUBST(CXXFLAGS)
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [compile with debug info (no)]),
[],
[enable_debug=no])
if test "x${enable_debug}" = "xyes"; then
CXXFLAGS="-g -O0"
AC_DEFINE( YDEBUG, 1, [Debug is on] )
else
CXXFLAGS="-O3"
fi
AC_MSG_RESULT([using compiler options: ${CXXFLAGS}])
dnl-----------------------------------------------------------------------------
dnl specify the pkg-config path
dnl-----------------------------------------------------------------------------
AC_ARG_WITH([pkg-config-path],
AC_HELP_STRING([--with-pkg-config-path],
[use the pkg-config path (prefix/lib/pkgconfig)]),
[PKG_CONFIG_PATH=${withval}],
[PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:$PKG_CONFIG_PATH])
AC_MSG_RESULT([using pkg-config path: ${PKG_CONFIG_PATH}])
export PKG_CONFIG_PATH
export PATH=${prefix}/bin:${PATH}
PKG_CHECK_MODULES(LIBXMLPP,[libxml++-2.6 >= 2.8.1])
AC_SUBST(LIBXMLPP_CFLAGS)
AC_SUBST(LIBXMLPP_LIBS)
PKG_CHECK_MODULES(LIBODBCXX,[libodbc++])
dnl-----------------------------------------------------------------------------
dnl enable compilaton for code coverage data
dnl-----------------------------------------------------------------------------
AC_SUBST(COVERAGE_CXXFLAGS)
AC_ARG_ENABLE( coverage,
[ --enable-coverage enable code coverage data generaton (no) ],
ENABLE_COVERAGE=${enableval}, ENABLE_COVERAGE="no" )
if test "x${ENABLE_COVERAGE}" == "xyes" ; then
COVERAGE_CXXFLAGS="-fprofile-arcs -ftest-coverage"
AC_MSG_RESULT([compiling in code coverage mode])
else
AC_MSG_RESULT([not compiling in code coverage mode])
fi
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
AC_OUTPUT()

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE connectionManagerFactory [
<!ELEMENT connectionManagerFactory (simpleConnectionManager) >
<!ELEMENT simpleConnectionManager EMPTY >
<!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
]>
<connectionManagerFactory>
<simpleConnectionManager dsn = "Campcaster-test"
userName = "test"
password = "test"
/>
</connectionManagerFactory>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE connectionManagerFactory [
<!ELEMENT connectionManagerFactory (simpleConnectionManager) >
<!ELEMENT simpleConnectionManager EMPTY >
<!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
]>
<connectionManagerFactory>
<simpleConnectionManager dsn = "ls_database"
userName = "ls_dbuser"
password = "ls_dbpassword"
/>
</connectionManagerFactory>

File diff suppressed because it is too large Load diff

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE simpleConnectionManager [
<!ELEMENT simpleConnectionManager EMPTY >
<!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
]>
<simpleConnectionManager dsn = "Campcaster-test"
userName = "test"
password = "test"
/>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE simpleConnectionManager [
<!ELEMENT simpleConnectionManager EMPTY >
<!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
]>
<simpleConnectionManager dsn = "ls_database"
userName = "ls_dbuser"
password = "ls_dbpassword"
/>

View file

@ -1,63 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Campcaster unit test results</title>
</head>
<body>
<h1>Preface</h1>
This document is part of the
<a href="http://campcaster.sourcefabric.org/">Campcaster</a>
project, Copyright &#169; 2004 <a href="http://www.mdlf.org/">Media
Development Loan Fund</a>, under the GNU
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.
<br/>
This is an automatically generated document.
<h1>Scope</h1>
This document contains the generated unit test results for the
<a href="http://campcaster.sourcefabric.org/">Campcaster</a> project.
<h1>Summary</h1>
<xsl:for-each select="//Statistics">
<table>
<tr>
<td><b>Total number of tests:</b></td>
<td><xsl:value-of select="Tests"/></td>
</tr>
<tr>
<td><b>Tests passed:</b></td>
<td><xsl:value-of select="count(/*/SuccessfulTests/Test)"/></td>
</tr>
<tr>
<td><b>Tests failed:</b></td>
<td><xsl:value-of select="Failures"/></td>
</tr>
<tr>
<td><b>Test errors:</b></td>
<td><xsl:value-of select="Errors"/></td>
</tr>
</table>
</xsl:for-each>
<h1>Tests</h1>
<table>
<tr>
<th>test name</th>
<th>test status</th>
</tr>
<xsl:for-each select="//Test | //FailedTest">
<xsl:sort select="Name"/>
<tr>
<td><xsl:value-of select="Name"/></td>
<xsl:if test="ancestor::FailedTests"><td bgcolor="red">failed</td></xsl:if>
<xsl:if test="ancestor::SuccessfulTests"><td bgcolor="lightblue">passed</td></xsl:if>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,182 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Db_ConnectionManagerFactory_h
#define LiveSupport_Db_ConnectionManagerFactory_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Db/ConnectionManagerInterface.h"
namespace LiveSupport {
namespace Db {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* The factory to create appropriate ConnectionManager objects.
* This singleton class has to be configured with an XML element,
* describing the ConnectionManagerInterface that it should build
* and maintain. This is done by including the configuration element
* for the desired type of connection manager inside the configuration
* element for the factory.
*
* Currently only the SimpleConnectionManager is supported, thus a
* configuration file may look like this:
*
* <pre><code>
* &lt;connectionManagerFactory&gt;
* <simpleConnectionManager dsn = "LiveSupport"
* userName = "foo"
* password = "bar"
* />
* &lt;/connectionManagerFactory&gt;
* </code></pre>
*
* The DTD for the above XML structure is:
*
* <pre><code>
* <!ELEMENT connectionManagerFactory (simpleConnectionManager) >
* </code></pre>
*
* For the DTD and details of the simpleConnectionManager configuration
* element, see the SimpleConnectionManager documentation.
*
* @see SimpleConnectionManager
*/
class ConnectionManagerFactory :
virtual public Configurable
{
private:
/**
* The name of the configuration XML elmenent used by this object.
*/
static const std::string configElementNameStr;
/**
* The singleton instance of this object.
*/
static Ptr<ConnectionManagerFactory>::Ref singleton;
/**
* The connection manager created by this factory.
*/
Ptr<ConnectionManagerInterface>::Ref connectionManager;
/**
* The default constructor.
*/
ConnectionManagerFactory(void) throw()
{
}
public:
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~ConnectionManagerFactory(void) throw ()
{
}
/**
* Return the name of the XML element this object expects
* to be sent to a call to configure().
*
* @return the name of the expected XML configuration element.
*/
static const std::string
getConfigElementName(void) throw ()
{
return configElementNameStr;
}
/**
* Returns the singleton instance of this object.
*
* @return the singleton instance of this object.
*/
static Ptr<ConnectionManagerFactory>::Ref
getInstance() throw ();
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the object has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error);
/**
* Return a connection manager.
*
* @return the appropriate connection manager, according to the
* configuration of this factory.
*/
Ptr<ConnectionManagerInterface>::Ref
getConnectionManager(void) throw ()
{
return connectionManager;
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Db
} // namespace LiveSupport
#endif // LiveSupport_Db_ConnectionManagerFactory_h

View file

@ -1,106 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Db_ConnectionManagerInterface_h
#define LiveSupport_Db_ConnectionManagerInterface_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <odbc++/connection.h>
#include "LiveSupport/Core/Ptr.h"
namespace LiveSupport {
namespace Db {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* The interface for handing out and managing database connections.
*/
class ConnectionManagerInterface
{
public:
/**
* Get a database connection from the manager.
* After use, the connection must be returned by calling
* returnConnection().
*
* @return a database connection to the database this manager
* serves.
* @see #returnConnection
*/
virtual Ptr<odbc::Connection>::Ref
getConnection(void) throw (std::runtime_error)
= 0;
/**
* Return a database connection previously aquired by a call to
* getConnection(), after it is not needed anymore.
*
* @param connection the connection to return.
* @see #getConnection
*/
virtual void
returnConnection(Ptr<odbc::Connection>::Ref connection)
throw (std::runtime_error)
= 0;
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~ConnectionManagerInterface(void) throw ()
{
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Db
} // namespace LiveSupport
#endif // LiveSupport_Db_ConnectionManagerInterface_h

View file

@ -1,117 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Db_Conversion_h
#define LiveSupport_Db_Conversion_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <boost/date_time/posix_time/posix_time.hpp>
#include <odbc++/types.h>
#include "LiveSupport/Core/Ptr.h"
namespace LiveSupport {
namespace Db {
using namespace boost;
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A helper object holding static conversion functions, that are
* helpful when accessing databases.
*/
class Conversion
{
private:
/**
* The default constructor.
*/
Conversion(void) throw ()
{
}
public:
/**
* Constants to specify whether we round time values up or down.
*/
typedef enum { roundDown,
roundUp,
roundNearest } RoundingType;
/**
* Convert a boost::ptime to a odbc::Timestamp.
*
* @param ptime the boost ptime to convert.
* @param round specify how to round the fractional part
* (default: down).
* @return an odbc::Timestamp, holding the same time.
*/
static Ptr<odbc::Timestamp>::Ref
ptimeToTimestamp(Ptr<const posix_time::ptime>::Ref ptime,
RoundingType round = roundDown)
throw ();
/**
* Convert an odbc::Timestamp to a boost::ptime.
*
* @param timestamp an odbc::Timestamp to convert.
* @return a boost ptime, holding the same time.
*/
static Ptr<posix_time::ptime>::Ref
timestampToPtime(Ptr<odbc::Timestamp>::Ref timestamp) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Db
} // namespace LiveSupport
#endif // LiveSupport_Db_Conversion_h

View file

@ -1 +0,0 @@
keep me

View file

@ -1,105 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "SimpleConnectionManager.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Db;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/*------------------------------------------------------------------------------
* The name of the config element for this class
*----------------------------------------------------------------------------*/
const std::string ConnectionManagerFactory::configElementNameStr =
"connectionManagerFactory";
/*------------------------------------------------------------------------------
* The singleton instance of ConnectionManagerFactory
*----------------------------------------------------------------------------*/
Ptr<ConnectionManagerFactory>::Ref ConnectionManagerFactory::singleton;
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Return the singleton instance to ConnectionManagerFactory
*----------------------------------------------------------------------------*/
Ptr<ConnectionManagerFactory>::Ref
ConnectionManagerFactory :: getInstance(void) throw ()
{
if (!singleton.get()) {
singleton.reset(new ConnectionManagerFactory());
}
return singleton;
}
/*------------------------------------------------------------------------------
* Configure the connection manager factory.
*----------------------------------------------------------------------------*/
void
ConnectionManagerFactory :: configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error)
{
if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element ";
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
connectionManager.reset();
// try to look for a SimpleConnectionManager configuration element
xmlpp::Node::NodeList nodes = element.get_children(
SimpleConnectionManager::getConfigElementName());
if (nodes.size() >= 1) {
const xmlpp::Element * configElement =
dynamic_cast<const xmlpp::Element*> (*(nodes.begin()));
Ptr<SimpleConnectionManager>::Ref scm(new SimpleConnectionManager());
scm->configure(*configElement);
connectionManager = scm;
}
if (!connectionManager) {
throw std::invalid_argument("no storage client factories to configure");
}
}

View file

@ -1,122 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <string>
#include <iostream>
#include <odbc++/resultset.h>
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "ConnectionManagerFactoryTest.h"
using namespace odbc;
using namespace LiveSupport::Db;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
CPPUNIT_TEST_SUITE_REGISTRATION(ConnectionManagerFactoryTest);
/**
* The name of the configuration file for the connection manager factory.
*/
static const std::string configFileName = "connectionManagerFactory.xml";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Set up the test environment
*----------------------------------------------------------------------------*/
void
ConnectionManagerFactoryTest :: setUp(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Clean up the test environment
*----------------------------------------------------------------------------*/
void
ConnectionManagerFactoryTest :: tearDown(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Test to see if the singleton Hello object is accessible
*----------------------------------------------------------------------------*/
void
ConnectionManagerFactoryTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
try {
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
Ptr<ConnectionManagerFactory>::Ref cmf =
ConnectionManagerFactory::getInstance();
cmf->configure(*root);
Ptr<ConnectionManagerInterface>::Ref cm = cmf->getConnectionManager();
CPPUNIT_ASSERT(cm);
Ptr<Connection>::Ref connection = cm->getConnection();
CPPUNIT_ASSERT(connection);
// so far, so good. now simply execute "SELECT 1", and see if
// it works
Ptr<Statement>::Ref stmt(connection->createStatement());
Ptr<ResultSet>::Ref rs(stmt->executeQuery("SELECT 1"));
CPPUNIT_ASSERT(rs->next());
CPPUNIT_ASSERT(rs->getInt(1) == 1);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL(e.what());
} catch (std::runtime_error &e) {
CPPUNIT_FAIL(e.what());
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL(e.what());
}
}

View file

@ -1,103 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef ConnectionManagerFactoryTest_h
#define ConnectionManagerFactoryTest_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
namespace LiveSupport {
namespace Db {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Unit test for the ConnectionManagerFactory class.
*
* @see ConnectionManagerFactory
*/
class ConnectionManagerFactoryTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(ConnectionManagerFactoryTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST_SUITE_END();
protected:
/**
* A simple test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
public:
/**
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
/**
* Clean up the environment after the test case.
*/
void
tearDown(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Db
} // namespace LiveSupport
#endif // ConnectionManagerFactoryTest_h

View file

@ -1,92 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Db/Conversion.h"
using namespace boost;
using namespace LiveSupport::Core;
using namespace LiveSupport::Db;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Convert a boost::ptime to an odbc::Timestamp
*----------------------------------------------------------------------------*/
Ptr<odbc::Timestamp>::Ref
Conversion :: ptimeToTimestamp(Ptr<const posix_time::ptime>::Ref ptime,
RoundingType round)
throw ()
{
posix_time::ptime newPtime = *ptime;
if (round == roundUp && newPtime.time_of_day().fractional_seconds() != 0) {
newPtime += posix_time::seconds(1);
} else if (round == roundNearest) {
newPtime += posix_time::microseconds(500000);
}
gregorian::date date = newPtime.date();
posix_time::time_duration time = newPtime.time_of_day();
Ptr<odbc::Timestamp>::Ref timestamp(new odbc::Timestamp(date.year(),
date.month(),
date.day(),
time.hours(),
time.minutes(),
time.seconds()));
return timestamp;
}
/*------------------------------------------------------------------------------
* Convert an odbc::Timestamp to a boost::ptime
*----------------------------------------------------------------------------*/
Ptr<posix_time::ptime>::Ref
Conversion :: timestampToPtime(Ptr<odbc::Timestamp>::Ref timestamp)
throw()
{
// don't convert through the time_t format, as probably because of
// timezone settings, boost::posix_time::from_time_t() ruins the
// actual value
std::string timeStr = timestamp->toString();
Ptr<posix_time::ptime>::Ref ptime(new posix_time::ptime(
posix_time::time_from_string(timeStr)));
return ptime;
}

View file

@ -1,146 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <odbc++/drivermanager.h>
#include "SimpleConnectionManager.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Db;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/*------------------------------------------------------------------------------
* The name of the config element for this class
*----------------------------------------------------------------------------*/
const std::string SimpleConnectionManager::configElementNameStr =
"simpleConnectionManager";
/**
* The name of the attribute to get the dsn for the connection.
*/
static const std::string dsnAttrName = "dsn";
/**
* The name of the attribute to get the userName for the connection.
*/
static const std::string userNameAttrName = "userName";
/**
* The name of the attribute to get the password for the connection.
*/
static const std::string passwordAttrName = "password";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Configure the connection manager factory.
*----------------------------------------------------------------------------*/
void
SimpleConnectionManager :: configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error)
{
if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element ";
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
const xmlpp::Attribute * attribute = 0;
if (!(attribute = element.get_attribute(dsnAttrName))) {
std::string eMsg = "Missing attribute ";
eMsg += dsnAttrName;
throw std::invalid_argument(eMsg);
}
dsn = attribute->get_value();
if (!(attribute = element.get_attribute(userNameAttrName))) {
std::string eMsg = "Missing attribute ";
eMsg += userNameAttrName;
throw std::invalid_argument(eMsg);
}
userName = attribute->get_value();
if (!(attribute = element.get_attribute(passwordAttrName))) {
std::string eMsg = "Missing attribute ";
eMsg += passwordAttrName;
throw std::invalid_argument(eMsg);
}
password = attribute->get_value();
}
/*------------------------------------------------------------------------------
* Give out a connection.
*----------------------------------------------------------------------------*/
Ptr<odbc::Connection>::Ref
SimpleConnectionManager :: getConnection(void)
throw (std::runtime_error)
{
odbc::Connection * conn;
try {
conn = odbc::DriverManager::getConnection(dsn, userName, password);
} catch (std::exception &e) {
throw std::runtime_error(e.what());
}
if (!conn) {
std::string eMsg = "unable to open ODBC connection for DSN ";
eMsg += dsn;
throw std::runtime_error(eMsg);
}
Ptr<odbc::Connection>::Ref connection(conn);
return connection;
}
/*------------------------------------------------------------------------------
* Receive a connection back.
*----------------------------------------------------------------------------*/
void
SimpleConnectionManager :: returnConnection(
Ptr<odbc::Connection>::Ref connection)
throw (std::runtime_error)
{
// nothing to do here...
// we could save the outgoing connections to a set in getConnection()
// and check here to see if the returned one is contained there
}

View file

@ -1,184 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef SimpleConnectionManager_h
#define SimpleConnectionManager_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <LiveSupport/Core/Configurable.h>
#include <LiveSupport/Db/ConnectionManagerInterface.h>
namespace LiveSupport {
namespace Db {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A simple connection manager, basically a facade to the underlying
* odbc::DriverManager class.
* This class can be configured with the following XML element, containing
* the ODBC Data Source Name (DSN), ODBC user name and ODBC password
* the manager will connect with to the ODBC source. The XML element looks
* as follows:
*
* <pre><code>
* <simpleConnectionManager dsn = "LiveSupport"
* userName = "foo"
* password = "bar"
* />
* </code></pre>
*
* The DTD for the above XML structure is:
*
* <pre><code>
* <!ELEMENT simpleConnectionManager EMPTY >
* <!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
* <!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
* <!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
* </code></pre>
*/
class SimpleConnectionManager :
virtual public Configurable,
virtual public ConnectionManagerInterface
{
private:
/**
* The name of the configuration XML elmenent used by this object.
*/
static const std::string configElementNameStr;
/**
* The ODBC Data Source Name this manager connects to.
*/
std::string dsn;
/**
* The user name to use when connecting to the ODBC DSN.
*/
std::string userName;
/**
* The password to use when connecting to the ODBC DSN.
*/
std::string password;
public:
/**
* The default constructor.
*/
SimpleConnectionManager(void) throw ()
{
}
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~SimpleConnectionManager(void) throw ()
{
}
/**
* Return the name of the XML element this object expects
* to be sent to a call to configure().
*
* @return the name of the expected XML configuration element.
*/
static const std::string
getConfigElementName(void) throw ()
{
return configElementNameStr;
}
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the object has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error);
/**
* Get a database connection from the manager.
* After use, the connection must be returned by calling
* returnConnection().
*
* @return a database connection to the database this manager
* serves.
* @see #returnConnection
*/
virtual Ptr<odbc::Connection>::Ref
getConnection(void) throw (std::runtime_error);
/**
* Return a database connection previously aquired by a call to
* getConnection(), after it is not needed anymore.
*
* @param connection the connection to return.
* @see #getConnection
*/
virtual void
returnConnection(Ptr<odbc::Connection>::Ref connection)
throw (std::runtime_error);
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Db
} // namespace LiveSupport
#endif // SimpleConnectionManager_h

View file

@ -1,206 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <string>
#include <iostream>
#include <odbc++/resultset.h>
#include <odbc++/preparedstatement.h>
#include "SimpleConnectionManager.h"
#include "SimpleConnectionManagerTest.h"
using namespace odbc;
using namespace LiveSupport::Db;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
CPPUNIT_TEST_SUITE_REGISTRATION(SimpleConnectionManagerTest);
/**
* The name of the configuration file for the connection manager.
*/
static const std::string configFileName = "simpleConnectionManager.xml";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Set up the test environment
*----------------------------------------------------------------------------*/
void
SimpleConnectionManagerTest :: setUp(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Clean up the test environment
*----------------------------------------------------------------------------*/
void
SimpleConnectionManagerTest :: tearDown(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Test to see if the singleton Hello object is accessible
*----------------------------------------------------------------------------*/
void
SimpleConnectionManagerTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
try {
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
Ptr<SimpleConnectionManager>::Ref scm(new SimpleConnectionManager());
scm->configure(*root);
Ptr<Connection>::Ref connection = scm->getConnection();
CPPUNIT_ASSERT(connection);
// so far, so good. now simply execute "SELECT 1", and see if
// it works
Ptr<Statement>::Ref stmt(connection->createStatement());
Ptr<ResultSet>::Ref rs(stmt->executeQuery("SELECT 1"));
CPPUNIT_ASSERT(rs->next());
CPPUNIT_ASSERT(rs->getInt(1) == 1);
rs.reset();
stmt->close();
stmt.reset();
scm->returnConnection(connection);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL(e.what());
} catch (std::runtime_error &e) {
CPPUNIT_FAIL(e.what());
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL(e.what());
}
}
/*------------------------------------------------------------------------------
* Test to handle large integers.
*----------------------------------------------------------------------------*/
void
SimpleConnectionManagerTest :: bigIntTest(void)
throw (CPPUNIT_NS::Exception)
{
long long testValue = 0x7fffffffffffffffLL;
std::string createStmt = "CREATE TABLE testTable\n"
"(\n"
" id BIGINT NOT NULL\n"
");";
bool b;
try {
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
Ptr<SimpleConnectionManager>::Ref scm(new SimpleConnectionManager());
scm->configure(*root);
Ptr<Connection>::Ref connection = scm->getConnection();
CPPUNIT_ASSERT(connection);
// simply see if selecting the highest 63 bit number works...
Ptr<PreparedStatement>::Ref pstmt(connection->prepareStatement(
"SELECT ?"));
pstmt->setLong(1, testValue);
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
CPPUNIT_ASSERT(rs->next());
CPPUNIT_ASSERT(rs->getLong(1) == testValue);
rs.reset();
pstmt->close();
pstmt.reset();
// so far, so good. now create a table with a BIGINT column
// and try the same
Ptr<Statement>::Ref stmt(connection->createStatement());
stmt->execute(createStmt);
stmt->close();
stmt.reset();
pstmt.reset(connection->prepareStatement("INSERT INTO testTable "
" VALUES(?)"));
pstmt->setLong(1, testValue);
CPPUNIT_ASSERT(pstmt->executeUpdate() == 1);
pstmt->close();
pstmt.reset();
stmt.reset(connection->createStatement());
rs.reset(stmt->executeQuery("SELECT * FROM testTable"));
CPPUNIT_ASSERT(rs->next());
//std::cerr << std::endl;
//std::cerr << "rs->getLong: " << rs->getLong(1) << std::endl;
//std::cerr << "testValue: " << testValue << std::endl;
b = rs->getLong(1) == testValue;
CPPUNIT_ASSERT(b);
rs.reset();
stmt->close();
stmt.reset();
stmt.reset(connection->createStatement());
stmt->executeUpdate("DROP TABLE testTable");
stmt->close();
stmt.reset();
scm->returnConnection(connection);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL(e.what());
} catch (std::runtime_error &e) {
CPPUNIT_FAIL(e.what());
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL(e.what());
} catch (SQLException &e) {
CPPUNIT_FAIL(e.what());
}
}

View file

@ -1,112 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef SimpleConnectionManagerTest_h
#define SimpleConnectionManagerTest_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
namespace LiveSupport {
namespace Db {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Unit test for the SimpleConnectionManager class.
*
* @see SimpleConnectionManager
*/
class SimpleConnectionManagerTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(SimpleConnectionManagerTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(bigIntTest);
CPPUNIT_TEST_SUITE_END();
protected:
/**
* A simple test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* A test to handle large integers.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
bigIntTest(void) throw (CPPUNIT_NS::Exception);
public:
/**
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
/**
* Clean up the environment after the test case.
*/
void
tearDown(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Db
} // namespace LiveSupport
#endif // SimpleConnectionManagerTest_h

View file

@ -1,275 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#if HAVE_GETOPT_H
#include <getopt.h>
#else
#error "Need getopt.h"
#endif
#include <fstream>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/XmlOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include "LiveSupport/Core/Ptr.h"
using namespace LiveSupport::Core;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/**
* Our copyright notice, should be at most 80 columns
*/
static const char copyrightNotice[] =
"Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL";
/**
* String describing the short options.
*/
static const char options[] = "ho:s:v";
/**
* Structure describing the long options
*/
static const struct option longOptions[] = {
{ "help", no_argument, 0, 'h' },
{ "output", required_argument, 0, 'o' },
{ "stylesheet", required_argument, 0, 's' },
{ "version", no_argument, 0, 'v' },
{ 0, 0, 0, 0 }
};
/**
* The encoding to use for the output file.
*/
static const std::string encoding = "utf-8";
/**
* The output XML file name.
*/
static Ptr<std::string>::Ref xmlOutFileName;
/**
* The XSLT attached to the output file.
*/
static Ptr<std::string>::Ref xsltFileName;
/* =============================================== local function prototypes */
/**
* Print program version.
*
* @param os the std::ostream to print to.
*/
static void
printVersion ( std::ostream & os );
/**
* Print program usage information.
*
* @param invocation the command line command used to invoke this program.
* @param os the std::ostream to print to.
*/
static void
printUsage ( const char invocation[],
std::ostream & os );
/**
* Process command line arguments.
*
* @param argc the number of arguments.
* @param argv the arguments themselves.
* @return true of all went well, false in case the program should exit
* after this call.
*/
static bool
processArguments(int argc, char *argv[]);
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Run all tests
*----------------------------------------------------------------------------*/
int
main( int argc,
char * argv[] ) throw ()
{
if (!processArguments(argc, argv)) {
return 0;
}
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.setLocationFormat("%p:%l:");
outputter.write();
// also generate an XML document as an output
std::ofstream xmlOutFile(xmlOutFileName->c_str());
CPPUNIT_NS::XmlOutputter xmlOutputter(&result, xmlOutFile, encoding);
xmlOutputter.setStandalone(false);
if (xsltFileName) {
xmlOutputter.setStyleSheet(*xsltFileName);
}
xmlOutputter.write();
xmlOutFile.flush();
xmlOutFile.close();
return result.wasSuccessful() ? 0 : 1;
}
/*------------------------------------------------------------------------------
* Process command line arguments.
*----------------------------------------------------------------------------*/
static bool
processArguments(int argc, char *argv[])
{
int i;
while ((i = getopt_long(argc, argv, options, longOptions, 0)) != -1) {
switch (i) {
case 'h':
printUsage(argv[0], std::cout);
return false;
case 'o':
xmlOutFileName.reset(new std::string(optarg));
break;
case 's':
xsltFileName.reset(new std::string(optarg));
break;
case 'v':
printVersion(std::cout);
return false;
default:
printUsage(argv[0], std::cout);
return false;
}
}
if (optind < argc) {
std::cerr << "error processing command line arguments" << std::endl;
printUsage(argv[0], std::cout);
return false;
}
if (!xmlOutFileName) {
std::cerr << "mandatory option output file name not specified"
<< std::endl;
printUsage(argv[0], std::cout);
return false;
}
std::cerr << "writing output to '" << *xmlOutFileName << '\'' << std::endl;
if (xsltFileName) {
std::cerr << "using XSLT file '" << *xsltFileName << '\'' << std::endl;
}
return true;
}
/*------------------------------------------------------------------------------
* Print program version.
*----------------------------------------------------------------------------*/
static void
printVersion ( std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
<< "Unit test runner" << std::endl
<< copyrightNotice << std::endl;
}
/*------------------------------------------------------------------------------
* Print program usage.
*----------------------------------------------------------------------------*/
static void
printUsage ( const char invocation[],
std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
<< "Unit test runner" << std::endl
<< std::endl
<< "Usage: " << invocation << " [OPTION]"
<< std::endl
<< " mandatory options:" << std::endl
<< " -o, --output=file.name write test results into this XML file"
<< std::endl
<< " optional options:" << std::endl
<< " -s, --stylesheet specify this XSLT for the output file"
<< std::endl
<< " this is either an absolute URI, or a"
<< std::endl
<< " relative path for the output document"
<< std::endl
<< " -h, --help display this help and exit" << std::endl
<< " -v, --version display version information and exit"
<< std::endl
<< std::endl
<< "Report bugs to " << PACKAGE_BUGREPORT << std::endl;
}

View file

@ -1 +0,0 @@
keep me

View file

@ -1,90 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
#-------------------------------------------------------------------------------
package="Widgets"
# assume we're in $basedir/bin
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
usrdir=`cd $basedir/../../../usr; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
tmpdir=$basedir/tmp
cd "$tmpdir"
DIE=0
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
echo "Generating configuration files for $package, please wait...."
configure_ac=${etcdir}/configure.ac
configure=${tmpdir}/configure
aclocal_m4=${tmpdir}/aclocal.m4
# copy over configure.ac and acinlclude.m4 from etc to tmp,
# as aclocal >= 1.8 is sooo unbelivably stupid that it will simply try to
# look for configure.ac in the current directory, and include acinclude.m4
# in aclocal.m4 it without a directory path in front
ACLOCAL_FLAGS="-I ${tmpdir} --acdir=${tmpdir} --output=${aclocal_m4}"
echo " aclocal $ACLOCAL_FLAGS"
cp -f ${configure_ac} ${tmpdir}
cp -f ${etcdir}/acinclude.m4 ${tmpdir}
aclocal $ACLOCAL_FLAGS
echo " autoheader ${configure_ac}"
autoheader ${configure_ac}
echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}"
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}

View file

@ -1,47 +0,0 @@
#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.campware.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this script to configure the environment.
#
# This script in effect calls the real automake / autoconf configure script
#-------------------------------------------------------------------------------
# assume we're in $basedir
reldir=`dirname $0`
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
bindir=$basedir/bin
tmpdir=$basedir/tmp
autogen=$bindir/autogen.sh
configure=$tmpdir/configure
if [ ! -x $configure ]; then
(cd $basedir && $autogen $*)
fi
(cd $tmpdir && $configure $*)

View file

@ -1 +0,0 @@
keep me

View file

@ -1,225 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# @configure_input@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# General command definitions
#-------------------------------------------------------------------------------
MKDIR = mkdir -p
RM = rm -f
RMDIR = rm -rf
DOXYGEN = doxygen
CP = cp -f
#-------------------------------------------------------------------------------
# Basic directory and file definitions
#-------------------------------------------------------------------------------
PACKAGE_NAME = @PACKAGE_NAME@
BASE_DIR = @builddir@
DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen
COVERAGE_DIR = ${DOC_DIR}/coverage
ETC_DIR = ${BASE_DIR}/etc
INCLUDE_DIR = ${BASE_DIR}/include
LIB_DIR = ${BASE_DIR}/lib
SRC_DIR = ${BASE_DIR}/src
TMP_DIR = ${BASE_DIR}/tmp
VAR_DIR = ${BASE_DIR}/var
prefix = @prefix@
USR_DIR = ${prefix}
USR_INCLUDE_DIR = ${USR_DIR}/include
USR_BIN_DIR = ${USR_DIR}/bin
USR_LIB_DIR = ${USR_DIR}/lib
USR_VAR_DIR = ${USR_DIR}/var
MODULES_DIR = ${BASE_DIR}/..
CORE_DIR = ${MODULES_DIR}/core
CORE_INCLUDE_DIR = ${CORE_DIR}/include
CORE_LIB_DIR = ${CORE_DIR}/lib
CORE_LIB = livesupport_core
CORE_LIB_FILE = ${CORE_LIB_DIR}/lib${CORE_LIB}.a
GENRB = @GENRB@
TMP_LOCALIZATION_DIR = ${TMP_DIR}/localization
GENRBOPTS = --destdir ${TMP_LOCALIZATION_DIR} \
--encoding utf-8 \
--strict
VPATH = ${SRC_DIR}
BOOST_CFLAGS=@BOOST_CPPFLAGS@
BOOST_LIBS=@BOOST_LDFLAGS@
BOOST_DATE_TIME_LIB=@BOOST_DATE_TIME_LIB@
LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@
LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
ICU_CFLAGS=@ICU_CFLAGS@
ICU_CXXFLAGS=@ICU_CXXFLAGS@
ICU_LIBS=@ICU_LIBS@
GTKMM_CFLAGS=@GTKMM_CFLAGS@
GTKMM_LIBS=@GTKMM_LIBS@
LIBGLADEMM_CFLAGS=@LIBGLADEMM_CFLAGS@
LIBGLADEMM_LIBS=@LIBGLADEMM_LIBS@
TEST_RESULTS = ${DOC_DIR}/testResults.xml
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
TEST_XSLT = ../etc/testResultToHtml.xsl
WIDGETS_LIB = livesupport_widgets
WIDGETS_LIB_FILE = ${LIB_DIR}/lib${WIDGETS_LIB}.a
TEST_EXE = ${TMP_DIR}/test
TEST_CFG = ${ETC_DIR}/widgetFactory.xml
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
export LD_LIBRARY_PATH:=${USR_LIB_DIR}:${LD_LIBRARY_PATH}
#-------------------------------------------------------------------------------
# Configuration parameters
#-------------------------------------------------------------------------------
CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \
-pedantic -Wall -Wno-long-long \
${BOOST_CFLAGS} \
${LIBXMLPP_CFLAGS} \
${ICU_CFLAGS} \
${GTKMM_CFLAGS} \
${LIBGLADEMM_CFLAGS} \
-I${USR_INCLUDE_DIR} \
-I${CORE_INCLUDE_DIR} \
-I${INCLUDE_DIR} -I${TMP_DIR}
LDFLAGS = @LDFLAGS@ -pthread \
${BOOST_LIBS} \
${LIBXMLPP_LIBS} \
${ICU_LIBS} \
${GTKMM_LIBS} \
${LIBGLADEMM_LIBS} \
-L${USR_LIB_DIR} \
-L${CORE_LIB_DIR} \
-L${LIB_DIR}
#-------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------
WIDGETS_LIB_OBJS = ${TMP_DIR}/ComboBoxText.o \
${TMP_DIR}/MetadataComboBoxText.o \
${TMP_DIR}/OperatorComboBoxText.o \
${TMP_DIR}/WidgetFactory.o \
${TMP_DIR}/Colors.o \
${TMP_DIR}/ZebraTreeView.o \
${TMP_DIR}/ZebraCellRenderer.o
TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \
${TMP_DIR}/main.o
TEST_RUNNER_RES = ${TMP_LOCALIZATION_DIR}/root.res \
${TMP_LOCALIZATION_DIR}/en.res \
${TMP_LOCALIZATION_DIR}/hu.res
TEST_EXE_LIBS = -l${WIDGETS_LIB} -l${CORE_LIB} ${ICU_LIBS} \
${BOOST_DATE_TIME_LIB} -lxmlrpc++ -lssl
#-------------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean check install
all: dir_setup ${WIDGETS_LIB_FILE}
dir_setup: ${TMP_DIR} ${TMP_LOCALIZATION_DIR} ${DOXYGEN_DIR}
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
clean:
${RM} ${WIDGETS_LIB_OBJS} ${WIDGETS_LIB_FILE}
${RM} ${TEST_EXE_OBJS} ${TEST_EXE}
${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info
${RMDIR} ${TMP_LOCALIZATION_DIR}
docclean:
${RMDIR} ${DOXYGEN_DIR}/html
${RMDIR} ${COVERAGE_DIR}/*
${RM} ${TEST_RESULTS}
depclean: clean
distclean: clean docclean
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te* ${TMP_DIR}/ac*.m4
run: all ${TEST_EXE} ${TEST_RUNNER_RES}
${TEST_EXE} -c ${TEST_CFG}
check: all
install: all
${MKDIR} ${USR_INCLUDE_DIR}/LiveSupport/Widgets
${CP} ${INCLUDE_DIR}/LiveSupport/Widgets/*.h \
${USR_INCLUDE_DIR}/LiveSupport/Widgets
${CP} ${WIDGETS_LIB_FILE} ${USR_LIB_DIR}
${MKDIR} ${USR_VAR_DIR}/Campcaster/Widgets/icons
${CP} ${VAR_DIR}/icons/*.png \
${USR_VAR_DIR}/Campcaster/Widgets/icons
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
${WIDGETS_LIB_FILE}: ${WIDGETS_LIB_OBJS}
${AR} crus $@ $^
${TMP_DIR}:
${MKDIR} ${TMP_DIR}
${TMP_LOCALIZATION_DIR}:
${MKDIR} ${TMP_LOCALIZATION_DIR}
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${TEST_EXE}: ${CORE_LIB_FILE} ${TEST_EXE_OBJS} ${WIDGETS_LIB_FILE}
${CXX} ${LDFLAGS} -o $@ ${TEST_EXE_OBJS} ${TEST_EXE_LIBS} \
${WIDGETS_LIB_FILE}
${CORE_LIB_FILE}:
${MAKE} -C ${CORE_DIR}
#-------------------------------------------------------------------------------
# Pattern rules
#-------------------------------------------------------------------------------
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
${TMP_LOCALIZATION_DIR}/%.res : ${VAR_DIR}/%.txt
${GENRB} ${GENRBOPTS} $^

View file

@ -1,463 +0,0 @@
dnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl Macro to check for available modules using pkg-conf
dnl
dnl usage:
dnl PKG_CHECK_MODULES(GSTUFF,[gtk+-2.0 >= 1.3], action-if, action-not)
dnl
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
dnl
dnl This function was taken from the glade-- project
dnl-----------------------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])
dnl-----------------------------------------------------------------------------
dnl Macro to check for C++ namespaces
dnl for more information on this macro, see
dnl http://autoconf-archive.cryp.to/ac_cxx_namespaces.html
dnl
dnl usage:
dnl If the compiler can prevent names clashes using namespaces,
dnl define HAVE_NAMESPACES.
dnl-----------------------------------------------------------------------------
AC_DEFUN([AC_CXX_NAMESPACES],
[AC_CACHE_CHECK(whether the compiler implements namespaces,
ac_cv_cxx_namespaces,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
[using namespace Outer::Inner; return i;],
ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_namespaces" = yes; then
AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
fi
])
dnl-----------------------------------------------------------------------------
dnl Test for the Boost C++ libraries of a particular version (or newer).
dnl for more information on boost, see http://www.boost.org/
dnl for more information on this macro, see
dnl http://autoconf-archive.cryp.to/ax_boost_base.html
dnl
dnl usage:
dnl If no path to the installed boost library is given the macro searches
dnl under ${prefix}, /usr, /usr/local, and /opt, and evaluates the $BOOST_ROOT
dnl environment variable. Further documentation is available at
dnl http://randspringer.de/boost/index.html
dnl
dnl This macro calls: AC_SUBST(BOOST_CPPFLAGS) and AC_SUBST(BOOST_LDFLAGS)
dnl and sets: HAVE_BOOST
dnl
dnl Modified for Campcaster:
dnl * --with-boost default changed to Yes;
dnl * if the library is not found, it does not die, just prints "no", leaves
dnl HAVE_BOOST undefined, and sets the BOOST_CPPFLAGS and BOOST_LDFLAGS
dnl variables to "";
dnl * ${prefix} is prepended to the search path.
dnl
dnl Author: Thomas Porschberg <thomas@randspringer.de>
dnl
dnl License:
dnl Copyright © 2006 Thomas Porschberg <thomas@randspringer.de>
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright notice
dnl and this notice are preserved.
dnl-----------------------------------------------------------------------------
AC_DEFUN([AX_BOOST_BASE],
[
AC_ARG_WITH([boost],
AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is Yes) - it is possible to specify the root directory for boost (optional)]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
],
[want_boost="yes"])
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
succeeded=no
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_path/lib"
BOOST_CPPFLAGS="-I$ac_boost_path/include"
else
for ac_boost_path_tmp in ${prefix} /usr /usr/local /opt ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
break;
fi
done
fi
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then
_version=0
if test "$ac_boost_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_path/lib"
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
done
fi
else
for ac_boost_path in /usr /usr/local /opt ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
fi
done
fi
done
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
BOOST_LDFLAGS="-L$best_path/lib"
if test "x$BOOST_ROOT" != "x"; then
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
fi
fi
fi
fi
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
fi
if test "$succeeded" != "yes" ; then
BOOST_CPPFLAGS=""
BOOST_LDFLAGS=""
AC_MSG_RESULT(no)
else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])
dnl-----------------------------------------------------------------------------
dnl Test for Date_Time library from the Boost C++ libraries.
dnl for more information on boost, see http://www.boost.org/
dnl for more information on this macro, see
dnl http://autoconf-archive.cryp.to/ax_boost_date_time.html
dnl
dnl usage:
dnl The macro requires a preceding call to AX_BOOST_BASE.
dnl Further documentation is available at
dnl <http://randspringer.de/boost/index.html>.
dnl
dnl This macro calls: AC_SUBST(BOOST_DATE_TIME_LIB)
dnl and sets: HAVE_BOOST_DATE_TIME
dnl
dnl Modified for Campcaster:
dnl * --with-boost-date-time default changed to Yes.
dnl * added some more recognized suffixes to the library's name, incl. "-st".
dnl
dnl Authors:
dnl Thomas Porschberg <thomas@randspringer.de>
dnl Michael Tindal <mtindal@paradoxpoint.com>
dnl
dnl License:
dnl Copyright © 2006 Thomas Porschberg <thomas@randspringer.de>
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright notice
dnl and this notice are preserved.
dnl-----------------------------------------------------------------------------
AC_DEFUN([AX_BOOST_DATE_TIME],
[
AC_ARG_WITH([boost-date-time],
AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@],
[use the Date_Time library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_date_time_lib=""
else
want_boost="yes"
ax_boost_user_date_time_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
ax_cv_boost_date_time,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>]],
[[using namespace boost::gregorian; date d(2002,Jan,10);
return 0;
]]),
ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_date_time" = "xyes"; then
AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
BN=boost_date_time
if test "x$ax_boost_user_date_time_lib" = "x"; then
for ax_lib in $BN $BN-st $BN-mt $BN-mt-s $BN-s \
$BN-$CC $BN-$CC-st $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
lib$BN lib$BN-st lib$BN-mt lib$BN-mt-s lib$BN-s \
lib$BN-$CC lib$BN-$CC-st lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
$BN-mgw $BN-mgw $BN-mgw-st $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
AC_CHECK_LIB($ax_lib, main, [BOOST_DATE_TIME_LIB="-l$ax_lib" AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes" break],
[link_date_time="no"])
done
else
for ax_lib in $ax_boost_user_date_time_lib $BN-$ax_boost_user_date_time_lib; do
AC_CHECK_LIB($ax_lib, main,
[BOOST_DATE_TIME_LIB="-l$ax_lib" AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes" break],
[link_date_time="no"])
done
fi
if test "x$link_date_time" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])
dnl-----------------------------------------------------------------------------
dnl Macro to check for ICU of sufficient version by looking at icu-config
dnl
dnl usage:
dnl AC_CHECK_ICU(version, action-if, action-not)
dnl
dnl defines ICU_LIBS, ICU_CFLAGS, ICU_CXXFLAGS, see icu-config man page
dnl-----------------------------------------------------------------------------
AC_DEFUN([AC_CHECK_ICU], [
succeeded=no
if test -z "$ICU_CONFIG"; then
AC_PATH_PROG(ICU_CONFIG, icu-config, no)
fi
if test "$ICU_CONFIG" = "no" ; then
echo "*** The icu-config script could not be found. Make sure it is"
echo "*** in your path, and that taglib is properly installed."
echo "*** Or see http://ibm.com/software/globalization/icu/"
else
ICU_VERSION=`$ICU_CONFIG --version`
AC_MSG_CHECKING(for ICU >= $1)
VERSION_CHECK=`expr $ICU_VERSION \>\= $1`
if test "$VERSION_CHECK" = "1" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING(ICU_CFLAGS)
ICU_CFLAGS=`$ICU_CONFIG --cflags`
AC_MSG_RESULT($ICU_CFLAGS)
AC_MSG_CHECKING(ICU_CXXFLAGS)
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
AC_MSG_RESULT($ICU_CXXFLAGS)
AC_MSG_CHECKING(ICU_LIBS)
ICU_LIBS=`$ICU_CONFIG --ldflags`
AC_MSG_RESULT($ICU_LIBS)
else
ICU_CFLAGS=""
ICU_CXXFLAGS=""
ICU_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
ifelse([$3], ,echo "can't find ICU >= $1",)
fi
AC_SUBST(ICU_CFLAGS)
AC_SUBST(ICU_CXXFLAGS)
AC_SUBST(ICU_LIBS)
fi
if test $succeeded = yes; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , AC_MSG_ERROR([Library requirements (ICU) not met.]), [$3])
fi
])

View file

@ -1,130 +0,0 @@
bdnl-----------------------------------------------------------------------------
dnl Copyright (c) 2010 Sourcefabric O.P.S.
dnl
dnl This file is part of the Campcaster project.
dnl http://campcaster.sourcefabric.org/
dnl
dnl Campcaster is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Campcaster is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Campcaster; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl-----------------------------------------------------------------------------
dnl-----------------------------------------------------------------------------
dnl NOTE: Run all configure related scripts from the tmp directory of the
dnl project.
dnl This is due to the fact that configure spreads a lot of trash around,
dnl like atom4te cache directories, config.* files, etc. into the directory
dnl it is being run from. We clearly don't want these in our base directory.
dnl-----------------------------------------------------------------------------
AC_INIT(Widgets, 0.0, bugs@campware.org)
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL])
AC_REVISION($Revision$)
AC_CONFIG_SRCDIR(../src/ComboBoxText.cxx)
AC_CONFIG_HEADERS(configure.h)
AC_PROG_CXX()
AC_CHECK_HEADERS(getopt.h)
dnl-----------------------------------------------------------------------------
dnl specify whether debug info should be compiled into the executable
dnl-----------------------------------------------------------------------------
AC_SUBST(CXXFLAGS)
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [compile with debug info (no)]),
[],
[enable_debug=no])
if test "x${enable_debug}" = "xyes"; then
CXXFLAGS="-g -O0"
AC_DEFINE( YDEBUG, 1, [Debug is on] )
else
CXXFLAGS="-O3"
fi
AC_MSG_RESULT([using compiler options: ${CXXFLAGS}])
dnl-----------------------------------------------------------------------------
dnl specify the pkg-config path
dnl-----------------------------------------------------------------------------
AC_ARG_WITH([pkg-config-path],
AC_HELP_STRING([--with-pkg-config-path],
[use the pkg-config path (prefix/lib/pkgconfig)]),
[PKG_CONFIG_PATH=${withval}],
[PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:$PKG_CONFIG_PATH])
AC_MSG_RESULT([using pkg-config path: ${PKG_CONFIG_PATH}])
export PKG_CONFIG_PATH
export PATH=${prefix}/bin:${PATH}
AX_BOOST_BASE([1.33.1])
if test "x${BOOST_CPPFLAGS}" != "x"; then
AX_BOOST_DATE_TIME
if test "x${BOOST_DATE_TIME_LIB}" = "x"; then
AC_MSG_ERROR([Boost date-time library not found])
fi
else
AC_MSG_ERROR([Boost library >= 1.33.1 not found])
fi
AC_CHECK_ICU(3.0)
AC_SUBST(ICU_CFLAGS)
AC_SUBST(ICU_CXXFLAGS)
AC_SUBST(ICU_LIBS)
AC_PATH_PROG(GENRB, genrb)
AC_SUBST(GENRB)
PKG_CHECK_MODULES(LIBXMLPP,[libxml++-2.6 >= 2.8.1])
AC_SUBST(LIBXMLPP_CFLAGS)
AC_SUBST(LIBXMLPP_LIBS)
PKG_CHECK_MODULES(GTKMM,[gtkmm-2.4 >= 2.5.5])
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)
PKG_CHECK_MODULES(LIBGLADEMM,[libglademm-2.4 >= 2.6.2])
AC_SUBST(LIBGLADEMM_CFLAGS)
AC_SUBST(LIBGLADEMM_LIBS)
dnl-----------------------------------------------------------------------------
dnl enable compilaton for code coverage data
dnl-----------------------------------------------------------------------------
AC_SUBST(COVERAGE_CXXFLAGS)
AC_ARG_ENABLE( coverage,
[ --enable-coverage enable code coverage data generaton (no) ],
ENABLE_COVERAGE=${enableval}, ENABLE_COVERAGE="no" )
if test "x${ENABLE_COVERAGE}" == "xyes" ; then
COVERAGE_CXXFLAGS="-fprofile-arcs -ftest-coverage"
AC_MSG_RESULT([compiling in code coverage mode])
else
AC_MSG_RESULT([not compiling in code coverage mode])
fi
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
AC_OUTPUT()

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE resourceBundle [
<!ELEMENT resourceBundle EMPTY >
<!ATTLIST resourceBundle path CDATA #REQUIRED >
<!ATTLIST resourceBundle locale CDATA #REQUIRED >
]>
<resourceBundle path = "./tmp/localization"
locale = "en"
/>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE widgetFactory [
<!ELEMENT widgetFactory EMPTY >
<!ATTLIST widgetFactory path CDATA #REQUIRED >
]>
<widgetFactory path = "var/"
/>

View file

@ -1,111 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_Colors_h
#define LiveSupport_Widgets_Colors_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <map>
#include "gdkmm/color.h"
#include "gdkmm/colormap.h"
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A helper class to hold all the standard colors used by the LiveSupport GUI.
*
* The definitions of the colors can be found in doc/gui/styleguide.pdf;
* the last two colors were taken from doc/gui/designs/livemode.gif.
*/
class Colors
{
public:
/**
* The names of the colors.
*/
typedef enum { White, Black,
LightBlue, BrightBlue, Blue, DarkBlue,
Gray, SlateGray, MediumBlueGray, DarkGray,
Yellow, Orange, Red,
MasterPanelCenterBlue, LiveModeRowBlue,
WindowBackground = White } ColorName;
private:
/**
* The vector holding the colors.
*/
static std::map<ColorName, Gdk::Color> colors;
/**
* This loads the colors.
*/
static void
initialize(void) throw ();
/**
* Whether we have been initialized yet.
*/
bool
static initialized;
public:
/**
* Get a color by its name.
*/
static const Gdk::Color&
getColor(const ColorName&) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_Colors_h

View file

@ -1,88 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_ComboBoxText_h
#define LiveSupport_Widgets_ComboBoxText_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <gtkmm/comboboxtext.h>
#include <libglademm.h>
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A combo box holding text entries.
* This just adds another constructor to its parent class, so that it can
* be used with Libglade.
*/
class ComboBoxText : public Gtk::ComboBoxText
{
public:
/**
* Constructor to be used with Glade::Xml::get_widget_derived().
*
* @param baseClass widget of the parent class, created by Glade.
* @param glade the Glade object.
*/
ComboBoxText(GtkComboBox * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ();
/**
* A virtual destructor.
*/
virtual
~ComboBoxText(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_ComboBoxText_h

View file

@ -1,129 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_CornerBitmaps_h
#define LiveSupport_Widgets_CornerBitmaps_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include "gdkmm/bitmap.h"
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A helper class to hold a set of corner bitmaps.
*/
class CornerBitmaps
{
public:
/**
* The top left image.
*/
Glib::RefPtr<Gdk::Bitmap> topLeftBitmap;
/**
* The top right image.
*/
Glib::RefPtr<Gdk::Bitmap> topRightBitmap;
/**
* The bottom left image.
*/
Glib::RefPtr<Gdk::Bitmap> bottomLeftBitmap;
/**
* The bottom right image.
*/
Glib::RefPtr<Gdk::Bitmap> bottomRightBitmap;
/**
* The default constructor.
*/
CornerBitmaps(void) throw ()
{
}
/**
* Constructor with image references.
* If any of the images is not available, the result is undefined.
*
* @param topLeftBitmap the top left bitmap of the border
* @param topRightBitmap the top right bitmap of the border
* @param bottomLeftBitmap the bottom left bitmap of the border
* @param bottomRightBitmap the bottom right bitmap of the border
*/
CornerBitmaps(Glib::RefPtr<Gdk::Bitmap> topLeftBitmap,
Glib::RefPtr<Gdk::Bitmap> topRightBitmap,
Glib::RefPtr<Gdk::Bitmap> bottomLeftBitmap,
Glib::RefPtr<Gdk::Bitmap> bottomRightBitmap)
throw ()
{
this->topLeftBitmap = topLeftBitmap;
this->topRightBitmap = topRightBitmap;
this->bottomLeftBitmap = bottomLeftBitmap;
this->bottomRightBitmap = bottomRightBitmap;
}
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~CornerBitmaps(void) throw ()
{
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_CornerBitmaps_h

View file

@ -1,121 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_MetadataComboBoxText_h
#define LiveSupport_Widgets_MetadataComboBoxText_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <libglademm.h>
#include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A combo box holding all possible metadata type entries.
*/
class MetadataComboBoxText : public ComboBoxText
{
private:
/**
* The list of metadata types.
*/
Ptr<const MetadataTypeContainer>::Ref metadataTypes;
public:
/**
* Constructor to be used with Glade::Xml::get_widget_derived().
*
* @param baseClass widget of the parent class, created by Glade.
* @param glade the Glade object.
*/
MetadataComboBoxText(
GtkComboBox * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ();
/**
* A virtual destructor.
*/
virtual
~MetadataComboBoxText(void) throw ();
/**
* Set up the contents of the combo box.
*
* @param metadataTypes contains the metadata keys and values.
*/
void
setContents(Ptr<const MetadataTypeContainer>::Ref metadataTypes)
throw ();
/**
* Get the DC name for the currently selected metadata type.
* This is either a standard Dublin Core metadata type like
* "dc:title" or "dc:creator", or one of the Campcaster
* (née LiveSupport) extensions like "ls:year" or "ls:bpm".
* See the Studio config files for a list of all metadata types.
*
* @return the DC name for the current selection.
*/
Ptr<const Glib::ustring>::Ref
getActiveKey(void)
throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_MetadataComboBoxText_h

View file

@ -1,109 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_OperatorComboBoxText_h
#define LiveSupport_Widgets_OperatorComboBoxText_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A combo box holding all possible search operator entries.
*/
class OperatorComboBoxText : public ComboBoxText,
public LocalizedObject
{
public:
/**
* Constructor to be used with Glade::Xml::get_widget_derived().
*
* @param baseClass widget of the parent class, created by Glade.
* @param glade the Glade object.
*/
OperatorComboBoxText(
GtkComboBox * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ();
/**
* A virtual destructor.
*/
virtual
~OperatorComboBoxText(void) throw ();
/**
* Set up the contents of the combo box.
*
* @param bundle the resource bundle which holds the localized
* operator names.
*/
void
setContents(Ptr<ResourceBundle>::Ref bundle)
throw ();
/**
* Get the currently selected operator.
* This is one of "partial", "prefix", "=", "<=" or ">=".
*
* @return the current selection.
*/
Ptr<const Glib::ustring>::Ref
getActiveKey(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_OperatorComboBoxText_h

View file

@ -1,88 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_PlayableTreeModelColumnRecord_h
#define LiveSupport_Widgets_PlayableTreeModelColumnRecord_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Playable.h"
#include <LiveSupport/Widgets/ZebraTreeModelColumnRecord.h>
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A basic column record class for tree models with colorable rows and a
* (usually invisible) column of type Ptr<Playable>::Ref.
*/
class PlayableTreeModelColumnRecord : public ZebraTreeModelColumnRecord
{
public:
/**
* The column for the playable object shown in the row.
*/
Gtk::TreeModelColumn<Ptr<Playable>::Ref> playableColumn;
/**
* Constructor.
*/
PlayableTreeModelColumnRecord(void) throw ()
{
add(playableColumn);
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_PlayableTreeModelColumnRecord_h

View file

@ -1,78 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author $
Version : $Revision $
Location : $URL $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_WidgetConstants_h
#define LiveSupport_Widgets_WidgetConstants_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A collection of constants used by the widgets.
*
* @author $Author $
* @version $Revision $
*/
class WidgetConstants
{
public:
/**
* The list of available miscellaneous images.
*/
typedef enum { audioClipIconImage,
playlistIconImage } ImageType;
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_WidgetConstants_h

View file

@ -1,184 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_WidgetFactory_h
#define LiveSupport_Widgets_WidgetFactory_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <gtkmm/image.h>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Widgets/WidgetConstants.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A factory to provide access to some Campcaster Widgets.
* As of Aug 2007, it is only used to retrieve the audio clip and playlist
* icon images. It may be extended later, or it may be removed.
*
* The singleton instance of this class has to be configured with an XML
* element, which looks like the following:
*
* <pre><code>
* &lt;widgetFactory&gt; path = "path/to/widget/images/"
* &lt;/&gt;
* </code></pre>
*
* The DTD for the above XML structure is:
*
* <pre><code>
* <!ELEMENT widgetFactory EMPTY >
* <!ATTLIST widgetFactory path CDATA #REQUIRED >
* </code></pre>
*/
class WidgetFactory : public Configurable
{
private:
/**
* The name of the configuration XML elmenent used by this object.
*/
static const std::string configElementNameStr;
/**
* The singleton instance of this object.
*/
static Ptr<WidgetFactory>::Ref singleton;
/**
* The path to load the images from for the widgets.
*/
std::string path;
/**
* A container holding the miscallenous image pixbuf references.
*/
std::map<WidgetConstants::ImageType, Glib::RefPtr<Gdk::Pixbuf> >
imageTypePixbufs;
/**
* The default constructor.
*/
WidgetFactory(void) throw ()
{
}
/**
* Load an image relative the path, and signal error if not found.
*
* @param imageName the name of the image, relative to path
* @return the loaded image
* @exception std::invalid_argument if the image was not found
*/
Glib::RefPtr<Gdk::Pixbuf>
loadImage(const std::string imageName)
throw (std::invalid_argument);
public:
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~WidgetFactory(void) throw ()
{
}
/**
* Return the name of the XML element this object expects
* to be sent to a call to configure().
*
* @return the name of the expected XML configuration element.
*/
static const std::string
getConfigElementName(void) throw ()
{
return configElementNameStr;
}
/**
* Returns the singleton instance of this object.
*
* @return the singleton instance of this object.
*/
static Ptr<WidgetFactory>::Ref
getInstance() throw ();
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the object has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error);
/**
* Return a smart pointer to a Gdk::Pixbuf holding a named image.
*
* @return the image.
*/
Glib::RefPtr<Gdk::Pixbuf>
getPixbuf(WidgetConstants::ImageType imageName) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_WidgetFactory_h

View file

@ -1,113 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_ZebraCellRenderer_h
#define LiveSupport_Widgets_ZebraCellRenderer_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "gtkmm/cellrenderertext.h"
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A custom cell renderer for blue-gray striped TreeView's.
* This is not used anywhere at the moment, but it's left in here because
* we will probably need (something like) this later.
*/
class ZebraCellRenderer : public Gtk::CellRendererText
{
public:
/**
* Default constructor.
*/
ZebraCellRenderer() throw ();
/**
* A virtual destructor.
*/
virtual ~ZebraCellRenderer() throw ();
protected:
/**
* Calculate the size of the cell.
*/
virtual void get_size_vfunc(Gtk::Widget& widget,
const Gdk::Rectangle* cell_area,
int* x_offset, int* y_offset,
int* width, int* height) const
throw ();
/**
* Draw the cell.
*/
virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
const Gdk::Rectangle& expose_area,
Gtk::CellRendererState flags)
throw ();
/**
* The user clicked on the cell.
*/
virtual bool activate_vfunc(GdkEvent* event,
Gtk::Widget& widget,
const Glib::ustring& path,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags)
throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_ZebraCellRenderer_h

View file

@ -1,81 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_ZebraTreeModelColumnRecord_h
#define LiveSupport_Widgets_ZebraTreeModelColumnRecord_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <gtkmm/treemodelcolumn.h>
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A basic column record class for tree models with colorable rows.
*/
class ZebraTreeModelColumnRecord : public Gtk::TreeModelColumnRecord
{
public:
/**
* The column for the color of the row.
*/
Gtk::TreeModelColumn<int> rowNumberColumn;
/**
* Constructor.
*/
ZebraTreeModelColumnRecord(void) throw ()
{
add(rowNumberColumn);
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_ZebraTreeModelColumnRecord_h

View file

@ -1,430 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_ZebraTreeView_h
#define LiveSupport_Widgets_ZebraTreeView_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <gtkmm/liststore.h>
#include <gtkmm/treeview.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/WidgetConstants.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A table of items, in rows colored alternately gray and light blue.
*
* NOTE: the ZebraTreeView works only with models based on a
* ZebraTreeModelColumRecord column record, because cellDataFunction()
* and renumberRows() refer to the row number column of the model.
* AFAIK there is no way to syntactically enforce this, so you need to
* remember it.
*
* General comments about TreeViews:
*
* TreeViews contain TreeViewColumns; these contain a title (a text Label)
* and a table column body (a CellRenderer). The CellRenderer needs to be
* both 'added' to the TreeViewColumn, and 'connected' to a TreeModel
* column.
*
* A single TreeViewColumn may contain several CellRenderers, i.e.,
* sub-columns.
*
* The standard CellRenderer types (CellRendererText etc) can not be
* instantiated by the user; they can only be created by the shortcut
* TreeViewColumn constructor or the append_column() or insert_column()
* functions in TreeView. These create the appropriate CellRenderer,
* add it the tree view column, and connect it with the tree model column.
*
* A derived CellRenderer sub-type needs to be 1) instantiated;
* 2) added to a TreeViewColumn using a constructor or pack_start() etc;
* 3) connected with a TreeModelColumn using TreeViewColumn::set_renderer().
*/
class ZebraTreeView : public Gtk::TreeView
{
private:
/**
* Default constructor.
*/
ZebraTreeView(void) throw ()
{
}
/**
* The callback function to set the colors of the rows.
*
* @param cell the cell renderer of the column.
* @param iter points to the current row in the model.
*/
void
cellDataFunction(Gtk::CellRenderer* cell,
const Gtk::TreeModel::iterator& iter)
throw ();
/**
* The callback function for the line number columns.
* It reads the line number from the rowNumberColumn of the model.
*
* @param cell the cell renderer of the column.
* @param iter points to the current row in the model.
* @param offset the line number of the first row, set by the
* call to appendLineNumberColumn()
*/
void
lineNumberCellDataFunction(
Gtk::CellRenderer* cell,
const Gtk::TreeModel::iterator& iter,
int offset)
throw ();
/**
* Emit the "cell has been edited" signal.
*/
void
emitSignalCellEdited(const Glib::ustring & path,
const Glib::ustring & newText,
int columnId)
throw ()
{
signalCellEdited().emit(path, columnId, newText);
}
/**
* Emit the "tree model has changed" signal.
*/
void
emitSignalTreeModelChanged(void)
throw ()
{
signalTreeModelChanged().emit();
}
/**
* Renumber the rows after they have changed.
*
* This is called from the onRowInserted(), onRowDeleted() and
* onRowsReordered() signal handlers.
*/
void
renumberRows(void) throw ();
/**
* Find the selected row.
* Returns the selected row (if the selection type is single),
* or the first selected row (if the selection type is multiple).
* May return 0 if no row is selected.
*
* @return an iterator pointing to the selected row; or 0.
*/
Gtk::TreeModel::iterator
getSelectedRow(void) throw ();
protected:
/**
* A signal object to notify people that a cell has been edited.
*/
sigc::signal<void,
const Glib::ustring &,
int,
const Glib::ustring &> signalCellEditedObject;
/**
* A signal object to notify people that the tree model has changed.
*/
sigc::signal<void> signalTreeModelChangedObject;
/**
* Event handler for the row_inserted signal.
*
* @param path a path pointing to the inserted row.
* @param iter an iterator pointing to the inserted row.
*/
void
onRowInserted(const Gtk::TreeModel::Path & path,
const Gtk::TreeModel::iterator & iter)
throw ();
/**
* Event handler for the row_deleted signal.
*
* @param path points to the previous location of the deleted row.
*/
void
onRowDeleted(const Gtk::TreeModel::Path & path) throw ();
/**
* Event handler for the rows_reordered signal.
*
* @param path points to the tree node whose children have been
* reordered.
* @param iter points to the node whose children have been
* reordered, or 0 if the depth of path is 0.
* @param mapping an array of integers mapping the current position
* of each child to its old position before the
* re-ordering, i.e. mapping[newpos] = oldpos.
*/
void
onRowsReordered(const Gtk::TreeModel::Path & path,
const Gtk::TreeModel::iterator& iter,
int* mapping)
throw ();
/**
* Event handler for the row_expanded signal.
*
* @param iter points to the expanded row.
* @param path points to the expanded row.
*/
void
onRowExpanded(const Gtk::TreeModel::iterator & iter,
const Gtk::TreeModel::Path & path) throw ();
/**
* Event handler for the row_collapsed signal.
*
* @param iter points to the collapsed row.
* @param path points to the collapsed row.
*/
void
onRowCollapsed(const Gtk::TreeModel::iterator & iter,
const Gtk::TreeModel::Path & path) throw ();
public:
/**
* Constructor.
*
* @param treeModel the data the treeView will show.
*/
ZebraTreeView(Glib::RefPtr<Gtk::TreeModel> treeModel)
throw ();
/**
* Constructor to be used with Glade::Xml::get_widget_derived().
*
* @param baseClass widget of the parent class, created by Glade.
* @param glade the Glade object.
*/
ZebraTreeView(_GtkTreeView * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ();
/**
* A virtual destructor.
*/
virtual
~ZebraTreeView(void) throw ();
/**
* Add a text column to the TreeView.
*
* @param title the title of the column
* @param modelColumn the model column this view will display
* @param minimumWidth the minimum width of the column, in pixels
* (optional)
* @return the number of columns after adding this one
*/
int
appendColumn(const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
int minimumWidth = 0)
throw ();
/**
* Add an image column to the TreeView.
*
* @param title the title of the column
* @param modelColumn the model column this view will display
* @param minimumWidth the minimum width of the column, in pixels
* (optional)
* @return the number of columns after adding this one
*/
int
appendColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > &
modelColumn,
int minimumWidth = 0)
throw ();
/**
* Add a centered text column to the TreeView.
*
* @param title the title of the column
* @param modelColumn the model column this view will display
* @param minimumWidth the minimum width of the column, in pixels
* (optional)
* @return the number of columns after adding this one
*/
int
appendCenteredColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
int minimumWidth = 0)
throw ();
/**
* Add a centered line number column to the TreeView.
*
* @param title the title of the column
* @param offset the line number of the first row
* @param minimumWidth the minimum width of the column, in pixels
* (optional)
* @return the number of columns after adding this one
*/
int
appendLineNumberColumn(
const Glib::ustring& title,
int offset = 0,
int minimumWidth = 0)
throw ();
/**
* Add an editable text column to the TreeView.
*
* The signal_edited() signal of the cell renderer gets connected
* to the signalEdited() signal of the ZebraTreeView object; the
* columnId argument will get passed to the signal handler.
*
* This is used to display fade info (time durations), so the text is
* right aligned in the column.
*
* @param title the title of the column
* @param modelColumn the model column this view will display
* @param columnId the column ID passed to the signal handler
* @param minimumWidth the minimum width of the column, in pixels
* (optional)
* @return the number of columns after adding this one
*/
int
appendEditableColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
int columnId,
int minimumWidth = 0)
throw ();
/**
* Signal handler for the "up" menu option selected from
* the context menu.
*/
void
onUpMenuOption(void) throw ();
/**
* Signal handler for the "down" menu option selected from
* the context menu.
*/
void
onDownMenuOption(void) throw ();
/**
* Signal handler for the "remove" menu option selected from
* the context menu.
*/
void
onRemoveMenuOption(void) throw ();
/**
* Remove an item from the window.
*
* @param iter points to the row to be removed
*/
void
removeItem(const Gtk::TreeModel::iterator & iter) throw ();
/**
* The signal raised when a cell has been edited.
*
* @return the signal object (a protected member of this class)
*/
sigc::signal<void, const Glib::ustring &, int, const Glib::ustring &>
signalCellEdited(void) throw ()
{
return signalCellEditedObject;
}
/**
* The signal raised when the rows in the tree model have changed.
* This signal is emitted whenever the tree model emits a
* row_inserted, row_deleted or rows_reordered signal.
*
* @return the signal object (a protected member of this class)
*/
sigc::signal<void>
signalTreeModelChanged(void) throw ()
{
return signalTreeModelChangedObject;
}
/**
* Manually connect the 'model has changed' signals to the tree view.
* This is useful if you want to use the same ZebraTreeView object
* to alternately display two (or more) different tree models.
*
* @param treeModel the tree model whose changes should trigger
* a redraw of the tree view object
*/
void
connectModelSignals(Glib::RefPtr<Gtk::TreeModel> treeModel)
throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_ZebraTreeView_h

View file

@ -1 +0,0 @@
keep me

View file

@ -1,132 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <iostream>
#include "gtkmm/widget.h"
#include "LiveSupport/Widgets/Colors.h"
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/**
* The vector holding the colors.
*/
std::map<Colors::ColorName, Gdk::Color> Colors :: colors;
/**
* Clear the "initialized" flag.
*/
bool Colors :: initialized = false;
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Load the colors.
*----------------------------------------------------------------------------*/
void
Colors :: initialize(void) throw ()
{
Gdk::Color whiteColor ("#ffffff");
Gdk::Color blackColor ("#000000");
Gdk::Color lightBlueColor ("#cfdee7");
Gdk::Color brightBlueColor ("#6fb0ff");
Gdk::Color blueColor ("#9ebadb");
Gdk::Color darkBlueColor ("#688597");
Gdk::Color grayColor ("#eaeaea");
Gdk::Color slateGrayColor ("#c7cdd3");
Gdk::Color mediumBlueGrayColor ("#97bacf");
Gdk::Color darkGrayColor ("#5a5a5a");
Gdk::Color yellowColor ("#ffff99");
Gdk::Color orangeColor ("#ff4b00");
Gdk::Color redColor ("#ff4b4b");
Gdk::Color masterPanelCenterBlueColor ("#99cdff");
Gdk::Color liveModeRowBlueColor ("#cde0f1");
Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
colormap->alloc_color(whiteColor);
colormap->alloc_color(blackColor);
colormap->alloc_color(lightBlueColor);
colormap->alloc_color(brightBlueColor);
colormap->alloc_color(blueColor);
colormap->alloc_color(darkBlueColor);
colormap->alloc_color(grayColor);
colormap->alloc_color(slateGrayColor);
colormap->alloc_color(mediumBlueGrayColor);
colormap->alloc_color(darkGrayColor);
colormap->alloc_color(yellowColor);
colormap->alloc_color(orangeColor);
colormap->alloc_color(redColor);
colormap->alloc_color(masterPanelCenterBlueColor);
colormap->alloc_color(liveModeRowBlueColor);
colors[White] = whiteColor;
colors[Black] = blackColor;
colors[LightBlue] = lightBlueColor;
colors[BrightBlue] = brightBlueColor;
colors[Blue] = blueColor;
colors[DarkBlue] = darkBlueColor;
colors[Gray] = grayColor;
colors[SlateGray] = slateGrayColor;
colors[MediumBlueGray] = mediumBlueGrayColor;
colors[DarkGray] = darkGrayColor;
colors[Yellow] = yellowColor;
colors[Orange] = orangeColor;
colors[Red] = redColor;
colors[MasterPanelCenterBlue]
= masterPanelCenterBlueColor;
colors[LiveModeRowBlue] = liveModeRowBlueColor;
initialized = true;
}
/*------------------------------------------------------------------------------
* Get a color by its name.
*----------------------------------------------------------------------------*/
const Gdk::Color&
Colors :: getColor(const ColorName& name) throw ()
{
if (!initialized) {
initialize();
}
return colors[name];
}

View file

@ -1,64 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/ComboBoxText.h"
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
ComboBoxText :: ComboBoxText(
GtkComboBox * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ()
: Gtk::ComboBoxText(baseClass)
{
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
ComboBoxText :: ~ComboBoxText(void) throw ()
{
}

View file

@ -1,97 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/MetadataComboBoxText.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
MetadataComboBoxText :: MetadataComboBoxText(
GtkComboBox * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ()
: ComboBoxText(baseClass, glade)
{
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
MetadataComboBoxText :: ~MetadataComboBoxText(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Set up the contents of the combo box.
*----------------------------------------------------------------------------*/
void
MetadataComboBoxText :: setContents(
Ptr<const MetadataTypeContainer>::Ref metadataTypes)
throw ()
{
this->metadataTypes = metadataTypes;
MetadataTypeContainer::Vector::const_iterator it;
for (it = metadataTypes->begin(); it != metadataTypes->end(); ++it) {
Ptr<const MetadataType>::Ref metadata = *it;
append_text(*metadata->getLocalizedName());
}
set_active(0); // select the first item
}
/*------------------------------------------------------------------------------
* Set up the contents of the combo box.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
MetadataComboBoxText :: getActiveKey(void)
throw ()
{
Ptr<const MetadataType>::Ref metadata = metadataTypes->getByIndex(
get_active_row_number());
return metadata->getDcName();
}

View file

@ -1,122 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <iostream>
#include <libglademm.h>
#include "LiveSupport/Widgets/OperatorComboBoxText.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
OperatorComboBoxText :: OperatorComboBoxText(
GtkComboBox * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ()
: ComboBoxText(baseClass, glade)
{
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
OperatorComboBoxText :: ~OperatorComboBoxText(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Set up the contents of the combo box.
*----------------------------------------------------------------------------*/
void
OperatorComboBoxText :: setContents(Ptr<ResourceBundle>::Ref bundle)
throw ()
{
setBundle(bundle);
append_text(*getResourceUstring("partialOperatorDisplay"));
append_text(*getResourceUstring("prefixOperatorDisplay"));
append_text(*getResourceUstring("=OperatorDisplay"));
append_text(*getResourceUstring("<=OperatorDisplay"));
append_text(*getResourceUstring(">=OperatorDisplay"));
set_active(0);
}
/*------------------------------------------------------------------------------
* Set up the contents of the combo box.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
OperatorComboBoxText :: getActiveKey(void) throw ()
{
Ptr<Glib::ustring>::Ref selectedOperator(new Glib::ustring);
int selectedRow = get_active_row_number();
switch (selectedRow) {
case 0: selectedOperator->assign("partial");
break;
case 1: selectedOperator->assign("prefix");
break;
case 2: selectedOperator->assign("=");
break;
case 3: selectedOperator->assign("<=");
break;
case 4: selectedOperator->assign(">=");
break;
default: std::cerr << "impossible value '"
<< selectedRow
<< "' in OperatorComboBoxText::getActiveKey"
<< std::endl;
std::exit(1);
break;
}
return selectedOperator;
}

View file

@ -1,472 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <iostream>
#include <cassert>
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/Colors.h"
#include "TestWindow.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
namespace {
/*------------------------------------------------------------------------------
* The name of the configuration file for the resource bundle.
*----------------------------------------------------------------------------*/
const std::string bundleConfigFileName = "etc/resourceBundle.xml";
/*------------------------------------------------------------------------------
* The name of the Glade file.
*----------------------------------------------------------------------------*/
const std::string gladeFileName = "var/glade/TestWindow.glade";
}
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
TestWindow :: TestWindow (void) throw ()
{
configureBundle();
Glib::RefPtr<Gnome::Glade::Xml> glade = Gnome::Glade::Xml::create(
gladeFileName);
glade->get_widget("mainWindow1", mainWindow);
mainWindow->set_title(*getResourceUstring("windowTitle"));
mainWindow->signal_delete_event().connect(sigc::mem_fun(*this,
&TestWindow::onDeleteEvent));
glade->get_widget_derived("combobox1", comboBox);
comboBox->append_text(*getResourceUstring("firstOption"));
comboBox->append_text(*getResourceUstring("secondOption"));
comboBox->append_text(*getResourceUstring("thirdOption"));
comboBox->set_active(0);
comboBox->signal_changed().connect(sigc::mem_fun(*this,
&TestWindow::onComboBoxSelectionChanged));
treeModel[0] = Gtk::ListStore::create(modelColumns);
glade->get_widget_derived("treeview1", treeView[0]);
treeView[0]->set_model(treeModel[0]);
treeView[0]->connectModelSignals(treeModel[0]);
treeView[0]->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
treeView[0]->appendColumn(*getResourceUstring("pixbufColumnTitle"),
modelColumns.pixbufColumn);
treeView[0]->appendColumn(*getResourceUstring("textColumnTitle"),
modelColumns.textColumn);
fillTreeModel(0);
treeModel[1] = Gtk::ListStore::create(modelColumns);
glade->get_widget_derived("treeview2", treeView[1]);
treeView[1]->set_model(treeModel[1]);
treeView[1]->connectModelSignals(treeModel[1]);
treeView[1]->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
treeView[1]->appendColumn(*getResourceUstring("pixbufColumnTitle"),
modelColumns.pixbufColumn);
treeView[1]->appendColumn(*getResourceUstring("textColumnTitle"),
modelColumns.textColumn);
fillTreeModel(1);
glade->get_widget("label1", label);
label->set_label(*getResourceUstring("dropHereText"));
setupDndCallbacks();
glade->connect_clicked("button1", sigc::mem_fun(*this,
&TestWindow::onOkButtonClicked));
}
/*------------------------------------------------------------------------------
* Configure the resource bundle.
*----------------------------------------------------------------------------*/
void
TestWindow :: configureBundle (void) throw ()
{
Ptr<ResourceBundle>::Ref bundle;
try {
Ptr<xmlpp::DomParser>::Ref parser(
new xmlpp::DomParser(bundleConfigFileName, true));
const xmlpp::Document * document = parser->get_document();
const xmlpp::Element * root = document->get_root_node();
bundle = LocalizedObject::getBundle(*root);
} catch (std::invalid_argument &e) {
std::cerr << "semantic error in bundle configuration file:\n"
<< e.what() << std::endl;
exit(1);
} catch (std::exception &e) {
std::cerr << "XML error in bundle configuration file:\n"
<< e.what() << std::endl;
exit(1);
}
setBundle(bundle);
}
/*------------------------------------------------------------------------------
* Fill the left tree model.
*----------------------------------------------------------------------------*/
void
TestWindow :: fillTreeModel (int index) throw ()
{
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
Glib::RefPtr<Gdk::Pixbuf> pixbuf = wf->getPixbuf(
WidgetConstants::audioClipIconImage);
Gtk::TreeModel::Row row;
treeModel[index]->clear();
if (index == 0) {
Glib::ustring text;
switch (comboBox->get_active_row_number()) {
case -1: break;
case 0: text = *getResourceUstring("textOne");
break;
case 1: text = *getResourceUstring("textTwo");
break;
case 2: text = *getResourceUstring("textThree");
break;
default: break;
}
row = *treeModel[index]->append();
row[modelColumns.pixbufColumn] = pixbuf;
row[modelColumns.textColumn] = text;
}
row = *treeModel[index]->append();
row[modelColumns.pixbufColumn] = pixbuf;
row[modelColumns.textColumn] = (index == 0) ? "1111111111"
: "AAAAAAAAAA";
row = *treeModel[index]->append();
row[modelColumns.pixbufColumn] = pixbuf;
row[modelColumns.textColumn] = (index == 0) ? "2222222222"
: "BBBBBBBBBB";
row = *treeModel[index]->append();
row[modelColumns.pixbufColumn] = pixbuf;
row[modelColumns.textColumn] = (index == 0) ? "3333333333"
: "CCCCCCCCCC";
row = *treeModel[index]->append();
row[modelColumns.pixbufColumn] = pixbuf;
row[modelColumns.textColumn] = (index == 0) ? "4444444444"
: "EEEEEEEEEE";
}
/*------------------------------------------------------------------------------
* Set up the D'n'D callbacks.
*----------------------------------------------------------------------------*/
void
TestWindow :: setupDndCallbacks (void) throw ()
{
std::list<Gtk::TargetEntry> targets;
targets.push_back(Gtk::TargetEntry("STRING",
Gtk::TARGET_SAME_APP));
// set up the left tree view
treeView[0]->enable_model_drag_source(targets);
treeView[0]->signal_drag_data_get().connect(sigc::bind<int>(
sigc::mem_fun(*this,
&TestWindow::onTreeViewDragDataGet),
0));
treeView[0]->enable_model_drag_dest(targets);
treeView[0]->signal_drag_data_received().connect(sigc::bind<int>(
sigc::mem_fun(*this,
&TestWindow::onTreeViewDragDataReceived),
0));
// set up the right tree view
treeView[1]->enable_model_drag_source(targets);
treeView[1]->signal_drag_data_get().connect(sigc::bind<int>(
sigc::mem_fun(*this,
&TestWindow::onTreeViewDragDataGet),
1));
treeView[1]->enable_model_drag_dest(targets);
treeView[1]->signal_drag_data_received().connect(sigc::bind<int>(
sigc::mem_fun(*this,
&TestWindow::onTreeViewDragDataReceived),
1));
// set up the label
label->drag_dest_set(targets);
label->signal_drag_data_received().connect(sigc::mem_fun(*this,
&TestWindow::onLabelDragDataReceived));
}
/*------------------------------------------------------------------------------
* Event handler for selection change in the combo box.
*----------------------------------------------------------------------------*/
void
TestWindow :: onComboBoxSelectionChanged (void) throw ()
{
fillTreeModel(0);
}
/*------------------------------------------------------------------------------
* Event handler for the OK button being clicked.
*----------------------------------------------------------------------------*/
void
TestWindow :: onOkButtonClicked (void) throw ()
{
std::cerr << "TestWindow::onOkButtonClicked() called." << std::endl;
mainWindow->hide();
}
/*------------------------------------------------------------------------------
* Event handler for the window being hidden.
*----------------------------------------------------------------------------*/
bool
TestWindow :: onDeleteEvent (GdkEventAny * event) throw ()
{
// We could add a confirmation dialog here.
std::cerr << "TestWindow::onDeleteEvent() called." << std::endl;
return false;
}
/*------------------------------------------------------------------------------
* Run the window.
*----------------------------------------------------------------------------*/
void
TestWindow :: run (void) throw ()
{
Gtk::Main::run(*mainWindow);
}
/*------------------------------------------------------------------------------
* The callback for the start of the drag.
*----------------------------------------------------------------------------*/
void
TestWindow :: onTreeViewDragDataGet(
const Glib::RefPtr<Gdk::DragContext> & context,
Gtk::SelectionData & selectionData,
guint info,
guint time,
int index)
throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> selection
= treeView[index]->get_selection();
std::list<Gtk::TreePath> rows = selection->get_selected_rows();
Glib::ustring dropString = leftOrRight(index);
// we can assume there is only one row selected, due to bug
// http://bugzilla.gnome.org/show_bug.cgi?id=70479
assert (rows.size() == 1);
Gtk::TreeRow row = *treeModel[index]->get_iter(rows.front());
dropString += " ";
dropString += row[modelColumns.textColumn];
selectionData.set(selectionData.get_target(),
8 /* 8 bits format*/,
(const guchar *) dropString.c_str(),
dropString.bytes());
}
/*------------------------------------------------------------------------------
* The callback for the end of the drag.
*----------------------------------------------------------------------------*/
void
TestWindow :: onTreeViewDragDataReceived(
const Glib::RefPtr<Gdk::DragContext> & context,
int x,
int y,
const Gtk::SelectionData & selectionData,
guint info,
guint time,
int index)
throw ()
{
if (selectionData.get_length() < 0 || selectionData.get_format() != 8) {
std::cerr << "unknown type of data dropped on "
<< leftOrRight(index)
<< " tree view"
<< std::endl;
context->drag_finish(false, false, time);
return;
}
Glib::ustring data = selectionData.get_data_as_string();
Glib::ustring stripped;
int source = -1;
int destination = index;
if (data.find("left") == 0) {
std::cerr << "left -> "
<< leftOrRight(index)
<< ": "
<< data.substr(5)
<< std::endl;
stripped = data.substr(5);
source = 0;
} else if (data.find("right") == 0) {
std::cerr << "right -> "
<< leftOrRight(index)
<< ": "
<< data.substr(6)
<< std::endl;
stripped = data.substr(6);
source = 1;
} else {
std::cerr << "unknown string dropped on "
<< leftOrRight(index)
<< " tree view: "
<< data
<< std::endl;
context->drag_finish(false, false, time);
return;
}
if (source == destination) {
insertRow(destination, x, y, stripped, ROW_MOVE);
context->drag_finish(true, true, time);
} else {
insertRow(destination, x, y, stripped, ROW_COPY);
context->drag_finish(true, false, time);
}
}
/*------------------------------------------------------------------------------
* Insert a string row into a tree view.
*----------------------------------------------------------------------------*/
void
TestWindow :: insertRow (int index,
int x,
int y,
Glib::ustring value,
RowOperation operation) throw ()
{
Gtk::TreePath destPath;
Gtk::TreeViewDropPosition destPos;
bool pathIsValid = treeView[index]->get_dest_row_at_pos(
x, y, destPath, destPos);
// get_drag_dest_row() does not work here, for some strange reason
Gtk::TreeRow newRow;
if (pathIsValid) {
assert (!destPath.empty());
Gtk::TreeIter destination = treeModel[index]->get_iter(destPath);
if (destPos == Gtk::TREE_VIEW_DROP_BEFORE
|| destPos == Gtk::TREE_VIEW_DROP_INTO_OR_BEFORE) {
newRow = *treeModel[index]->insert(destination);
} else if (destPos == Gtk::TREE_VIEW_DROP_AFTER
|| destPos == Gtk::TREE_VIEW_DROP_INTO_OR_AFTER) {
newRow = *treeModel[index]->insert_after(destination);
} else {
assert (false);
return;
}
} else {
newRow = *treeModel[index]->append();
}
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
Glib::RefPtr<Gdk::Pixbuf> pixbuf = wf->getPixbuf(
WidgetConstants::audioClipIconImage);
newRow[modelColumns.pixbufColumn] = pixbuf;
newRow[modelColumns.textColumn] = value;
if (operation == ROW_MOVE) {
Glib::RefPtr<Gtk::TreeView::Selection>
selection = treeView[index]->get_selection();
std::list<Gtk::TreePath>
rows = selection->get_selected_rows();
assert (rows.size() == 1);
Gtk::TreeIter source = treeModel[index]->get_iter(rows.front());
treeModel[index]->erase(source);
}
}
/*------------------------------------------------------------------------------
* The callback for the end of the drag.
*----------------------------------------------------------------------------*/
void
TestWindow :: onLabelDragDataReceived(
const Glib::RefPtr<Gdk::DragContext> & context,
int x,
int y,
const Gtk::SelectionData & selectionData,
guint info,
guint time)
throw ()
{
if (selectionData.get_length() >= 0 && selectionData.get_format() == 8) {
Glib::ustring data = selectionData.get_data_as_string();
label->set_label(data);
context->drag_finish(true, true, time);
} else {
std::cerr << "unknown type of data dropped on the label"
<< std::endl;
label->set_label(*getResourceUstring("dropHereText"));
context->drag_finish(false, false, time);
}
}

View file

@ -1,288 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
#ifndef TestWindow_h
#define TestWindow_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A window, enabling interactive testing of UI components.
*/
class TestWindow : public LocalizedObject
{
public:
/**
* The possible DnD operations.
*/
typedef enum { ROW_COPY,
ROW_MOVE } RowOperation;
private:
/**
* Configure the resource bundle.
*/
void
configureBundle (void) throw ();
/**
* Fill one of the tree models.
*
* @param index which tree model to fill.
*/
void
fillTreeModel (int index) throw ();
/**
* Set up the D'n'D callbacks.
*/
void
setupDndCallbacks (void) throw ();
/**
* Return either "left" or "right".
*
* @param index 0 for left, 1 for right.
*/
Glib::ustring
leftOrRight (int index) throw ()
{
if (index == 0) {
return "left";
} else {
return "right";
}
}
/**
* Insert a string row into a tree view.
*
* @param index which tree view to work on.
* @param x the x coordinate of the location of the new row.
* @param y the y coordinate of the location of the new row.
* @param value the string to put into the new row.
* @param operation whether to copy or move the row.
*/
void
insertRow (int index,
int x,
int y,
Glib::ustring value,
RowOperation operation) throw ();
protected:
/**
* The window itself.
*/
Gtk::Window * mainWindow;
/**
* The combo box.
*/
ComboBoxText * comboBox;
/**
* The tree views.
*/
ZebraTreeView * treeView[2];
/**
* The drop target label.
*/
Gtk::Label * label;
/**
* The OK button.
*/
Gtk::Button * okButton;
/**
* The columns model needed by Gtk::TreeView.
*/
class ModelColumns : public ZebraTreeModelColumnRecord
{
public:
/**
* A column showing a Pixbuf.
*/
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> >
pixbufColumn;
/**
* A text column.
*/
Gtk::TreeModelColumn<Glib::ustring> textColumn;
/**
* Constructor.
*/
ModelColumns(void) throw ()
{
add(pixbufColumn);
add(textColumn);
}
};
/**
* The column model.
*/
ModelColumns modelColumns;
/**
* The tree models, as GTK references.
*/
Glib::RefPtr<Gtk::ListStore> treeModel[2];
/**
* Event handler for selection change in the combo box.
*/
virtual void
onComboBoxSelectionChanged (void) throw ();
/**
* Event handler for the OK button being clicked.
*/
virtual void
onOkButtonClicked (void) throw ();
/**
* Event handler for the window being hidden.
*/
virtual bool
onDeleteEvent (GdkEventAny * event) throw ();
/**
* The callback for the start of the drag.
*
* @param index which tree view to drag from.
*/
virtual void
onTreeViewDragDataGet(
const Glib::RefPtr<Gdk::DragContext> & context,
Gtk::SelectionData & selectionData,
guint info,
guint time,
int index)
throw ();
/**
* The callback for the end of the drag.
*
* @param index which tree view to drop to.
*/
virtual void
onTreeViewDragDataReceived(
const Glib::RefPtr<Gdk::DragContext> & context,
int x,
int y,
const Gtk::SelectionData & selectionData,
guint info,
guint time,
int index)
throw ();
/**
* The callback for the end of the drag.
*/
virtual void
onLabelDragDataReceived(
const Glib::RefPtr<Gdk::DragContext> & context,
int x,
int y,
const Gtk::SelectionData & selectionData,
guint info,
guint time)
throw ();
public:
/**
* Constructor.
*/
TestWindow (void) throw ();
/**
* Virtual destructor.
*/
virtual
~TestWindow (void) throw ()
{
}
/**
* Run the window.
*/
void
run (void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // TestWindow_h

View file

@ -1,156 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/WidgetFactory.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/*------------------------------------------------------------------------------
* The name of the config element for this class
*----------------------------------------------------------------------------*/
const std::string WidgetFactory::configElementNameStr = "widgetFactory";
/*------------------------------------------------------------------------------
* The singleton instance of WidgetFactory
*----------------------------------------------------------------------------*/
Ptr<WidgetFactory>::Ref WidgetFactory::singleton;
namespace {
/*------------------------------------------------------------------------------
* The name of the attribute to get the path for the widget images.
*----------------------------------------------------------------------------*/
const std::string pathAttrName = "path";
/*------------------------------------------------------------------------------
* The relative path for the standard button images.
*----------------------------------------------------------------------------*/
const std::string buttonPath = "button/";
/*------------------------------------------------------------------------------
* The name of the image for the audio clip icon.
*----------------------------------------------------------------------------*/
const std::string audioClipIconImageName = "icons/audioClipIcon.png";
/*------------------------------------------------------------------------------
* The name of the image for the playlist icon.
*----------------------------------------------------------------------------*/
const std::string playlistIconImageName = "icons/playlistIcon.png";
}
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Return the singleton instance to WidgetFactory
*----------------------------------------------------------------------------*/
Ptr<WidgetFactory>::Ref
WidgetFactory :: getInstance(void) throw ()
{
if (!singleton.get()) {
singleton.reset(new WidgetFactory());
}
return singleton;
}
/*------------------------------------------------------------------------------
* Configure the widget factory.
*----------------------------------------------------------------------------*/
void
WidgetFactory :: configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error)
{
if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element ";
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
const xmlpp::Attribute * attribute = 0;
if (!(attribute = element.get_attribute(pathAttrName))) {
throw std::invalid_argument("Missing path attribute");
}
path = attribute->get_value();
imageTypePixbufs[WidgetConstants::audioClipIconImage]
= loadImage(audioClipIconImageName);
imageTypePixbufs[WidgetConstants::playlistIconImage]
= loadImage(playlistIconImageName);
}
/*------------------------------------------------------------------------------
* Load an image
*----------------------------------------------------------------------------*/
Glib::RefPtr<Gdk::Pixbuf>
WidgetFactory :: loadImage(const std::string imageName)
throw (std::invalid_argument)
{
Glib::RefPtr<Gdk::Pixbuf> image;
bool success = true;
try {
image = Gdk::Pixbuf::create_from_file(path + imageName);
} catch (Glib::FileError &e) {
success = false;
} catch (Gdk::PixbufError &e) {
success = false;
}
if (!success || !image) {
throw std::invalid_argument("Missing " + imageName);
}
return image;
}
/*------------------------------------------------------------------------------
* Return a Gdk::Pixbuf reference to a named image
*----------------------------------------------------------------------------*/
Glib::RefPtr<Gdk::Pixbuf>
WidgetFactory :: getPixbuf(WidgetConstants::ImageType imageName) throw ()
{
return imageTypePixbufs[imageName];
}

View file

@ -1,252 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <iostream>
#include "LiveSupport/Widgets/ZebraCellRenderer.h"
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
ZebraCellRenderer::ZebraCellRenderer() throw ()
:
Glib::ObjectBase (typeid(ZebraCellRenderer)),
Gtk::CellRendererText ()
{
// std::cerr << "### constructor\n";
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
ZebraCellRenderer::~ZebraCellRenderer() throw ()
{
// std::cerr << "### destructor\n";
}
/*------------------------------------------------------------------------------
* Calculate the size of the cell.
*----------------------------------------------------------------------------*/
void
ZebraCellRenderer::get_size_vfunc(Gtk::Widget& widget,
const Gdk::Rectangle* cell_area,
int* x_offset, int* y_offset,
int* width, int* height) const
throw ()
{
/*
std::cerr << "### get_size_vfunc():"
<< (cell_area ? cell_area->get_x() : -1) << ", "
<< (cell_area ? cell_area->get_y() : -1) << "; "
<< (cell_area ? cell_area->get_width() : -1) << ", "
<< (cell_area ? cell_area->get_height() : -1) << "; "
<< (x_offset ? *x_offset : -1) << ", "
<< (y_offset ? *y_offset : -1) << " --- "
<< (width ? *width : -1) << ", "
<< (height ? *height : -1) << "\n";
*/
// call the parent method
Gtk::CellRendererText::get_size_vfunc(widget, cell_area,
x_offset, y_offset,
width, height);
/*
std::cerr << "... done: "
<< (cell_area ? cell_area->get_x() : -1) << ", "
<< (cell_area ? cell_area->get_y() : -1) << "; "
<< (cell_area ? cell_area->get_width() : -1) << ", "
<< (cell_area ? cell_area->get_height() : -1) << "; "
<< (x_offset ? *x_offset : -1) << ", "
<< (y_offset ? *y_offset : -1) << " --- "
<< (width ? *width : -1) << ", "
<< (height ? *height : -1) << "\n";
*/
/*
enum { TOGGLE_WIDTH = 12 };
const int calc_width = property_xpad() * 2 + TOGGLE_WIDTH;
const int calc_height = property_ypad() * 2 + TOGGLE_WIDTH;
if(width)
*width = calc_width;
if(height)
*height = calc_height;
if(cell_area)
{
if(x_offset)
{
*x_offset = int(property_xalign() * (cell_area->get_width() - calc_width));
*x_offset = std::max(0, *x_offset);
}
if(y_offset)
{
*y_offset = int(property_yalign() * (cell_area->get_height() - calc_height));
*y_offset = std::max(0, *y_offset);
}
}
*/
}
/*------------------------------------------------------------------------------
* Draw the cell.
*----------------------------------------------------------------------------*/
void
ZebraCellRenderer::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
const Gdk::Rectangle& expose_area,
Gtk::CellRendererState flags)
throw ()
{
/*
std::cerr << "### render_vfunc(): "
<< widget.get_name() << " --- "
<< background_area.get_x() << ", "
<< background_area.get_y() << "; "
<< background_area.get_width() << ", "
<< background_area.get_height() << " -- "
<< cell_area.get_x() << ", "
<< cell_area.get_y() << "; "
<< cell_area.get_width() << ", "
<< cell_area.get_height() << "; "
<< expose_area.get_x() << " -- "
<< expose_area.get_y() << "; "
<< expose_area.get_width() << ", "
<< expose_area.get_height() << " -- "
<< flags << "\n";
*/
// call the parent function
Gtk::CellRendererText::render_vfunc(window, widget, background_area,
cell_area, expose_area, flags);
/*
const unsigned int cell_xpad = property_xpad();
const unsigned int cell_ypad = property_ypad();
int x_offset = 0, y_offset = 0, width = 0, height = 0;
get_size(widget, cell_area, x_offset, y_offset, width, height);
width -= cell_xpad * 2;
height -= cell_ypad * 2;
if(width <= 0 || height <= 0)
return;
Gtk::StateType state = Gtk::STATE_INSENSITIVE;
if(property_activatable_)
state = Gtk::STATE_NORMAL;
if((flags & Gtk::CELL_RENDERER_SELECTED) != 0)
state = (widget.has_focus()) ? Gtk::STATE_SELECTED : Gtk::STATE_ACTIVE;
const Gtk::ShadowType shadow = (property_active_) ? Gtk::SHADOW_IN : Gtk::SHADOW_OUT;
//Cast the drawable to a Window. TODO: Maybe paint_option() should take a Drawable? murrayc.
Glib::RefPtr<Gdk::Window> window_casted = Glib::RefPtr<Gdk::Window>::cast_dynamic<>(window);
if(window_casted)
{
if(property_radio_)
{
widget.get_style()->paint_option(
window_casted, state, shadow,
cell_area, widget, "cellradio",
cell_area.get_x() + x_offset + cell_xpad,
cell_area.get_y() + y_offset + cell_ypad,
width - 1, height - 1);
}
else
{
widget.get_style()->paint_check(
window_casted, state, shadow,
cell_area, widget, "cellcheck",
cell_area.get_x() + x_offset + cell_xpad,
cell_area.get_y() + y_offset + cell_ypad,
width - 1, height - 1);
}
}
*/
}
/*------------------------------------------------------------------------------
* The user clicked on the cell.
*----------------------------------------------------------------------------*/
bool
ZebraCellRenderer::activate_vfunc(GdkEvent* event,
Gtk::Widget& widget,
const Glib::ustring& path,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags)
throw ()
{
/*
std::cerr << "### activate_vfunc(): "
<< widget.get_name() << ", "
<< path << ", "
// << background_area << ", "
// << cell_area << ", "
<< flags << "\n";
*/
// call the parent function
return Gtk::CellRendererText::activate_vfunc(event, widget, path,
background_area, cell_area, flags);
/*
std::cerr << "... done.\n";
*/
/*
if(property_activatable_)
{
signal_toggled_(path);
return true;
}
return false;
*/
}

View file

@ -1,572 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <iostream>
#include <sstream>
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/Colors.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
ZebraTreeView :: ZebraTreeView(Glib::RefPtr<Gtk::TreeModel> treeModel)
throw ()
: Gtk::TreeView(treeModel)
{
connectModelSignals(treeModel);
this->signal_row_expanded().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowExpanded));
this->signal_row_collapsed().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowCollapsed));
}
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
ZebraTreeView :: ZebraTreeView(
_GtkTreeView * baseClass,
const Glib::RefPtr<Gnome::Glade::Xml> & glade)
throw ()
: Gtk::TreeView(baseClass)
{
this->signal_row_expanded().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowExpanded));
this->signal_row_collapsed().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowCollapsed));
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
ZebraTreeView :: ~ZebraTreeView(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Add a text column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
int minimumWidth)
throw ()
{
// a standard cell renderer; can be replaced with a ZebraCellRenderer
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
// this cell data function will do the blue-gray zebra stripes
viewColumn->set_cell_data_func(
*renderer,
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
// set the minimum width of the column
if (minimumWidth) {
viewColumn->set_min_width(minimumWidth);
}
return append_column(*viewColumn);
}
/*------------------------------------------------------------------------------
* Add an image column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > &
modelColumn,
int minimumWidth)
throw ()
{
// a standard cell renderer; can be replaced with a ZebraCellRenderer
Gtk::CellRendererPixbuf* renderer = Gtk::manage(
new Gtk::CellRendererPixbuf );
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_pixbuf(), modelColumn);
// this cell data function will do the blue-gray zebra stripes
viewColumn->set_cell_data_func(
*renderer,
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
// set the minimum width of the column
if (minimumWidth) {
viewColumn->set_min_width(minimumWidth);
}
return append_column(*viewColumn);
}
/*------------------------------------------------------------------------------
* The callback function.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: cellDataFunction(Gtk::CellRenderer* cell,
const Gtk::TreeModel::iterator& iter)
throw ()
{
ZebraTreeModelColumnRecord model;
Colors::ColorName colorName = (*iter)[model.rowNumberColumn] % 2
? Colors::Gray
: Colors::LightBlue;
cell->property_cell_background_gdk() = Colors::getColor(colorName);
}
/*------------------------------------------------------------------------------
* Add a centered text column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendCenteredColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
int minimumWidth)
throw ()
{
// a standard cell renderer; can be replaced with a ZebraCellRenderer
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
// center the text in the column
renderer->property_xalign() = 0.5;
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
// this cell data function will do the blue-gray zebra stripes
viewColumn->set_cell_data_func(
*renderer,
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
// set the minimum width of the column
if (minimumWidth) {
viewColumn->set_min_width(minimumWidth);
}
return append_column(*viewColumn);
}
/*------------------------------------------------------------------------------
* Add a centered line number column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendLineNumberColumn(
const Glib::ustring& title,
int offset,
int minimumWidth)
throw ()
{
// a standard cell renderer; can be replaced with a ZebraCellRenderer
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
// center the text in the column
renderer->property_xalign() = 0.5;
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// this cell data function will do the blue-gray zebra stripes
// and fill in the line number from the model.rowNumberColumn
viewColumn->set_cell_data_func(
*renderer,
sigc::bind<int>(
sigc::mem_fun(*this, &ZebraTreeView::lineNumberCellDataFunction),
offset ));
// set the minimum width of the column
if (minimumWidth) {
viewColumn->set_min_width(minimumWidth);
}
return append_column(*viewColumn);
}
/*------------------------------------------------------------------------------
* The callback function for the line number column(s).
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: lineNumberCellDataFunction(
Gtk::CellRenderer* cell,
const Gtk::TreeModel::iterator& iter,
int offset)
throw ()
{
ZebraTreeModelColumnRecord model;
int rowNumber = (*iter)[model.rowNumberColumn];
Colors::ColorName colorName = rowNumber % 2 ? Colors::Gray
: Colors::LightBlue;
cell->property_cell_background_gdk() = Colors::getColor(colorName);
cell->property_cell_background_gdk() = Colors::getColor(colorName);
Glib::ustring numberString;
numberString.append("<span font_desc='Bitstream Vera Sans Bold 16'>");
std::stringstream numberStr;
numberStr << (rowNumber + offset);
numberString.append(numberStr.str());
numberString.append("</span>");
Gtk::CellRendererText * textCell
= dynamic_cast<Gtk::CellRendererText*>(cell);
textCell->property_markup() = numberString;
}
/*------------------------------------------------------------------------------
* Add an editable centered text column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendEditableColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
int columnId,
int minimumWidth)
throw ()
{
// a standard cell renderer; can be replaced with a ZebraCellRenderer
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
// right align the text in the column
renderer->property_xalign() = 1;
// set the cells to be editable, and connect the signal to our own
renderer->property_editable() = true;
renderer->signal_edited().connect(sigc::bind<int>(
sigc::mem_fun(*this, &ZebraTreeView::emitSignalCellEdited),
columnId ));
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
// this cell data function will do the blue-gray zebra stripes
viewColumn->set_cell_data_func(
*renderer,
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
// set the minimum width of the column
if (minimumWidth) {
viewColumn->set_min_width(minimumWidth);
}
return append_column(*viewColumn);
}
/*------------------------------------------------------------------------------
* Event handler for the Up menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onUpMenuOption(void) throw ()
{
Gtk::TreeModel::iterator iter = getSelectedRow();
Glib::RefPtr<Gtk::ListStore> treeModel
= Glib::RefPtr<Gtk::ListStore>::cast_dynamic(get_model());
ZebraTreeModelColumnRecord modelColumns;
if (iter && iter != treeModel->children().begin()) {
Gtk::TreeModel::iterator previous = iter;
--previous;
int rowNumber = (*previous)[modelColumns.rowNumberColumn];
(*iter) [modelColumns.rowNumberColumn] = rowNumber;
(*previous)[modelColumns.rowNumberColumn] = ++rowNumber;
treeModel->iter_swap(previous, iter);
}
}
/*------------------------------------------------------------------------------
* Event handler for the Down menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onDownMenuOption(void) throw ()
{
Gtk::TreeModel::iterator iter = getSelectedRow();
Glib::RefPtr<Gtk::ListStore> treeModel
= Glib::RefPtr<Gtk::ListStore>::cast_dynamic(get_model());
ZebraTreeModelColumnRecord modelColumns;
if (iter) {
Gtk::TreeModel::iterator next = iter;
++next;
if (next != treeModel->children().end()) {
int rowNumber = (*iter)[modelColumns.rowNumberColumn];
(*next)[modelColumns.rowNumberColumn] = rowNumber;
(*iter)[modelColumns.rowNumberColumn] = ++rowNumber;
treeModel->iter_swap(iter, next);
}
}
}
/*------------------------------------------------------------------------------
* Event handler for the Remove menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onRemoveMenuOption(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> selection = get_selection();
Gtk::TreeModel::iterator newSelection;
if (selection->get_mode() == Gtk::SELECTION_SINGLE) {
Gtk::TreeModel::iterator it = selection->get_selected();
if (it) {
newSelection = it;
++newSelection;
removeItem(it);
}
} else {
std::vector<Gtk::TreePath> selectedPaths
= selection->get_selected_rows();
std::vector<Gtk::TreeModel::iterator> selectedIters;
std::vector<Gtk::TreePath>::iterator pathIt = selectedPaths.begin();
for ( ; pathIt != selectedPaths.end(); ++pathIt) {
selectedIters.push_back(get_model()->get_iter(*pathIt));
}
std::vector<Gtk::TreeModel::iterator>::iterator
iterIt = selectedIters.begin();
for ( ; iterIt != selectedIters.end(); ++iterIt) {
newSelection = *iterIt;
++newSelection;
removeItem(*iterIt);
}
}
if (newSelection) {
selection->select(newSelection);
}
}
/*------------------------------------------------------------------------------
* Remove an item from the window.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: removeItem(const Gtk::TreeModel::iterator & iter)
throw ()
{
Glib::RefPtr<Gtk::ListStore> treeModel
= Glib::RefPtr<Gtk::ListStore>::cast_dynamic(get_model());
treeModel->erase(iter);
}
/*------------------------------------------------------------------------------
* Find the selected row.
*----------------------------------------------------------------------------*/
Gtk::TreeModel::iterator
ZebraTreeView :: getSelectedRow(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> selection = get_selection();
std::vector<Gtk::TreePath> selectedRows;
Gtk::TreeModel::iterator it;
switch (selection->get_mode()) {
case Gtk::SELECTION_SINGLE:
it = selection->get_selected();
break;
case Gtk::SELECTION_MULTIPLE:
selectedRows = selection->get_selected_rows();
if (selectedRows.size() > 0) {
it = get_model()->get_iter(selectedRows.front());
}
break;
default:
break;
}
return it;
}
/*------------------------------------------------------------------------------
* Event handler for the row_inserted signal.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onRowInserted(const Gtk::TreeModel::Path & path,
const Gtk::TreeModel::iterator & iter)
throw ()
{
renumberRows();
columns_autosize();
emitSignalTreeModelChanged();
}
/*------------------------------------------------------------------------------
* Event handler for the row_deleted signal.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onRowDeleted(const Gtk::TreeModel::Path & path)
throw ()
{
renumberRows();
columns_autosize();
emitSignalTreeModelChanged();
}
/*------------------------------------------------------------------------------
* Event handler for the rows_reordered signal.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onRowsReordered(const Gtk::TreeModel::Path & path,
const Gtk::TreeModel::iterator & iter,
int* mapping)
throw ()
{
renumberRows();
emitSignalTreeModelChanged();
}
/*------------------------------------------------------------------------------
* Event handler for the row_expanded signal.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onRowExpanded(const Gtk::TreeModel::iterator & iter,
const Gtk::TreeModel::Path & path)
throw ()
{
renumberRows();
}
/*------------------------------------------------------------------------------
* Event handler for the row_collapsed signal.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: onRowCollapsed(const Gtk::TreeModel::iterator & iter,
const Gtk::TreeModel::Path & path)
throw ()
{
renumberRows();
}
/*------------------------------------------------------------------------------
* Renumber the rows after they have changed.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: renumberRows(void) throw ()
{
Glib::RefPtr<Gtk::TreeModel> treeModel = get_model();
ZebraTreeModelColumnRecord modelColumns;
int rowNumber = 0;
Gtk::TreeModel::iterator iter;
Gtk::TreeModel::iterator it;
for (iter = treeModel->children().begin();
iter != treeModel->children().end(); ++iter) {
Gtk::TreeRow row = *iter;
row[modelColumns.rowNumberColumn] = rowNumber++;
if (row_expanded(treeModel->get_path(row))) {
for (it = row.children().begin(); it != row.children().end();
++it) {
Gtk::TreeRow childRow = *it;
childRow[modelColumns.rowNumberColumn] = rowNumber++;
}
}
}
}
/*------------------------------------------------------------------------------
* Manually connect the 'model has changed' signals to the tree view.
*----------------------------------------------------------------------------*/
void
ZebraTreeView :: connectModelSignals(Glib::RefPtr<Gtk::TreeModel> treeModel)
throw ()
{
treeModel->signal_row_inserted().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowInserted));
treeModel->signal_row_deleted().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowDeleted));
treeModel->signal_rows_reordered().connect(sigc::mem_fun(*this,
&ZebraTreeView::onRowsReordered));
}

View file

@ -1,203 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2010 Sourcefabric O.P.S.
This file is part of the Campcaster project.
http://campcaster.sourcefabric.org/
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------------*/
/** @file
* This file is the main entry point for the TestWindow in the Widgets module.
*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_GETOPT_H
#include <getopt.h>
#else
#error "Need getopt.h"
#endif
#include <iostream>
#include <libxml++/libxml++.h>
#include <gtkmm/main.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "TestWindow.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/**
* Our copyright notice, should be at most 80 columns
*/
static const char copyrightNotice[] =
"Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL";
/**
* String describing the short options.
*/
static const char options[] = "c:hv";
/**
* Structure describing the long options
*/
static const struct option longOptions[] = {
{ "config", required_argument, 0, 'c' },
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'v' },
{ 0, 0, 0, 0 }
};
/* =============================================== local function prototypes */
/**
* Print program version.
*
* @param os the std::ostream to print to.
*/
static void
printVersion ( std::ostream & os );
/**
* Print program usage information.
*
* @param invocation the command line command used to invoke this program.
* @param os the std::ostream to print to.
*/
static void
printUsage ( const char invocation[],
std::ostream & os );
/* ============================================================= module code */
/**
* Program entry point.
*
* @param argc the number of command line arguments passed by the user.
* @param argv the command line arguments passed by the user.
* @return 0 on success, non-0 on failure.
*/
int main ( int argc,
char * argv[] )
{
// initialize the Gtk library, with the Gtk options first
Gtk::Main kit(argc, argv);
// take a look at our options
int i;
std::string configFileName;
while ((i = getopt_long(argc, argv, options, longOptions, 0)) != -1) {
switch (i) {
case 'c':
configFileName = optarg;
break;
case 'h':
printUsage(argv[0], std::cout);
exit(EXIT_SUCCESS);
case 'v':
printVersion(std::cout);
exit(EXIT_SUCCESS);
default:
printUsage(argv[0], std::cout);
exit(EXIT_FAILURE);
}
}
if (optind != argc) {
printUsage(argv[0], std::cout);
exit(EXIT_FAILURE);
}
std::cerr << "using config file '" << configFileName << '\'' << std::endl;
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
try {
std::auto_ptr<xmlpp::DomParser>
parser(new xmlpp::DomParser(configFileName, true));
const xmlpp::Document * document = parser->get_document();
widgetFactory->configure(*(document->get_root_node()));
} catch (std::invalid_argument &e) {
std::cerr << "semantic error in configuration file" << std::endl
<< e.what() << std::endl;
exit(EXIT_FAILURE);
} catch (xmlpp::exception &e) {
std::cerr << "error parsing configuration file" << std::endl
<< e.what() << std::endl;
exit(EXIT_FAILURE);
}
{
TestWindow testWindow;
testWindow.run();
}
exit(EXIT_SUCCESS);
}
/*------------------------------------------------------------------------------
* Print program version.
*----------------------------------------------------------------------------*/
static void
printVersion ( std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
<< copyrightNotice << std::endl;
}
/*------------------------------------------------------------------------------
* Print program usage.
*----------------------------------------------------------------------------*/
static void
printUsage ( const char invocation[],
std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
<< std::endl
<< "Usage: " << invocation << " [OPTION]"
<< std::endl
<< " mandatory options:" << std::endl
<< " -c, --config=file.name scheduler configuration file" << std::endl
<< " optional options:" << std::endl
<< " -h, --help display this help and exit" << std::endl
<< " -v, --version display version information and exit"
<< std::endl
<< std::endl
<< "Report bugs to " << PACKAGE_BUGREPORT << std::endl;
}

View file

@ -1 +0,0 @@
keep me

View file

@ -1,3 +0,0 @@
en:table
{
}

View file

@ -1,118 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Fri Aug 24 13:23:29 2007 by fgerlits@fgerlits-laptop-->
<glade-interface>
<widget class="GtkWindow" id="mainWindow1">
<property name="width_request">500</property>
<property name="height_request">300</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">8</property>
<property name="spacing">8</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<child>
<widget class="GtkComboBox" id="combobox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTreeView" id="treeview1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="extension_events">GDK_EXTENSION_EVENTS_CURSOR</property>
<property name="headers_clickable">True</property>
<property name="reorderable">True</property>
<property name="rules_hint">True</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkTreeView" id="treeview2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="headers_clickable">True</property>
<property name="reorderable">True</property>
<property name="rules_hint">True</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">drag target</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -1,18 +0,0 @@
hu:table
{
windowTitle:string { "Próbaablak" }
pixbufColumnTitle:string { "Kép" }
textColumnTitle:string { "Szöveg" }
firstOption:string { "Első lehetőség" }
secondOption:string { "Második lehetőség" }
thirdOption:string { "Harmadik lehetőség" }
textOne:string { "Egy - megérett a meggy." }
textTwo:string { "Kettő - csipkebokor vessző." }
textThree:string { "Három - te leszel a párom. " }
dropHereText:string { "Ide lehet húzni dolgokat." }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

View file

@ -1,18 +0,0 @@
root:table
{
windowTitle:string { "Test Window" }
pixbufColumnTitle:string { "Pixbuf" }
textColumnTitle:string { "Text" }
firstOption:string { "First option" }
secondOption:string { "Second option" }
thirdOption:string { "Third option" }
textOne:string { "When I was One, I had just begun." }
textTwo:string { "When I was Two, I was nearly new." }
textThree:string { "When I was Three, I was hardly me." }
dropHereText:string { "You can drop things here." }
}

View file

@ -1,90 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
#-------------------------------------------------------------------------------
package="campcaster-studio"
# assume we're in $basedir/bin
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
usrdir=`cd $basedir/../../../usr; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
tmpdir=$basedir/tmp
cd "$tmpdir"
DIE=0
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
echo "Generating configuration files for $package, please wait...."
configure_ac=${etcdir}/configure.ac
configure=${tmpdir}/configure
aclocal_m4=${tmpdir}/aclocal.m4
# copy over configure.ac and acinlclude.m4 from etc to tmp,
# as aclocal >= 1.8 is sooo unbelivably stupid that it will simply try to
# look for configure.ac in the current directory, and include acinclude.m4
# in aclocal.m4 it without a directory path in front
ACLOCAL_FLAGS="-I ${tmpdir} --acdir=${tmpdir} --output=${aclocal_m4}"
echo " aclocal $ACLOCAL_FLAGS"
cp -f ${configure_ac} ${tmpdir}
cp -f ${etcdir}/acinclude.m4 ${tmpdir}
aclocal $ACLOCAL_FLAGS
echo " autoheader ${configure_ac}"
autoheader ${configure_ac}
echo " autoconf -o ${configure} ${configure_ac}"
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}

View file

@ -1,59 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Invoke script for Campcaster Studio.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
libdir=$basedir/lib
tmpdir=$basedir/tmp
#-------------------------------------------------------------------------------
# Set up the environment
#-------------------------------------------------------------------------------
export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
export GST_REGISTRY=$etcdir/gst-registry.xml
studio_exe=$bindir/campcaster-studio
if [ -f ~/.campcaster/campcaster-studio.xml ]; then
config_file=~/.campcaster/campcaster-studio.xml
elif [ -f $etcdir/campcaster-studio.xml ]; then
config_file=$etcdir/campcaster-studio.xml
else
echo "Can't find configuration file.";
fi
$studio_exe --version
echo "using configuration file: $config_file";
$studio_exe -c $config_file

View file

@ -1,66 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Invoke script for Campcaster Studio.
# This script is only used in the Campcaster development environment.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
libdir=$basedir/lib
tmpdir=$basedir/tmp
usrdir=`cd $basedir/../../../usr; pwd;`
#-------------------------------------------------------------------------------
# Set up the environment
#-------------------------------------------------------------------------------
export LD_LIBRARY_PATH=$usrdir/lib:$LD_LIBRARY_PATH
if [ -x $tmpdir/campcaster-studio ]; then
studio_exe=$tmpdir/campcaster-studio
else
echo "Can't find scheduler executable.";
fi
if [ -f ~/.campcaster/campcaster-studio.xml ]; then
config_file=~/.campcaster/campcaster-studio.xml
elif [ -f $etcdir/campcaster-studio.xml ]; then
config_file=$etcdir/campcaster-studio.xml
else
echo "Can't find configuration file.";
fi
$studio_exe --version
echo "using configuration file: $config_file";
$studio_exe -c $config_file

View file

@ -1,75 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script generates code coverage data for the module
#-------------------------------------------------------------------------------
module="Campcaster Studio"
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
docdir=$basedir/doc
tmpdir=$basedir/tmp
usrdir=`cd $basedir/../../../usr; pwd;`
coverage_report_dir=$docdir/coverage
raw_coverage_file=$tmpdir/raw_coverage.info
coverage_file=$tmpdir/coverage.info
lcov=$usrdir/bin/lcov
genhtml=$usrdir/bin/genhtml
cd $basedir
#-------------------------------------------------------------------------------
# Re-configure with covarege collection enabled, compile and run the tests
#-------------------------------------------------------------------------------
$bindir/autogen.sh --enable-coverage
make clean
make check
#-------------------------------------------------------------------------------
# Generate some symlinks so that the sources are visible from tmpdir
#-------------------------------------------------------------------------------
ln -s $basedir/include $tmpdir/include
ln -s $basedir/src $tmpdir/src
#-------------------------------------------------------------------------------
# Use lcov to generate an HTML report on the coverage data
#-------------------------------------------------------------------------------
$lcov -d $tmpdir -c > $raw_coverage_file
$lcov -e $raw_coverage_file "$tmpdir/*" > $coverage_file
rm -rf $coverage_report_dir
mkdir -p $coverage_report_dir
$genhtml -t "$module" -o $coverage_report_dir $coverage_file
#-------------------------------------------------------------------------------
# Clean up
#-------------------------------------------------------------------------------
rm -f $tmpdir/include
rm -f $tmpdir/src

View file

@ -1,47 +0,0 @@
#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.campware.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this script to configure the environment.
#
# This script in effect calls the real automake / autoconf configure script
#-------------------------------------------------------------------------------
# assume we're in $basedir
reldir=`dirname $0`
basedir=`cd $reldir; pwd;`
test -z "$basedir" && basedir=.
bindir=$basedir/bin
tmpdir=$basedir/tmp
autogen=$bindir/autogen.sh
configure=$tmpdir/configure
if [ ! -x $configure ]; then
(cd $basedir && $autogen $*)
fi
(cd $tmpdir && $configure $*)

View file

@ -1 +0,0 @@
keep me

View file

@ -1,468 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# @configure_input@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# General command definitions
#-------------------------------------------------------------------------------
MKDIR = mkdir -p
RM = rm -f
RMDIR = rm -rf
DOXYGEN = doxygen
CP = cp -f
SED = sed
ECHO = echo
CAT = cat
#-------------------------------------------------------------------------------
# Basic directory and file definitions
#-------------------------------------------------------------------------------
PACKAGE_NAME = @PACKAGE_NAME@
BASE_DIR = @builddir@
DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen
COVERAGE_DIR = ${DOC_DIR}/coverage
BIN_DIR = ${BASE_DIR}/bin
ETC_DIR = ${BASE_DIR}/etc
SRC_DIR = ${BASE_DIR}/src
TMP_DIR = ${BASE_DIR}/tmp
VAR_DIR = ${BASE_DIR}/var
REAL_BASE_DIR=$(shell cd ${BASE_DIR}; pwd)
prefix = @prefix@
USR_DIR = ${prefix}
USR_BIN_DIR = ${USR_DIR}/bin
USR_ETC_DIR = ${USR_DIR}/etc
USR_INCLUDE_DIR = ${USR_DIR}/include
USR_LIB_DIR = ${USR_DIR}/lib
USR_VAR_DIR = ${USR_DIR}/var
STORAGE_TMP_DIR = "/tmp"
HOSTNAME = @HOSTNAME@
WWW_PORT = @WWW_PORT@
SCHEDULER_PORT = @SCHEDULER_PORT@
DB_SERVER = @DB_SERVER@
DATABASE = @DATABASE@
DB_USER = @DB_USER@
DB_PASSWORD = @DB_PASSWORD@
AUDIO_OUT = "@AUDIO_OUT@"
AUDIO_CUE = "@AUDIO_CUE@"
PHP_URL_PREFIX=campcaster
ALIB_XML_RPC_PREFIX=xmlrpc/xrLocStor.php
SCHEDULER_XML_RPC_PREFIX=RC2
SCHEDULER_DAEMON_COMMAND="sudo ${USR_BIN_DIR}/campcaster-scheduler.sh"
USR_VAR_DIR_S=$(shell ${ECHO} ${USR_VAR_DIR} | ${SED} -e "s/\//\\\\\\\\\//g")
PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | \
${SED} -e "s/\//\\\\\\\\\//g")
ALIB_XML_RPC_PREFIX_S=$(shell ${ECHO} ${ALIB_XML_RPC_PREFIX} | \
${SED} -e "s/\//\\\\\\\\\//g")
STORAGE_TMP_DIR_S=$(shell ${ECHO} ${STORAGE_TMP_DIR} | \
${SED} -e "s/\//\\\\\\\\\//g")
AUDIO_OUT_S=$(shell ${ECHO} ${AUDIO_OUT} | ${SED} -e "s/\//\\\\\\\\\//g")
AUDIO_CUE_S=$(shell ${ECHO} ${AUDIO_CUE} | ${SED} -e "s/\//\\\\\\\\\//g")
SCHEDULER_DAEMON_COMMAND_S=$(shell ${ECHO} ${SCHEDULER_DAEMON_COMMAND} | \
${SED} -e "s/\//\\\\\\\\\//g")
REPLACE_SED_STRING="s/ls_var_dir/${USR_VAR_DIR_S}/; \
s/ls_dbuser/${DB_USER}/; \
s/ls_dbpassword/${DB_PASSWORD}/; \
s/ls_dbserver/${DB_SERVER}/; \
s/ls_database/${DATABASE}/; \
s/ls_php_urlPrefix/${PHP_URL_PREFIX_S}/; \
s/ls_php_host/${HOSTNAME}/; \
s/ls_php_port/${WWW_PORT}/; \
s/ls_alib_xmlRpcPrefix/${ALIB_XML_RPC_PREFIX_S}/; \
s/ls_tmp_dir/${STORAGE_TMP_DIR_S}/; \
s/ls_audio_output_device/${AUDIO_OUT_S}/; \
s/ls_audio_cue_device/${AUDIO_CUE_S}/; \
s/ls_scheduler_host/${HOSTNAME}/; \
s/ls_scheduler_port/${SCHEDULER_PORT}/; \
s/ls_scheduler_xmlRpcPrefix/${SCHEDULER_XML_RPC_PREFIX}/; \
s/ls_scheduler_daemon_command/${SCHEDULER_DAEMON_COMMAND_S}/;"
GENRB = @GENRB@
TMP_STUDIO-LOCALIZATION_DIR = ${TMP_DIR}/studio-localization
GENRBOPTS = --destdir ${TMP_STUDIO-LOCALIZATION_DIR} \
--encoding utf-8 \
--strict
VPATH = ${SRC_DIR}
MODULES_DIR = ${BASE_DIR}/../../modules
PRODUCTS_DIR = ${BASE_DIR}/../../products
STORAGE_SERVER_DIR = ${MODULES_DIR}/storageServer
SCHEDULER_DIR = ${PRODUCTS_DIR}/scheduler
SCHEDULER_EXE = ${SCHEDULER_DIR}/tmp/campcaster-scheduler
CORE_DIR = ${MODULES_DIR}/core
CORE_INCLUDE_DIR = ${CORE_DIR}/include
CORE_LIB_DIR = ${CORE_DIR}/lib
CORE_LIB = livesupport_core
CORE_LIB_FILE = ${CORE_LIB_DIR}/lib${CORE_LIB}.a
AUTHENTICATION_DIR = ${MODULES_DIR}/authentication
AUTHENTICATION_INCLUDE_DIR = ${AUTHENTICATION_DIR}/include
AUTHENTICATION_LIB_DIR = ${AUTHENTICATION_DIR}/lib
AUTHENTICATION_LIB = livesupport_authentication
AUTHENTICATION_LIB_FILE = ${AUTHENTICATION_LIB_DIR}/lib${AUTHENTICATION_LIB}.a
STORAGE_CLIENT_DIR = ${MODULES_DIR}/storageClient
STORAGE_CLIENT_INCLUDE_DIR = ${STORAGE_CLIENT_DIR}/include
STORAGE_CLIENT_LIB_DIR = ${STORAGE_CLIENT_DIR}/lib
STORAGE_CLIENT_LIB = livesupport_storage_client
STORAGE_CLIENT_LIB_FILE = ${STORAGE_CLIENT_LIB_DIR}/lib${STORAGE_CLIENT_LIB}.a
SCHEDULER_CLIENT_DIR = ${MODULES_DIR}/schedulerClient
SCHEDULER_CLIENT_INCLUDE_DIR = ${SCHEDULER_CLIENT_DIR}/include
SCHEDULER_CLIENT_LIB_DIR = ${SCHEDULER_CLIENT_DIR}/lib
SCHEDULER_CLIENT_LIB = livesupport_scheduler_client
SCHEDULER_CLIENT_LIB_FILE = ${SCHEDULER_CLIENT_LIB_DIR}/lib${SCHEDULER_CLIENT_LIB}.a
PLAYLIST_EXECUTOR_DIR = ${MODULES_DIR}/playlistExecutor
PLAYLIST_EXECUTOR_INCLUDE_DIR = ${PLAYLIST_EXECUTOR_DIR}/include
PLAYLIST_EXECUTOR_LIB_DIR = ${PLAYLIST_EXECUTOR_DIR}/lib
PLAYLIST_EXECUTOR_LIB = livesupport_playlist_executor
PLAYLIST_EXECUTOR_LIB_FILE = ${PLAYLIST_EXECUTOR_LIB_DIR}/lib${PLAYLIST_EXECUTOR_LIB}.a
WIDGETS_DIR = ${MODULES_DIR}/widgets
WIDGETS_INCLUDE_DIR = ${WIDGETS_DIR}/include
WIDGETS_LIB_DIR = ${WIDGETS_DIR}/lib
WIDGETS_LIB = livesupport_widgets
WIDGETS_LIB_FILE = ${WIDGETS_LIB_DIR}/lib${WIDGETS_LIB}.a
BOOST_CFLAGS=@BOOST_CPPFLAGS@
BOOST_LIBS=@BOOST_LDFLAGS@
BOOST_DATE_TIME_LIB=@BOOST_DATE_TIME_LIB@
LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@
LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
CURL_CFLAGS=@CURL_CFLAGS@
CURL_LIBS=@CURL_LIBS@
GTKMM_CFLAGS=@GTKMM_CFLAGS@
GTKMM_LIBS=@GTKMM_LIBS@
LIBGLADEMM_CFLAGS=@LIBGLADEMM_CFLAGS@
LIBGLADEMM_LIBS=@LIBGLADEMM_LIBS@
GSTREAMER_CFLAGS=@GSTREAMER_CFLAGS@
GSTREAMER_LIBS=@GSTREAMER_LIBS@
GSTCONTROLLER_CFLAGS=@GSTCONTROLLER_CFLAGS@
GSTCONTROLLER_LIBS=@GSTCONTROLLER_LIBS@
LIBSERIAL_CFLAGS=@LIBSERIAL_CFLAGS@
LIBSERIAL_LIBS=@LIBSERIAL_LIBS@
ICU_CFLAGS=@ICU_CFLAGS@
ICU_CXXFLAGS=@ICU_CXXFLAGS@
ICU_LIBS=@ICU_LIBS@
TAGLIB_CFLAGS=@TAGLIB_CFLAGS@
TAGLIB_LIBS=@TAGLIB_LIBS@
TEST_RESULTS = ${DOC_DIR}/testResults.xml
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
TEST_XSLT = ../etc/testResultToHtml.xsl
G_LIVESUPPORT_EXE = ${TMP_DIR}/campcaster-studio
G_LIVESUPPORT_SH = ${BIN_DIR}/campcaster-studio_devenv.sh
G_LIVESUPPORT_CFG = ${ETC_DIR}/campcaster-studio.xml
TEST_RUNNER = ${TMP_DIR}/testRunner
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
export LD_LIBRARY_PATH:=${USR_LIB_DIR}:${LD_LIBRARY_PATH}
#-------------------------------------------------------------------------------
# Configuration parameters
#-------------------------------------------------------------------------------
CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \
-pedantic -Wall -Wno-long-long \
${BOOST_CFLAGS} \
${TAGLIB_CFLAGS} \
${LIBXMLPP_CFLAGS} \
${GTKMM_CFLAGS} \
${LIBGLADEMM_CFLAGS} \
${GSTREAMER_CFLAGS} \
${GSTCONTROLLER_CFLAGS} \
${LIBSERIAL_CFLAGS} \
-I${USR_INCLUDE_DIR} \
-I${CORE_INCLUDE_DIR} \
-I${AUTHENTICATION_INCLUDE_DIR} \
-I${STORAGE_CLIENT_INCLUDE_DIR} \
-I${WIDGETS_INCLUDE_DIR} \
-I${SCHEDULER_CLIENT_INCLUDE_DIR} \
-I${PLAYLIST_EXECUTOR_INCLUDE_DIR} \
-I${TMP_DIR}
LDFLAGS = @LDFLAGS@ -pthread \
${BOOST_LIBS} \
${ICU_LIBS} \
${LIBXMLPP_LIBS} \
${CURL_LIBS} \
${GTKMM_LIBS} \
${LIBGLADEMM_LIBS} \
${GSTREAMER_LIBS} \
${GSTCONTROLLER_LIBS} \
${LIBSERIAL_LIBS} \
${TAGLIB_LIBS} \
-L${USR_LIB_DIR} \
-L${CORE_LIB_DIR} \
-L${AUTHENTICATION_LIB_DIR} \
-L${STORAGE_CLIENT_LIB_DIR} \
-L${WIDGETS_LIB_DIR} \
-L${SCHEDULER_CLIENT_LIB_DIR} \
-L${PLAYLIST_EXECUTOR_LIB_DIR}
#-------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------
G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
${TMP_DIR}/MasterPanelWindow.o \
${TMP_DIR}/NowPlaying.o \
${TMP_DIR}/GuiObject.o \
${TMP_DIR}/GuiWindow.o \
${TMP_DIR}/GuiComponent.o \
${TMP_DIR}/LoginWindow.o \
${TMP_DIR}/UploadFileWindow.o \
${TMP_DIR}/ScratchpadWindow.o \
${TMP_DIR}/PlaylistWindow.o \
${TMP_DIR}/SchedulerWindow.o \
${TMP_DIR}/SchedulePlaylistWindow.o \
${TMP_DIR}/SearchWindow.o \
${TMP_DIR}/AdvancedSearchEntry.o \
${TMP_DIR}/AdvancedSearchItem.o \
${TMP_DIR}/BrowseEntry.o \
${TMP_DIR}/BrowseItem.o \
${TMP_DIR}/LiveModeWindow.o \
${TMP_DIR}/CuePlayer.o \
${TMP_DIR}/KeyboardShortcut.o \
${TMP_DIR}/KeyboardShortcutContainer.o \
${TMP_DIR}/KeyboardShortcutList.o \
${TMP_DIR}/OptionsWindow.o \
${TMP_DIR}/DateTimeChooserWindow.o \
${TMP_DIR}/BackupList.o \
${TMP_DIR}/BackupView.o \
${TMP_DIR}/ExportPlaylistWindow.o \
${TMP_DIR}/ExportFormatRadioButtons.o \
${TMP_DIR}/TransportList.o \
${TMP_DIR}/RestoreBackupWindow.o \
${TMP_DIR}/TaskbarIcons.o \
${TMP_DIR}/RdsView.o \
${TMP_DIR}/RdsEntry.o \
${TMP_DIR}/DndMethods.o
G_LIVESUPPORT_RES = ${TMP_STUDIO-LOCALIZATION_DIR}/root.res \
${TMP_STUDIO-LOCALIZATION_DIR}/en.res \
${TMP_STUDIO-LOCALIZATION_DIR}/es.res \
${TMP_STUDIO-LOCALIZATION_DIR}/fr.res \
${TMP_STUDIO-LOCALIZATION_DIR}/hu.res \
${TMP_STUDIO-LOCALIZATION_DIR}/nl.res \
${TMP_STUDIO-LOCALIZATION_DIR}/pl.res \
${TMP_STUDIO-LOCALIZATION_DIR}/sr_CS.res \
${TMP_STUDIO-LOCALIZATION_DIR}/sr_CS_CYRILLIC.res \
${TMP_STUDIO-LOCALIZATION_DIR}/sv.res
G_LIVESUPPORT_EXE_OBJS = ${TMP_DIR}/main.o
FSDF = ${G_LIVESUPPORT_OBJS} \
${TMP_DIR}/main.o
G_LIVESUPPORT_EXE_LIBS = -l${PLAYLIST_EXECUTOR_LIB} \
-l${AUTHENTICATION_LIB} \
-l${STORAGE_CLIENT_LIB} \
-l${WIDGETS_LIB} \
-l${SCHEDULER_CLIENT_LIB} \
-l${CORE_LIB} \
${BOOST_DATE_TIME_LIB} \
-lxmlrpc++ -lssl -ltar
TEST_RUNNER_OBJS = ${G_LIVESUPPORT_OBJS} \
${TMP_DIR}/TestRunner.o \
${TMP_DIR}/AudioPlayerTest.o \
${TMP_DIR}/GLiveSupportTest.o \
${TMP_DIR}/KeyboardShortcutTest.o
TEST_RUNNER_LIBS = ${G_LIVESUPPORT_EXE_LIBS} -lcppunit -ldl
#-------------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean check install
.PHONY: init start run_tests stop deinit
all: dir_setup ${G_LIVESUPPORT_EXE} ${G_LIVESUPPORT_RES}
dir_setup: ${TMP_DIR} ${TMP_STUDIO-LOCALIZATION_DIR} ${DOXYGEN_DIR}
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
clean:
${RM} ${G_LIVESUPPORT_EXE_OBJS} ${G_LIVESUPPORT_RES} ${G_LIVESUPPORT_EXE}
${RMDIR} ${TMP_STUDIO-LOCALIZATION_DIR}
${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER}
${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info
docclean:
${RMDIR} ${DOXYGEN_DIR}/html
${RMDIR} ${COVERAGE_DIR}/*
${RM} ${TEST_RESULTS}
depclean: clean
${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} clean
${MAKE} -C ${SCHEDULER_CLIENT_DIR} clean
${MAKE} -C ${WIDGETS_DIR} clean
${MAKE} -C ${STORAGE_CLIENT_DIR} clean
${MAKE} -C ${AUTHENTICATION_DIR} clean
${MAKE} -C ${CORE_DIR} clean
distclean: clean docclean
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te* ${TMP_DIR}/ac*.m4
check: all ${TEST_RUNNER} storage_server_init run_tests
install: all
${MAKE} -C ${CORE_DIR} install
${MAKE} -C ${AUTHENTICATION_DIR} install
${MAKE} -C ${STORAGE_CLIENT_DIR} install
${MAKE} -C ${WIDGETS_DIR} install
${MAKE} -C ${SCHEDULER_CLIENT_DIR} install
${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} install
${MKDIR} ${USR_BIN_DIR}
${CP} ${BIN_DIR}/campcaster-studio.sh ${USR_BIN_DIR}
${CP} ${G_LIVESUPPORT_EXE} ${USR_BIN_DIR}
${MKDIR} ${USR_ETC_DIR}
${CP} ${ETC_DIR}/campcaster-studio.xml.template ${USR_ETC_DIR}
${CAT} ${ETC_DIR}/campcaster-studio.xml.template | \
${SED} -e ${REPLACE_SED_STRING} \
> ${USR_ETC_DIR}/campcaster-studio.xml
${MKDIR} ${USR_VAR_DIR}/Campcaster
${CP} ${VAR_DIR}/campcaster.png \
${VAR_DIR}/stationLogo.png \
${VAR_DIR}/icon*.png \
${VAR_DIR}/testAudio.ogg \
${USR_VAR_DIR}/Campcaster
${MKDIR} ${USR_VAR_DIR}/Campcaster/studio-localization
${CP} ${TMP_DIR}/studio-localization/*.res \
${USR_VAR_DIR}/Campcaster/studio-localization/
${MKDIR} ${USR_VAR_DIR}/Campcaster/glade
${CP} ${VAR_DIR}/glade/*.glade \
${USR_VAR_DIR}/Campcaster/glade/
run_tests: ${TEST_RUNNER}
${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT}
run: all
${G_LIVESUPPORT_SH}
init: ${SCHEDULER_EXE}
-${MAKE} -C ${STORAGE_SERVER_DIR} db_init
-${MAKE} -C ${SCHEDULER_DIR} init
start: ${SCHEDULER_EXE}
${MAKE} -C ${SCHEDULER_DIR} start
stop: ${SCHEDULER_EXE}
${MAKE} -C ${SCHEDULER_DIR} stop
status: ${SCHEDULER_EXE}
${MAKE} -C ${SCHEDULER_DIR} status
deinit: ${SCHEDULER_EXE}
-${MAKE} -C ${SCHEDULER_DIR} deinit
-${MAKE} -C ${STORAGE_SERVER_DIR} db_clean
storage_server_init:
${MAKE} -C ${STORAGE_SERVER_DIR}
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
${G_LIVESUPPORT_EXE}: ${CORE_LIB_FILE} \
${AUTHENTICATION_LIB_FILE} \
${STORAGE_CLIENT_LIB_FILE} \
${WIDGETS_LIB_FILE} \
${SCHEDULER_CLIENT_LIB_FILE} \
${PLAYLIST_EXECUTOR_LIB_FILE} \
${G_LIVESUPPORT_OBJS} ${G_LIVESUPPORT_EXE_OBJS}
${CXX} ${LDFLAGS} -o $@ $^ ${G_LIVESUPPORT_EXE_LIBS}
${TMP_DIR}:
${MKDIR} ${TMP_DIR}
${TMP_STUDIO-LOCALIZATION_DIR}:
${MKDIR} ${TMP_STUDIO-LOCALIZATION_DIR}
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${TEST_RUNNER}: ${CORE_LIB_FILE} \
${AUTHENTICATION_LIB_FILE} \
${STORAGE_CLIENT_LIB_FILE} \
${WIDGETS_LIB_FILE} \
${SCHEDULER_CLIENT_LIB_FILE} \
${TEST_RUNNER_OBJS}
${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS}
${CORE_LIB_FILE}:
${MAKE} -C ${CORE_DIR}
${AUTHENTICATION_LIB_FILE}:
${MAKE} -C ${AUTHENTICATION_DIR}
${STORAGE_CLIENT_LIB_FILE}:
${MAKE} -C ${STORAGE_CLIENT_DIR}
${WIDGETS_LIB_FILE}:
${MAKE} -C ${WIDGETS_DIR}
${SCHEDULER_CLIENT_LIB_FILE}:
${MAKE} -C ${SCHEDULER_CLIENT_DIR}
${PLAYLIST_EXECUTOR_LIB_FILE}:
${MAKE} -C ${PLAYLIST_EXECUTOR_DIR}
#-------------------------------------------------------------------------------
# Pattern rules
#-------------------------------------------------------------------------------
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
${TMP_STUDIO-LOCALIZATION_DIR}/%.res : ${VAR_DIR}/%.txt
${GENRB} ${GENRBOPTS} $^

Some files were not shown because too many files have changed in this diff Show more