From d9b16758c40d0e801ec5ecd707ace4b3451d331c Mon Sep 17 00:00:00 2001 From: Wolf Bergenheim Date: Wed, 20 Oct 2010 12:37:51 +0300 Subject: Using long integer only math in counting for performance --- resourceqt-client/time-stat.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/resourceqt-client/time-stat.c b/resourceqt-client/time-stat.c index c9801d2..f28ae02 100644 --- a/resourceqt-client/time-stat.c +++ b/resourceqt-client/time-stat.c @@ -18,8 +18,6 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *************************************************************************/ - -#include #include "time-stat.h" static struct timespec start_time; @@ -39,17 +37,28 @@ long int stop_timer(void) { struct timespec end_time; int r; - double milliseconds = 0.0; + long int milliseconds = 0L; r = clock_gettime(CLOCK_REALTIME, &end_time); if (r == 0) { - milliseconds = 1000.0 * (end_time.tv_sec - start_time.tv_sec) + - (end_time.tv_nsec - start_time.tv_nsec) / 1000000.0; + struct timespec temp; + if (end_time.tv_nsec < start_time.tv_nsec) { + temp.tv_sec = end_time.tv_sec - start_time.tv_sec - 1; + temp.tv_nsec = 1000000000 + end_time.tv_nsec - start_time.tv_nsec; + } else { + temp.tv_sec = end_time.tv_sec - start_time.tv_sec; + temp.tv_nsec = end_time.tv_nsec - start_time.tv_nsec; + } + + milliseconds = 1000 * temp.tv_sec + temp.tv_nsec / 1000; + if (temp.tv_nsec % 1000 > 500) { + ++milliseconds; + } } start_time.tv_sec = 0; start_time.tv_nsec = 0; - return lround(milliseconds); + return milliseconds; } -- cgit v1.2.3 From 2a13b037defdade8844ea65b4805ea08b8788f0b Mon Sep 17 00:00:00 2001 From: Wolf Bergenheim Date: Wed, 20 Oct 2010 12:41:03 +0300 Subject: Updated documentation --- libresourceqt/include/qt4/policy/audio-resource.h | 2 +- libresourceqt/include/qt4/policy/resource-set.h | 12 ++++++------ libresourceqt/include/qt4/policy/resource.h | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/libresourceqt/include/qt4/policy/audio-resource.h b/libresourceqt/include/qt4/policy/audio-resource.h index 87f215f..c0874fa 100644 --- a/libresourceqt/include/qt4/policy/audio-resource.h +++ b/libresourceqt/include/qt4/policy/audio-resource.h @@ -92,7 +92,7 @@ signals: * are changed. This signal is connected to in the ResourceSet to * track the changes to the AudioResource object. * \param group The new audio group - * \param pit The new PID of the audio renderer + * \param pid The new PID of the audio renderer * \param name The new Stream tag name * \param value the new stream tag value */ diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h index 7414a40..bd23e62 100644 --- a/libresourceqt/include/qt4/policy/resource-set.h +++ b/libresourceqt/include/qt4/policy/resource-set.h @@ -98,13 +98,14 @@ class ResourceSet: public QObject Q_DISABLE_COPY(ResourceSet) public: /** - * The constructor. + * Alternative constructor with additional parameters for setting + * alwaysReply and autoRelease. * \param applicationClass This parameter defines the application class. * The application class is used to determine the priority order of the * application. - * \param parent The optional parent of of this class. - * \param alwaysReply Set this to true to always get a reply from the - * Resource Manager. This optional parameter defaults to false. + * \param parent The parent of this class. + * \param alwaysReply see setAlwaysReply() + * \param autoRelease see setAutoRelease() */ ResourceSet(const QString &applicationClass, QObject *parent, bool alwaysReply, bool autoRelease); @@ -148,8 +149,7 @@ public: /** * This method returns a list of all resource in the set. * \return a QList of all resources in the set. - */ - QList resources() const; + */ QList resources() const; /** * This method returns a const pointer to a resource of a specific type. * \param type The type of resource we are interested in. diff --git a/libresourceqt/include/qt4/policy/resource.h b/libresourceqt/include/qt4/policy/resource.h index 1748a92..f77ac31 100644 --- a/libresourceqt/include/qt4/policy/resource.h +++ b/libresourceqt/include/qt4/policy/resource.h @@ -88,8 +88,22 @@ protected: Resource(); Resource(const Resource &other); + /** + * \internal + * This holds the type of the resource. + */ ResourceType resourceType; + /** + * \internal + * This is true when this resource is optional. + * \sa isOptional + * \sa setOptional + */ bool optional; + /** + * \internal + * This is just a unique identifier for the resource. + */ quint32 identifier; private: void setGranted(); -- cgit v1.2.3 From 44f9722fb3474fa891a72c72ca06c891ed7fa3e5 Mon Sep 17 00:00:00 2001 From: Wolf Bergenheim Date: Wed, 20 Oct 2010 12:42:19 +0300 Subject: Added support for -i flag, but ignoring it --- resourceqt-client/commandlineparser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/resourceqt-client/commandlineparser.cpp b/resourceqt-client/commandlineparser.cpp index 584d01e..2e1a7ce 100644 --- a/resourceqt-client/commandlineparser.cpp +++ b/resourceqt-client/commandlineparser.cpp @@ -60,6 +60,7 @@ bool CommandLineParser::parseArguments() ++ci; case 'm': case 's': + case 'i': case 't': break; case 'f': -- cgit v1.2.3 From dbe04a0f6a5017e6be7699be195cbbb0d52c4c00 Mon Sep 17 00:00:00 2001 From: Wolf Bergenheim Date: Wed, 20 Oct 2010 12:43:19 +0300 Subject: Also generate man pages and xml formatted documentation --- libresourceqt/Doxyfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libresourceqt/Doxyfile b/libresourceqt/Doxyfile index f493c9a..6f7eeee 100644 --- a/libresourceqt/Doxyfile +++ b/libresourceqt/Doxyfile @@ -53,7 +53,6 @@ CREATE_SUBDIRS = NO # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, @@ -1116,7 +1115,7 @@ MAN_EXTENSION = .3 # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. -MAN_LINKS = YES +MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output @@ -1126,7 +1125,7 @@ MAN_LINKS = YES # generate an XML file that captures the structure of # the code including all documentation. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be -- cgit v1.2.3 From d87f667c4861368cb27fd5e2d593260f41008122 Mon Sep 17 00:00:00 2001 From: Wolf Bergenheim Date: Wed, 20 Oct 2010 12:44:30 +0300 Subject: build documentation automatically --- libresourceqt.pro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libresourceqt.pro b/libresourceqt.pro index 5df04cd..2d88a4f 100644 --- a/libresourceqt.pro +++ b/libresourceqt.pro @@ -27,5 +27,9 @@ SUBDIRS = libdbus-qeventloop \ libmediaoverridesqt \ resourceqt-client \ mediaoverrider \ - tests + tests \ + demo/player + +dist.commands = ./makedist.sh +QMAKE_EXTRA_TARGETS += dist -- cgit v1.2.3 From b33025a09f6fc4ad9f4c60c71fd629b34e0ba521 Mon Sep 17 00:00:00 2001 From: Wolf Bergenheim Date: Wed, 20 Oct 2010 12:45:26 +0300 Subject: Added support for make dist in root --- libresourceqt/libresourceqt.pro | 15 +++++++++++++-- makedist.sh | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 makedist.sh diff --git a/libresourceqt/libresourceqt.pro b/libresourceqt/libresourceqt.pro index 36b2036..2626c19 100644 --- a/libresourceqt/libresourceqt.pro +++ b/libresourceqt/libresourceqt.pro @@ -50,6 +50,10 @@ CONFIG += qt link_pkgconfig dll QT = core PKGCONFIG += dbus-1 libresource0 +dox.commands = doxygen Doxyfile +QMAKE_EXTRA_TARGETS += dox +PRE_TARGETDEPS += dox + # Install directives headers.files = $${PUBLIC_HEADERS} INSTALLBASE = /usr @@ -58,5 +62,12 @@ headers.path = $${INSTALLBASE}/include/resource/qt4/policy pc.files = libresourceqt1.pc pc.path = $${INSTALLBASE}/lib/pkgconfig -INSTALLS = target headers pc - +man.files = docs/man +man.path = $${INSTALLBASE}/share +htmldoc.files = docs/html +htmldoc.path = $${INSTALLBASE}/share/doc/libresourceqt +xmldoc.files = docs/xml +xmldoc.path = $${INSTALLBASE}/share/doc/libresourceqt + +INSTALLS = target headers pc man htmldoc xmldoc + diff --git a/makedist.sh b/makedist.sh new file mode 100755 index 0000000..6f301d0 --- /dev/null +++ b/makedist.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +version="1.23" +name="libresourceqt-$version" + +echo "packaging $name" + +rm -rf $name $name.tar.gz +mkdir -v $name && \ +cp -va COPYING libresourceqt.* common.pri libdbus-qeventloop libresourceqt resourceqt-client tests demo $name && \ +tar cvzf $name.tar.gz $name && \ +rm -rf $name + -- cgit v1.2.3