arts Library API Documentation

knotify.h

00001 /*
00002    Copyright (c) 1997 Christian Esken (esken@kde.org)
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the Free Software
00016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 
00018 */
00019 
00020 #ifndef KNOTIFY_H
00021 #define KNOTIFY_H
00022 
00023 #include <qobject.h>
00024 #include <knotifyclient.h>
00025 #include <dcopobject.h>
00026 
00027 #include <kdemm/simpleplayer.h>
00028 
00029 class KNotifyPrivate;
00030 class KProcess;
00031 
00032 class KNotify : public QObject, public DCOPObject
00033 {
00034 Q_OBJECT
00035 K_DCOP
00036 
00037 public:
00038     KNotify( bool useArts );
00039     ~KNotify();
00040 
00041     enum PlayingFinishedStatus
00042     {
00043         PlayedOK = 0,        // success, all following mean failure
00044         NoSoundFile,
00045         FileAlreadyPlaying,
00046         NoSoundSupport,
00047         PlayerBusy,
00048         Aborted,
00049         Unknown = 5000
00050     };
00051 
00052 protected:
00053 k_dcop:
00054     // deprecated
00055     void notify(const QString &event, const QString &fromApp,
00056                          const QString &text, QString sound, QString file,
00057                          int present, int level);
00058 
00059     // deprecated
00060     void notify(const QString &event, const QString &fromApp,
00061                          const QString &text, QString sound, QString file,
00062                          int present, int level, int winId);
00063 
00064     void notify(const QString &event, const QString &fromApp,
00065                          const QString &text, QString sound, QString file,
00066                          int present, int level, int winId, int eventId);
00067 
00068 
00069     void reconfigure();
00070     void setVolume( int volume );
00071         void sessionReady(); // from ksmserver
00072 
00073 private:
00074     bool notifyBySound(const QString &sound, const QString &appname, int eventId);
00075     bool notifyByMessagebox(const QString &text, int level, WId winId);
00076     bool notifyByLogfile(const QString &text, const QString &file);
00077     bool notifyByStderr(const QString &text);
00078     bool notifyByPassivePopup(const QString &text, const QString &appName,
00079                                   WId winId );
00080     bool notifyByExecute(const QString &command,
00081                              const QString& event,
00082                              const QString& fromApp,
00083                              const QString& text,
00084                              int winId,
00085                              int eventId );
00086     bool notifyByTaskbar( WId winId );
00087 
00088         void soundFinished( int eventId, PlayingFinishedStatus reason );
00089 
00090         WId checkWinId( const QString& appName, WId senderWinId );
00091 
00095     bool isGlobal(const QString &eventname);
00096 
00097 private slots:
00098         void playTimeout();
00099         void slotPlayerProcessExited( KProcess *proc );
00100         void objectDeleter( KDE::Multimedia::SimplePlayer* );
00101 
00102 signals:
00103     void deletePlayObject( KDE::Multimedia::SimplePlayer* );
00104 
00105 
00106 private:
00107     KNotifyPrivate* d;
00108     void loadConfig();
00109 };
00110 
00111 
00112 #endif
00113 
KDE Logo
This file is part of the documentation for arts Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 13 04:03:37 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003