Remove copy of libgq.

Nothing in the source tree uses this after the removal of the icd bearer plugin
in 0e0eb207c4, so there is no point keeping it
around anymore.

Change-Id: I6ea05c84d561965636e2ca5b03c7ee8edc48c093
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Richard J. Moore <rich@kde.org>
bb10
Robin Burchell 2012-01-20 17:27:47 +02:00 committed by Qt by Nokia
parent 9d7123e4de
commit a9c1d6c3dd
26 changed files with 0 additions and 2830 deletions

View File

@ -1,9 +0,0 @@
INCLUDEPATH += $$PWD/libgq/gconf
HEADERS += \
$$PWD/libgq/gconf/gconfitem.h \
$$PWD/libgq/gconf/GConfItem
SOURCES += \
$$PWD/libgq/gconf/gconfitem.cpp

View File

@ -1,37 +0,0 @@
/Makefile.in
/aclocal.m4
/autom4te.cache/
/config.guess
/config.sub
/configure
/depcomp
/gconf/Makefile.in
/install-sh
/ltmain.sh
/missing
/Makefile
/config.log
/config.status
/gconf/.deps/
/gconf/Makefile
/libtool
/confdefs.h
/gconf/.libs/
/gconf/libgq-gconf.la
/gconf/gq-gconf.pc
/gconf/moc_gconfitem_h.cpp
/gconf/mocs.cpp
/gconf/test-gconf
/gconf/gconfitem_moc.cpp
/gconf/test-gconf_moc.cpp
/libgq-*.tar.gz
/debian/libgq-gconf-dev/
/debian/libgq-gconf0/
/debian/tmp/
/debian/libgq-gconf0-dbg/
/debian/libgq-gconf-doc/
/debian/*.debhelper.log
/debian/*.substvars
/debian/files
/debian/*.debhelper
/gconf/html/

View File

@ -1,4 +0,0 @@
SUBDIRS = gconf
dist-hook:
rm -rf `find $(distdir) -name '*_moc.cpp'`

View File

@ -1,6 +0,0 @@
This is libgq, a set of small libraries with Q wrappers for G things.
* GConf
The libgq-gconf library contains the GConfItem class for accessing
GConf.

View File

@ -1,2 +0,0 @@
#! /bin/sh
autoreconf --install --force -v

View File

@ -1,23 +0,0 @@
AC_INIT([libgq],[0.2],[marius.vollmer@nokia.com],[libgq])
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([-Wall -Werror tar-ustar foreign])
AC_PROG_CXX
AC_PROG_LIBTOOL
PKG_CHECK_MODULES([QT], [QtCore])
PKG_CHECK_MODULES([QTEST], [QtTest])
PKG_CHECK_MODULES([GLIB], [glib-2.0])
PKG_CHECK_MODULES([GCONF], [gconf-2.0])
MOC=`pkg-config QtCore --variable=moc_location`
RCC=`pkg-config QtCore --variable=exec_prefix`/bin/rcc
AC_SUBST([MOC])
AC_SUBST([RCC])
AC_CONFIG_FILES([Makefile
gconf/Makefile
gconf/gq-gconf.pc])
AC_OUTPUT

View File

@ -1,28 +0,0 @@
This packages behaves a bit wierdly inside Scratchbox 1, by design.
When building it with dpkg-buildpackage or equivalent, it will disable
all devkits and adjust PATH. This means that almost all build
dependencies will come from your installed packages, and not from
Scratchbox or the configured devkits.
Since some of our packages do not work with Scratchboxes fakeroot
(because the latter is too old), you should use the targets fakeroot
instead.
You can disable this behavior by setting SBOX_DONT_SANITIZE in the
environment.
When this package is build in a certain buildbot, it will go further
and permantly change the Scratchbox target. This should not happen to
anyone but the buildbot, but there is a chance it will happen to you
by accident.
The buildbot is recognized via the $USER environment variable. If it
matches "bifh[0-9]", the permanent changes will be done.
The permanent changes mostly consist of running apt-get dist-upgrade
and making sure that the targets fakeroot is used.
This weirdness is brought to you by:
http://maemo.gitorious.org/maemo-af/maemoify-tools

View File

@ -1,31 +0,0 @@
libgq (0.4+0m6) unstable; urgency=low
* This entry has been added by BIFH queue processor
version has been changed to 0.4+0m6
-- Marius Vollmer <marius.vollmer@nokia.com> Fri, 04 Jun 2010 18:28:43 +0300
libgq (0.4) unstable; urgency=low
* Never release the GConf client, to avoid having to recreate it
immediately. Might fix NB#164690.
-- Marius Vollmer <marius.vollmer@nokia.com> Fri, 04 Jun 2010 18:10:50 +0300
libgq (0.3) unstable; urgency=low
* Added autotools to Build-Depends.
-- Marius Vollmer <marius.vollmer@nokia.com> Tue, 23 Feb 2010 12:04:45 +0200
libgq (0.2) unstable; urgency=low
* Build fixes.
-- Marius Vollmer <marius.vollmer@nokia.com> Wed, 16 Dec 2009 15:56:05 +0200
libgq (0.1) unstable; urgency=low
* Initial release.
-- Marius Vollmer <marius.vollmer@nokia.com> Wed, 16 Dec 2009 15:54:46 +0200

View File

@ -1 +0,0 @@
7

View File

@ -1,43 +0,0 @@
Source: libgq
Section: libs
Priority: extra
Maintainer: Marius Vollmer <marius.vollmer@nokia.com>
Origin: maemo
Build-Depends: debhelper (>= 7), libqt4-dev, doxygen, libgconf2-dev, libglib2.0-dev, autoconf, automake, libtool
Vcs-Browser: http://gitorious.org/maemo-af/libgq
Vcs-Git: git@gitorious.org:maemo-af/libgq.git
Package: libgq-gconf0
Architecture: any
Depends: ${shlibs:Depends}
Description: a Qt wrapper for GConf
This library contains the GConfItem class, for easy
access to GConf from Qt programs.
.
This package contains the shared run-time library.
Package: libgq-gconf0-dbg
Architecture: any
Depends: libgq-gconf0 (= ${source:Version})
Description: a Qt wrapper for GConf
This library contains the GConfItem class, for easy
access to GConf from Qt programs.
.
This package contains the debugging symbols.
Package: libgq-gconf-dev
Architecture: any
Depends: libgq-gconf0 (= ${source:Version}), libqt4-dev, libgconf2-dev
Description: a Qt wrapper for GConf
This library contains the GConfItem class, for easy
access to GConf from Qt programs.
.
This package contains the development files.
Package: libgq-gconf-doc
Architecture: all
Description: a Qt wrapper for GConf
This library contains the GConfItem class, for easy
access to GConf from Qt programs.
.
This package contains the documentation.

View File

@ -1,8 +0,0 @@
Copyright (c) 2009 Nokia Corporation.
This program, is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version
2.1 as published by the Free Software Foundation.
The full text of the LGPL 2.1 can be found in
/usr/share/common-licenses.

View File

@ -1,79 +0,0 @@
#! /bin/sh
# XXX - this needs to run under fakeroot...
exec 3>&1 1>&2
real_dpkg_checkbuilddeps () {
SBOX_REDIRECT_IGNORE=/usr/bin/perl /usr/bin/perl /usr/bin/dpkg-checkbuilddeps "$@"
}
finish () {
if ! real_dpkg_checkbuilddeps; then
echo "This package does not use any devkits."
echo "Please install all build dependencies as real packages."
echo >&3 FAIL
fi
exit 0
}
# The stamp file can not be in the source tree because then it would
# end up in the source package, which is not what we want. We put it
# into /var/tmp so that it gets deleted when a new rootstrap is
# extracted.
STAMP=/var/tmp/SANITIZED.$(head debian/changelog | md5sum | cut -d' ' -f1)
if [ -e $STAMP ]; then
exit 0;
fi
# Only do permanent changes if this is BIFH
echo "$USER" | grep -q 'bifh[0-9]' || finish
# prevent bash from killing the system
rm -f /var/lib/bash/provide-sh
# clean ~/.texmf-var to avoid trouble with stale things hiding there.
rm -rf ~/.texmf-var/
pfx="dpkg-checkbuilddeps: Unmet build dependencies:"
deps=`real_dpkg_checkbuilddeps 2>&1 | grep "^$pfx" | \
sed -e "s/$pfx//" -e s'/([^)]*)//g' -e 's/|//'`
deps="$deps build-essential automake autoconf libtool ed gawk diff dpkg-dev"
for d in $deps; do
echo apt-get "$@" install $d
apt-get -o DPkg::Options::=--force-confold -q --force-yes --yes install $d
done
apt-get -o DPkg::Options::=--force-confold -q --force-yes --yes dist-upgrade
# Make sure we get a fresh fakeroot installation
# We can't seem to control the value of LD_PRELOAD well enough, so we
# just copy the good version of libfakeroot over the bad one that
# Scratchbox uses. This will result in a good version of libfakeroot
# talking to a bad version of faked, but that seems to work well
# enough. The protocol between the two is really simple and unlikely
# to change even when new syscalls are wrapped. And this is a
# desperate hack anyway, so it's OK if there is blood all over the
# floor from time to time.
#
# After we have overwritten libfakeroot, it no longer works with any
# host binaries, such as the ones in /scratchbox/compilers/bin or
# /scratchbox/tools/bin. Thus, we must avoid running those when
# fakerooted.
#
# We use "cp -l" here to avoid overwriting a library that is in use.
#
if [ "$(fakeroot -v)" = "fakeroot version 1.4.2" ]; then
apt-get -q --force-yes --yes --reinstall install fakeroot
cp -fl /usr/lib/libfakeroot/libfakeroot-sysv.so /usr/lib/libfakeroot-sysv/libfakeroot.so.0
cp -fl /usr/lib/libfakeroot/libfakeroot-tcp.so /usr/lib/libfakeroot-tcp/libfakeroot.so.0
else
echo "We have $(fakeroot -v), hurray!"
fi
touch $STAMP
finish

View File

@ -1,5 +0,0 @@
usr/include/gq/GConfItem
usr/include/gq/gconfitem.h
usr/lib/libgq-gconf.so
usr/lib/libgq-gconf.a
usr/lib/pkgconfig/gq-gconf.pc

View File

@ -1 +0,0 @@
gconf/html usr/share/doc/libgq-gconf-doc/

View File

@ -1 +0,0 @@
usr/lib/libgq-gconf.so.*

View File

@ -1,32 +0,0 @@
#! /usr/bin/make -f
# Sanitize build environment when running inside Scratchbox 1
ifneq (,$(wildcard /targets))
ifeq (,$(SBOX_DONT_SANITIZE))
export PATH:=/bin:/usr/bin
export MAKE:=make
ifeq (,$(FAKEROOTKEY))
export SBOX_REDIRECT_TO_DIRS:=/scratchbox/compilers/bin
else
export SBOX_REDIRECT_TO_DIRS:=
endif
ifneq (,$(shell debian/fixup-scratchbox))
$(error Error)
endif
endif
endif
override_dh_auto_configure:
./autogen.sh
dh_auto_configure
override_dh_auto_build:
dh_auto_build
cd gconf && doxygen
override_dh_strip:
dh_strip -plibgq-gconf0 --dbg-package=libgq-gconf0-dbg
dh_strip
%:
dh $@

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
#include "gconfitem.h"

View File

@ -1,37 +0,0 @@
AM_CXXFLAGS = $(QT_CFLAGS) $(GLIB_CFLAGS) $(GCONF_CFLAGS)
LIBS += $(QT_LIBS) $(GLIB_LIBS) $(GCONF_LIBS)
lib_LTLIBRARIES = libgq-gconf.la
libgq_gconf_la_SOURCES = GConfItem \
gconfitem.h \
gconfitem.cpp \
gconfitem_moc.cpp
gqincludedir=$(includedir)/gq
gqinclude_HEADERS = gconfitem.h GConfItem
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gq-gconf.pc
# Tests
check_PROGRAMS = test-gconf
test_gconf_SOURCES = test-gconf.h test-gconf.cpp test-gconf_moc.cpp
test_gconf_CFLAGS = $(QTEST_CFLAGS)
test_gconf_LDADD = libgq-gconf.la $(QTEST_LIBS)
TESTS = run-test-gconf
EXTRA_DIST = run-test-gconf
# Moccing
%_moc.cpp: %.h
$(MOC) -o "$@" "$<"
clean-moc:
rm -f *_moc.cpp *_moc.lo
clean-local: clean-moc

View File

@ -1,376 +0,0 @@
/* * This file is part of libgq *
*
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
*
* Contact: Marius Vollmer <marius.vollmer@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#include <QString>
#include <QStringList>
#include <QByteArray>
#include <QVariant>
#include <QtDebug>
#include "gconfitem.h"
#include <glib.h>
#include <gconf/gconf-value.h>
#include <gconf/gconf-client.h>
struct GConfItemPrivate {
QString key;
QVariant value;
guint notify_id;
static void notify_trampoline(GConfClient*, guint, GConfEntry *, gpointer);
};
/* We get the default client and never release it, on purpose, to
avoid disconnecting from the GConf daemon when a program happens to
not have any GConfItems for short periods of time.
*/
static GConfClient *
get_gconf_client ()
{
static bool initialized = false;
static GConfClient *client;
if (initialized)
return client;
g_type_init ();
client = gconf_client_get_default();
initialized = true;
return client;
}
/* Sometimes I like being too clever...
*/
#define withClient(c) for (GConfClient *c = get_gconf_client (); c; c = NULL)
static QByteArray convertKey (QString key)
{
if (key.startsWith('/'))
return key.toUtf8();
else
{
qWarning() << "Using dot-separated key names with GConfItem is deprecated.";
qWarning() << "Please use" << '/' + key.replace('.', '/') << "instead of" << key;
return '/' + key.replace('.', '/').toUtf8();
}
}
static QString convertKey(const char *key)
{
return QString::fromUtf8(key);
}
static QVariant convertValue(GConfValue *src)
{
if (!src) {
return QVariant();
} else {
switch (src->type) {
case GCONF_VALUE_INVALID:
return QVariant(QVariant::Invalid);
case GCONF_VALUE_BOOL:
return QVariant((bool)gconf_value_get_bool(src));
case GCONF_VALUE_INT:
return QVariant(gconf_value_get_int(src));
case GCONF_VALUE_FLOAT:
return QVariant(gconf_value_get_float(src));
case GCONF_VALUE_STRING:
return QVariant(QString::fromUtf8(gconf_value_get_string(src)));
case GCONF_VALUE_LIST:
switch (gconf_value_get_list_type(src)) {
case GCONF_VALUE_STRING:
{
QStringList result;
for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data)));
return QVariant(result);
}
default:
{
QList<QVariant> result;
for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
result.append(convertValue((GConfValue *)elts->data));
return QVariant(result);
}
}
case GCONF_VALUE_SCHEMA:
default:
return QVariant();
}
}
}
static GConfValue *convertString(const QString &str)
{
GConfValue *v = gconf_value_new (GCONF_VALUE_STRING);
gconf_value_set_string (v, str.toUtf8().data());
return v;
}
static GConfValueType primitiveType (const QVariant &elt)
{
switch(elt.type()) {
case QVariant::String:
return GCONF_VALUE_STRING;
case QVariant::Int:
return GCONF_VALUE_INT;
case QVariant::Double:
return GCONF_VALUE_FLOAT;
case QVariant::Bool:
return GCONF_VALUE_BOOL;
default:
return GCONF_VALUE_INVALID;
}
}
static GConfValueType uniformType(const QList<QVariant> &list)
{
GConfValueType result = GCONF_VALUE_INVALID;
foreach (const QVariant &elt, list) {
GConfValueType elt_type = primitiveType (elt);
if (elt_type == GCONF_VALUE_INVALID)
return GCONF_VALUE_INVALID;
if (result == GCONF_VALUE_INVALID)
result = elt_type;
else if (result != elt_type)
return GCONF_VALUE_INVALID;
}
if (result == GCONF_VALUE_INVALID)
return GCONF_VALUE_STRING; // empty list.
else
return result;
}
static int convertValue(const QVariant &src, GConfValue **valp)
{
GConfValue *v;
switch(src.type()) {
case QVariant::Invalid:
v = NULL;
break;
case QVariant::Bool:
v = gconf_value_new (GCONF_VALUE_BOOL);
gconf_value_set_bool (v, src.toBool());
break;
case QVariant::Int:
v = gconf_value_new (GCONF_VALUE_INT);
gconf_value_set_int (v, src.toInt());
break;
case QVariant::Double:
v = gconf_value_new (GCONF_VALUE_FLOAT);
gconf_value_set_float (v, src.toDouble());
break;
case QVariant::String:
v = convertString(src.toString());
break;
case QVariant::StringList:
{
GSList *elts = NULL;
v = gconf_value_new(GCONF_VALUE_LIST);
gconf_value_set_list_type(v, GCONF_VALUE_STRING);
foreach (const QString &str, src.toStringList())
elts = g_slist_prepend(elts, convertString(str));
gconf_value_set_list_nocopy(v, g_slist_reverse(elts));
break;
}
case QVariant::List:
{
GConfValueType elt_type = uniformType(src.toList());
if (elt_type == GCONF_VALUE_INVALID)
v = NULL;
else
{
GSList *elts = NULL;
v = gconf_value_new(GCONF_VALUE_LIST);
gconf_value_set_list_type(v, elt_type);
foreach (const QVariant &elt, src.toList())
{
GConfValue *val = NULL;
convertValue(elt, &val); // guaranteed to succeed.
elts = g_slist_prepend(elts, val);
}
gconf_value_set_list_nocopy(v, g_slist_reverse(elts));
}
break;
}
default:
return 0;
}
*valp = v;
return 1;
}
void GConfItemPrivate::notify_trampoline (GConfClient*,
guint,
GConfEntry *,
gpointer data)
{
GConfItem *item = (GConfItem *)data;
item->update_value (true);
}
void GConfItem::update_value (bool emit_signal)
{
QVariant new_value;
withClient(client) {
GError *error = NULL;
QByteArray k = convertKey(priv->key);
GConfValue *v = gconf_client_get(client, k.data(), &error);
if (error) {
qWarning() << error->message;
g_error_free (error);
new_value = priv->value;
} else {
new_value = convertValue(v);
if (v)
gconf_value_free(v);
}
}
if (new_value != priv->value) {
priv->value = new_value;
if (emit_signal)
emit valueChanged();
}
}
QString GConfItem::key() const
{
return priv->key;
}
QVariant GConfItem::value() const
{
return priv->value;
}
QVariant GConfItem::value(const QVariant &def) const
{
if (priv->value.isNull())
return def;
else
return priv->value;
}
void GConfItem::set(const QVariant &val)
{
withClient(client) {
QByteArray k = convertKey(priv->key);
GConfValue *v;
if (convertValue(val, &v)) {
GError *error = NULL;
if (v) {
gconf_client_set(client, k.data(), v, &error);
gconf_value_free(v);
} else {
gconf_client_unset(client, k.data(), &error);
}
if (error) {
qWarning() << error->message;
g_error_free(error);
} else if (priv->value != val) {
priv->value = val;
emit valueChanged();
}
} else
qWarning() << "Can't store a" << val.typeName();
}
}
void GConfItem::unset() {
set(QVariant());
}
QList<QString> GConfItem::listDirs() const
{
QList<QString> children;
withClient(client) {
QByteArray k = convertKey(priv->key);
GSList *dirs = gconf_client_all_dirs(client, k.data(), NULL);
for (GSList *d = dirs; d; d = d->next) {
children.append(convertKey((char *)d->data));
g_free (d->data);
}
g_slist_free (dirs);
}
return children;
}
QList<QString> GConfItem::listEntries() const
{
QList<QString> children;
withClient(client) {
QByteArray k = convertKey(priv->key);
GSList *entries = gconf_client_all_entries(client, k.data(), NULL);
for (GSList *e = entries; e; e = e->next) {
children.append(convertKey(((GConfEntry *)e->data)->key));
gconf_entry_free ((GConfEntry *)e->data);
}
g_slist_free (entries);
}
return children;
}
GConfItem::GConfItem(const QString &key, QObject *parent)
: QObject (parent)
{
priv = new GConfItemPrivate;
priv->key = key;
priv->notify_id = 0;
withClient(client) {
update_value (false);
QByteArray k = convertKey(priv->key);
gconf_client_add_dir (client, k.data(), GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
priv->notify_id = gconf_client_notify_add (client, k.data(),
GConfItemPrivate::notify_trampoline, this,
NULL, NULL);
}
}
GConfItem::~GConfItem()
{
withClient(client) {
QByteArray k = convertKey(priv->key);
if (priv->notify_id)
gconf_client_notify_remove (client, priv->notify_id);
gconf_client_remove_dir (client, k.data(), NULL);
}
delete priv;
}

View File

@ -1,147 +0,0 @@
/* * This file is part of libgq *
*
* Copyright (C) 2009 Nokia Corporation.
*
* Contact: Marius Vollmer <marius.vollmer@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef GCONFITEM_H
#define GCONFITEM_H
#include <QVariant>
#include <QStringList>
#include <QObject>
/*!
\brief GConfItem is a simple C++ wrapper for GConf.
Creating a GConfItem instance gives you access to a single GConf
key. You can get and set its value, and connect to its
valueChanged() signal to be notified about changes.
The value of a GConf key is returned to you as a QVariant, and you
pass in a QVariant when setting the value. GConfItem converts
between a QVariant and GConf values as needed, and according to the
following rules:
- A QVariant of type QVariant::Invalid denotes an unset GConf key.
- QVariant::Int, QVariant::Double, QVariant::Bool are converted to
and from the obvious equivalents.
- QVariant::String is converted to/from a GConf string and always
uses the UTF-8 encoding. No other encoding is supported.
- QVariant::StringList is converted to a list of UTF-8 strings.
- QVariant::List (which denotes a QList<QVariant>) is converted
to/from a GConf list. All elements of such a list must have the
same type, and that type must be one of QVariant::Int,
QVariant::Double, QVariant::Bool, or QVariant::String. (A list of
strings is returned as a QVariant::StringList, however, when you
get it back.)
- Any other QVariant or GConf value is essentially ignored.
\warning GConfItem is as thread-safe as GConf.
*/
class GConfItem : public QObject
{
Q_OBJECT
public:
/*! Initializes a GConfItem to access the GConf key denoted by
\a key. Key names should follow the normal GConf conventions
like "/myapp/settings/first".
\param key The name of the key.
\param parent Parent object
*/
explicit GConfItem(const QString &key, QObject *parent = 0);
/*! Finalizes a GConfItem.
*/
virtual ~GConfItem();
/*! Returns the key of this item, as given to the constructor.
*/
QString key() const;
/*! Returns the current value of this item, as a QVariant.
*/
QVariant value() const;
/*! Returns the current value of this item, as a QVariant. If
* there is no value for this item, return \a def instead.
*/
QVariant value(const QVariant &def) const;
/*! Set the value of this item to \a val. If \a val can not be
represented in GConf or GConf refuses to accept it for other
reasons, the current value is not changed and nothing happens.
When the new value is different from the old value, the
changedValue() signal is emitted on this GConfItem as part
of calling set(), but other GConfItem:s for the same key do
only receive a notification once the main loop runs.
\param val The new value.
*/
void set(const QVariant &val);
/*! Unset this item. This is equivalent to
\code
item.set(QVariant(QVariant::Invalid));
\endcode
*/
void unset();
/*! Return a list of the directories below this item. The
returned strings are absolute key names like
"/myapp/settings".
A directory is a key that has children. The same key might
also have a value, but that is confusing and best avoided.
*/
QList<QString> listDirs() const;
/*! Return a list of entries below this item. The returned
strings are absolute key names like "/myapp/settings/first".
A entry is a key that has a value. The same key might also
have children, but that is confusing and is best avoided.
*/
QList<QString> listEntries() const;
signals:
/*! Emitted when the value of this item has changed.
*/
void valueChanged();
private:
friend struct GConfItemPrivate;
struct GConfItemPrivate *priv;
void update_value(bool emit_signal);
};
#endif // GCONFITEM_H

View File

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: gq-gconf
Description: Qt/GConf wrapper
Version: @VERSION@
Requires: QtCore
Libs: -L${libdir} -lgq-gconf
Cflags: -I${includedir}/gq

View File

@ -1,49 +0,0 @@
#!/bin/sh
# please make sure that the en_US.UTF-8 locale is available!
# - apt-get install locales
# - make sure /etc/locale.gen contains the line "en_US.UTF-8 UTF-8"
# - run /usr/sbin/locale-gen
LC_ALL=en_US.UTF-8
export LC_ALL
gconftool-2 -s -t bool /Test/Bool true
VALUE=$(gconftool-2 -g /Test/Bool)
if [ "$VALUE" != "true" ]; then
echo "GConf is not running, skipping all tests"
exit 77
fi
# Setup values expected by the external_values() test.
gconftool-2 -s -t int /Test/Int 123
gconftool-2 -s -t string /Test/String "Hello GConf"
gconftool-2 -s -t float /Test/Double 3.5
gconftool-2 -s -t list --list-type string /Test/StringList "[Hello,GConf,ÄÖÜ]"
gconftool-2 -s -t list --list-type int /Test/IntList "[1,2,3,4]"
gconftool-2 -s -t list --list-type float /Test/DoubleList "[3.5,3.5,3.5]"
gconftool-2 -s -t list --list-type bool /Test/BoolList "[false,true,true,false]"
gconftool-2 -u /Test/UnsetBefore
gconftool-2 -s -t int /Test/UnsetAfter 100
gconftool-2 -s -t int /Test/Dir/Entry 200
./test-gconf $* || exit 1
# Check what set_external() has left behind.
compare() {
if [ "$1" != "$2" ]; then
echo "FAIL: '$1' != '$2'"
exit 1
fi
}
compare "`gconftool-2 -g /Test/Bool`" false
compare "`gconftool-2 -g /Test/Int`" 54321
compare "`gconftool-2 -g /Test/String`" "Good bye GConf"
compare "`gconftool-2 -g /Test/Double`" -2.5
compare "`gconftool-2 -g /Test/StringList`" "[Good,bye,GConf,äöü]"
compare "`gconftool-2 -g /Test/IntList`" "[5,4,3,2,1]"
compare "`gconftool-2 -g /Test/DoubleList`" "[-2.5,-2.5]"
compare "`gconftool-2 -g /Test/BoolList`" "[false,false,true,true]"
compare "`gconftool-2 -g /Test/UnsetAfter 2>&1`" 'No value set for `/Test/UnsetAfter'"'"

View File

@ -1,299 +0,0 @@
#include "test-gconf.h"
#define MYLOGLEVEL 2
void myMessageOutput(QtMsgType type, const char *msg)
{
switch (type) {
case QtDebugMsg:
if (MYLOGLEVEL <= 0)
fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
if (MYLOGLEVEL <= 1)
fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
if (MYLOGLEVEL <= 2)
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
if (MYLOGLEVEL <= 3)
fprintf(stderr, "Fatal: %s\n", msg);
abort();
}
}
//
// Definition of testcases: Normal tests
//
void GConfItemTests::timeout()
{
timed_out = true;
timer.stop();
}
// Before all tests
void GConfItemTests::initTestCase()
{
connect(&timer, SIGNAL(timeout()),
this, SLOT(timeout()));
}
// After all tests
void GConfItemTests::cleanupTestCase()
{
}
// Before each test
void GConfItemTests::init()
{
boolItem = new GConfItem("/Test/Bool");
intItem = new GConfItem("/Test/Int");
stringItem = new GConfItem("/Test/String");
doubleItem = new GConfItem("/Test/Double");
stringListItem = new GConfItem("/Test/StringList");
intListItem = new GConfItem("/Test/IntList");
doubleListItem = new GConfItem("/Test/DoubleList");
boolListItem = new GConfItem("/Test/BoolList");
unsetBeforeItem = new GConfItem("/Test/UnsetBefore");
unsetAfterItem = new GConfItem("/Test/UnsetAfter");
signalSpy = new SignalListener();
QObject::connect(boolItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(intItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(stringItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(doubleItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(stringListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(intListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(doubleListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::connect(boolListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
}
// After each test
void GConfItemTests::cleanup()
{
QObject::disconnect(boolItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(intItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(stringItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(doubleItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(stringListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(intListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(doubleListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
QObject::disconnect(boolListItem, SIGNAL(valueChanged()), signalSpy, SLOT(valueChanged()));
delete signalSpy;
delete boolItem;
delete intItem;
delete stringItem;
delete doubleItem;
delete stringListItem;
delete intListItem;
delete doubleListItem;
delete boolListItem;
delete unsetBeforeItem;
delete unsetAfterItem;
timer.stop();
}
void GConfItemTests::path()
{
QCOMPARE(boolItem->key(), QString("/Test/Bool"));
QCOMPARE(intItem->key(), QString("/Test/Int"));
QCOMPARE(stringItem->key(), QString("/Test/String"));
QCOMPARE(doubleItem->key(), QString("/Test/Double"));
QCOMPARE(stringListItem->key(), QString("/Test/StringList"));
QCOMPARE(intListItem->key(), QString("/Test/IntList"));
QCOMPARE(doubleListItem->key(), QString("/Test/DoubleList"));
QCOMPARE(boolListItem->key(), QString("/Test/BoolList"));
QCOMPARE(unsetBeforeItem->key(), QString("/Test/UnsetBefore"));
QCOMPARE(unsetAfterItem->key(), QString("/Test/UnsetAfter"));
}
void GConfItemTests::external_values()
{
// These values are set before this program starts.
QCOMPARE(boolItem->value().toBool(), true);
QCOMPARE(intItem->value().toInt(), 123);
QCOMPARE(stringItem->value().toString(), QString("Hello GConf"));
QCOMPARE(doubleItem->value().toDouble(), 3.5);
QCOMPARE(stringListItem->value().toStringList(), QStringList() << "Hello" << "GConf" << QString::fromUtf8("ÄÖÜ"));
QCOMPARE(intListItem->value().toList(), QList<QVariant>() << 1 << 2 << 3 << 4);
QCOMPARE(doubleListItem->value().toList(), QList<QVariant>() << 3.5 << 3.5 << 3.5);
QCOMPARE(boolListItem->value().toList(), QList<QVariant>() << false << true << true << false);
QCOMPARE(unsetBeforeItem->value().isValid(), false);
QCOMPARE(unsetAfterItem->value().isValid(), true);
}
void GConfItemTests::set_bool()
{
signalSpy->numberOfCalls = 0;
boolItem->set(false);
QCOMPARE(boolItem->value().toBool(), false);
boolItem->set(true);
QCOMPARE(boolItem->value().toBool(), true);
QCOMPARE(signalSpy->numberOfCalls, 2);
}
void GConfItemTests::set_int()
{
signalSpy->numberOfCalls = 0;
intItem->set(12);
QCOMPARE(intItem->value().toInt(), 12);
intItem->set(-5);
QCOMPARE(intItem->value().toInt(), -5);
QCOMPARE(signalSpy->numberOfCalls, 2);
}
void GConfItemTests::set_string()
{
signalSpy->numberOfCalls = 0;
stringItem->set("Hi");
QCOMPARE(stringItem->value().toString(), QString("Hi"));
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::set_unicode_string()
{
signalSpy->numberOfCalls = 0;
stringItem->set(QString::fromUtf8("Höäü"));
QCOMPARE(stringItem->value().toString(), QString::fromUtf8("Höäü"));
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::set_double()
{
signalSpy->numberOfCalls = 0;
doubleItem->set(1.2345);
QCOMPARE(doubleItem->value().toDouble(), 1.2345);
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::set_string_list()
{
signalSpy->numberOfCalls = 0;
stringListItem->set(QStringList() << "one" << "two" << "three");
QCOMPARE(stringListItem->value().toStringList(), QStringList() << "one" << "two" << "three");
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::set_int_list()
{
signalSpy->numberOfCalls = 0;
intListItem->set(QList<QVariant>() << 10 << 11 << 12);
QCOMPARE(intListItem->value().toList(), QList<QVariant>() << 10 << 11 << 12);
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::set_double_list()
{
signalSpy->numberOfCalls = 0;
doubleListItem->set(QList<QVariant>() << 1.1 << 2.2 << 3.3);
QCOMPARE(doubleListItem->value().toList(), QList<QVariant>() << 1.1 << 2.2 << 3.3);
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::set_bool_list()
{
signalSpy->numberOfCalls = 0;
boolListItem->set(QList<QVariant>() << true << true << false);
QCOMPARE(boolListItem->value().toList(), QList<QVariant>() << true << true << false);
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::unset ()
{
signalSpy->numberOfCalls = 0;
boolItem->unset();
QCOMPARE(boolItem->value().isValid(), false);
QCOMPARE(signalSpy->numberOfCalls, 1);
}
void GConfItemTests::list_dirs ()
{
GConfItem test("/Test");
QStringList dirs = test.listDirs();
QVERIFY (!dirs.contains("/Test/Bool"));
QVERIFY (!dirs.contains("/Test/Int"));
QVERIFY (!dirs.contains("/Test/String"));
QVERIFY (!dirs.contains("/Test/Double"));
QVERIFY (!dirs.contains("/Test/StringList"));
QVERIFY (!dirs.contains("/Test/IntList"));
QVERIFY (!dirs.contains("/Test/DoubleList"));
QVERIFY (!dirs.contains("/Test/BoolList"));
QVERIFY (!dirs.contains("/Test/UnsetBefore"));
QVERIFY (!dirs.contains("/Test/UnsetAfter"));
QVERIFY (dirs.contains("/Test/Dir"));
}
void GConfItemTests::list_entries ()
{
GConfItem test("/Test");
QStringList entries = test.listEntries();
QVERIFY (!entries.contains("/Test/Bool")); // has been unset above
QVERIFY (entries.contains("/Test/Int"));
QVERIFY (entries.contains("/Test/String"));
QVERIFY (entries.contains("/Test/Double"));
QVERIFY (entries.contains("/Test/StringList"));
QVERIFY (entries.contains("/Test/IntList"));
QVERIFY (entries.contains("/Test/DoubleList"));
QVERIFY (entries.contains("/Test/BoolList"));
QVERIFY (!entries.contains("/Test/UnsetBefore"));
QVERIFY (entries.contains("/Test/UnsetAfter"));
QVERIFY (!entries.contains("/Test/Dir"));
}
void GConfItemTests::get_default ()
{
intItem->unset();
QCOMPARE(intItem->value(123).toInt(), 123);
intItem->set(234);
QCOMPARE(intItem->value(123).toInt(), 234);
}
void GConfItemTests::propagate ()
{
GConfItem secondIntItem("/Test/Int");
secondIntItem.set(3000);
QVERIFY_TIMEOUT(2000, intItem->value() == secondIntItem.value());
QCOMPARE(signalSpy->numberOfCalls, 2);
}
void GConfItemTests::set_external()
{
// This must be the last test case. The values that are set here
// are checked after this program exits.
boolItem->set(false);
intItem->set(54321);
stringItem->set("Good bye GConf");
doubleItem->set(-2.5);
stringListItem->set(QStringList() << "Good" << "bye" << "GConf" << QString::fromUtf8("äöü"));
intListItem->set(QList<QVariant>() << 5 << 4 << 3 << 2 << 1);
doubleListItem->set(QList<QVariant>() << -2.5 << -2.5);
boolListItem->set(QList<QVariant>() << false << false << true << true);
unsetAfterItem->set(QVariant());
}
QTEST_MAIN(GConfItemTests);

View File

@ -1,86 +0,0 @@
#include <QObject>
#include <QtTest/QtTest>
#include <QDebug>
#include "GConfItem"
// Helper class for listening to signals
class SignalListener : public QObject
{
Q_OBJECT
public:
int numberOfCalls;
SignalListener() : numberOfCalls(0) {
}
public slots:
void valueChanged()
{
numberOfCalls++;
}
};
// Tests for the public API
class GConfItemTests : public QObject
{
Q_OBJECT
// Stored pointers etc.
private:
GConfItem *boolItem;
GConfItem *intItem;
GConfItem *stringItem;
GConfItem *doubleItem;
GConfItem *stringListItem;
GConfItem *intListItem;
GConfItem *doubleListItem;
GConfItem *boolListItem;
GConfItem *unsetBeforeItem;
GConfItem *unsetAfterItem;
SignalListener *signalSpy;
QTimer timer;
bool timed_out;
// Tests
private slots:
// Init and cleanup helper functions
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void timeout ();
// Public API
void path();
void external_values();
void set_bool();
void set_int();
void set_string();
void set_unicode_string();
void set_double();
void set_string_list();
void set_int_list();
void set_double_list();
void set_bool_list();
void unset();
void get_default();
void list_dirs();
void list_entries();
void propagate();
void set_external();
};
// Useful if you need to process some events until a condition becomes
// true.
#define QVERIFY_TIMEOUT(msecs, expr) \
do { \
timed_out = false; \
timer.start(msecs); \
while (!timed_out && !(expr)) { \
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); \
} \
QVERIFY((expr)); \
} while(0)