home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / kartsdispatcher.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.2 KB  |  88 lines

  1.     /*
  2.  
  3.     Copyright (C) 2001 Nikolas Zimmermann <wildfox@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.   
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19.  
  20.     */
  21.  
  22. #ifndef KARTSDISPATCHER_H
  23. #define KARTSDISPATCHER_H
  24.  
  25. #include <qobject.h>
  26.  
  27. #include <kdelibs_export.h>
  28.  
  29. namespace Arts
  30. {
  31.     class QIOManager;
  32.     class Dispatcher;
  33. }
  34.  
  35. /**
  36.  * KArtsDispatcher ensures that an instance of Arts::Dispatcher using an
  37.  * Arts::QIOManager exists. When the last KArtsDispatcher is deleted, the
  38.  * Arts::Dispatcher is released as well.
  39.  *
  40.  * Using KArtsDispatcher is especially useful in setups where another plugin
  41.  * might also already use an Arts::Dispatcher, for instance in konqueror.
  42.  *
  43.  * \code
  44.  * {
  45.  *   // old code
  46.  *   Arts::QIOManager qiomanager;
  47.  *   Arts::Dispatcher dispatcher(&qiomanager);
  48.  *
  49.  *   Arts::SoundServer server = Arts::Reference("global:Arts_SoundServer");
  50.  *   server.play("/usr/share/sounds/pop.wav");
  51.  * }
  52.  * \endcode
  53.  *
  54.  * \code
  55.  * {
  56.  *   // new code
  57.  *   KArtsDispatcher dispatcher;
  58.  *
  59.  *   Arts::SoundServer server = Arts::Reference("global:Arts_SoundServer");
  60.  *   server.play("/usr/share/sounds/pop.wav");
  61.  * }
  62.  * \endcode
  63.  */
  64. class KDE_EXPORT KArtsDispatcher : public QObject
  65. {
  66. Q_OBJECT
  67. public:
  68.     /**
  69.      * Constructor.
  70.      *
  71.      * @param parent  the parent Qt object
  72.      * @param name    the Qt object name of this object
  73.      */
  74.     KArtsDispatcher(QObject *parent = 0, const char *name = 0);
  75.  
  76.     /**
  77.      * Destructor
  78.      */
  79.     ~KArtsDispatcher();
  80.     
  81. private:
  82.     static int m_refCount;
  83.     static Arts::Dispatcher *artsDispatcher;
  84.     static Arts::QIOManager *artsQIOManager;
  85. };
  86.  
  87. #endif
  88.