00001 /* 00002 * Copyright (C) 2008, 2009 Nokia Corporation. 00003 * 00004 * Contact: Marius Vollmer <marius.vollmer@nokia.com> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. 00009 * 00010 * This library is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00018 * 02110-1301 USA 00019 * 00020 */ 00021 00022 #ifndef QUEUEDINVOKER_H 00023 #define QUEUEDINVOKER_H 00024 00025 #include <QObject> 00026 #include <QMutex> 00027 #include <QSet> 00028 #include <QString> 00029 00030 namespace ContextSubscriber { 00031 00032 class QueuedInvoker : public QObject 00033 { 00034 Q_OBJECT 00035 00036 public: 00037 QueuedInvoker(); 00038 00039 private Q_SLOTS: 00040 void onQueuedCall(const char *method); 00041 00042 Q_SIGNALS: 00043 void queuedCall(const char *method); 00044 00045 protected: 00046 void queueOnce(const char *method); 00047 00048 private: 00049 QMutex callQueueLock; 00050 QSet<QString> callQueue; 00051 }; 00052 00053 } // namespace 00054 #endif