diff options
author | Marja Hassinen <ext-marja.2.hassinen@nokia.com> | 2009-10-29 14:20:25 +0200 |
---|---|---|
committer | Marja Hassinen <ext-marja.2.hassinen@nokia.com> | 2009-10-29 14:20:25 +0200 |
commit | b62756c04d2662dd1913cccd2c0dd1b7c28f2f46 (patch) | |
tree | be92030bbaef85f93dcbac71a49e10d4ef5069d9 | |
parent | 6dc257bb23fc57126c1009362ddccbb254e29155 (diff) |
libcontextprovider, protocol change: Removed queuedinvoker, it's not used any more.
-rw-r--r-- | libcontextprovider/src/Makefile.am | 2 | ||||
-rw-r--r-- | libcontextprovider/src/queuedinvoker.cpp | 77 | ||||
-rw-r--r-- | libcontextprovider/src/queuedinvoker.h | 55 |
3 files changed, 0 insertions, 134 deletions
diff --git a/libcontextprovider/src/Makefile.am b/libcontextprovider/src/Makefile.am index eac30d7e..2d1ed62a 100644 --- a/libcontextprovider/src/Makefile.am +++ b/libcontextprovider/src/Makefile.am @@ -9,8 +9,6 @@ libcontextprovider_la_SOURCES = loggingfeatures.h \ propertyprivate.cpp \ group.h \ group.cpp \ - queuedinvoker.h \ - queuedinvoker.cpp \ contextc.h \ contextc.cpp \ listeners.h \ diff --git a/libcontextprovider/src/queuedinvoker.cpp b/libcontextprovider/src/queuedinvoker.cpp deleted file mode 100644 index 8a7b09e6..00000000 --- a/libcontextprovider/src/queuedinvoker.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2008, 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 - * - */ - -#include "queuedinvoker.h" - -#include <QMetaObject> -#include <QThread> -#include <QDebug> -#include <QMutexLocker> - -namespace ContextProvider { - -/*! \class QueuedInvoker - \brief A class that can invoke its own methods in a delayed way. - - Via the method QueuedInvoker::queueOnce, the given method is set - to be invoked when the event loop of the object is entered. Each - method is queued at most once. QueuedInvoker sends a signal to - itself, and when the signal is processed, the method is invoked. - - QueuedInvoker is normally used by subclassing it. - -*/ - -QueuedInvoker::QueuedInvoker(QObject* parent) - : QObject(parent) -{ - connect(this, SIGNAL(queuedCall(const char *)), - this, SLOT(onQueuedCall(const char *)), - Qt::QueuedConnection); -} - -//! Slot which is executed when the event loop of this object -//! runs. Calls all the methods in the queue. -void QueuedInvoker::onQueuedCall(const char *method) -{ - QMutexLocker locker(&callQueueLock); - callQueue.remove(method); - locker.unlock(); - if (!QMetaObject::invokeMethod(this, method, Qt::DirectConnection)) { - qFatal(" *****************\n" - "Erroneous usage of queueOnce(%s)\n" - " *****************\n", method); - } -} - -//! Sets the method \a method to be invoked when the event loop of -//! this object runs next time. If the method was already in the -//! queue, it won't be inserted again. -void QueuedInvoker::queueOnce(const char *method) -{ - QMutexLocker locker(&callQueueLock); - if (!callQueue.contains(method)) { - emit queuedCall(method); - callQueue.insert(method); - } -} - -} // namespace ContextProvider diff --git a/libcontextprovider/src/queuedinvoker.h b/libcontextprovider/src/queuedinvoker.h deleted file mode 100644 index 8f1e8896..00000000 --- a/libcontextprovider/src/queuedinvoker.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2008, 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 QUEUEDINVOKER_H -#define QUEUEDINVOKER_H - -#include <QObject> -#include <QMutex> -#include <QSet> -#include <QString> - -namespace ContextProvider { - -class QueuedInvoker : public QObject -{ - Q_OBJECT - -public: - QueuedInvoker(QObject* parent = 0); - -private slots: - void onQueuedCall(const char *method); - -signals: - void queuedCall(const char *method); - -protected: - void queueOnce(const char *method); - -private: - QMutex callQueueLock; ///< Protects the callQueue - QSet<QString> callQueue; ///< Methods to be invoked -}; - -} // namespace ContextProvider - -#endif |