Ticket #4168: 4168-v1.patch
File 4168-v1.patch, 24.9 KB (added by , 16 years ago) |
---|
-
mythplugins/mythmusic/mythmusic/playbackbox.cpp
1968 1968 OutputEvent *aoe = (OutputEvent *) event; 1969 1969 1970 1970 VERBOSE(VB_IMPORTANT, QString("%1 %2").arg(statusString) 1971 .arg(*aoe->errorMessage())); 1972 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 1973 statusString, 1974 QString("MythMusic has encountered the following error:\n%1") 1975 .arg(*aoe->errorMessage())); 1971 .arg(aoe->GetErrorMessage())); 1972 1973 MythPopupBox::showOkPopup( 1974 gContext->GetMainWindow(), 1975 statusString, 1976 tr("MythMusic has encountered the following error") + 1977 QString(":\n%1").arg(aoe->GetErrorMessage())); 1978 1976 1979 stopAll(); 1977 1980 1978 1981 break; -
mythplugins/mythmusic/mythmusic/musicplayer.cpp
466 466 OutputEvent *aoe = (OutputEvent *) event; 467 467 468 468 VERBOSE(VB_IMPORTANT, QString("Output Error - %1") 469 .arg(*aoe->errorMessage())); 470 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 471 "Output Error:", 472 QString("MythMusic has encountered the following error:\n%1") 473 .arg(*aoe->errorMessage())); 469 .arg(aoe->GetErrorMessage())); 470 471 MythPopupBox::showOkPopup( 472 gContext->GetMainWindow(), 473 tr("Output Error") + ":", 474 tr("MythMusic has encountered the following error") + 475 QString(":\n%1").arg(aoe->GetErrorMessage())); 476 474 477 stop(true); 475 478 476 479 break; -
mythtv/libs/libmythtv/programinfo.cpp
278 278 #define LONGLONG_TO_LIST(x) INT_TO_LIST((int)((x) >> 32)) \ 279 279 INT_TO_LIST((int)((x) & 0xffffffffLL)) 280 280 281 #define STR_TO_LIST(x) if ((x).isNull()) list << ""; else list << (x);281 #define STR_TO_LIST(x) if ((x).isNull()) list << ""; else list << QDeepCopy<QString>(x); 282 282 #define DATE_TO_LIST(x) STR_TO_LIST((x).toString(Qt::ISODate)) 283 283 284 284 #define FLOAT_TO_LIST(x) sprintf(tmp, "%f", (x)); list << tmp; … … 368 368 VERBOSE(VB_IMPORTANT, listerror); \ 369 369 return false; \ 370 370 } \ 371 ts = *it++;\371 ts = QDeepCopy<QString>(*it++); \ 372 372 if (ts.isNull()) \ 373 373 ts = ""; 374 374 -
mythtv/libs/libmyth/output.h
1 // -*- Mode: c++ -*- 1 2 // Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> 2 3 // 3 4 // Use, modification and distribution is allowed without limitation, … … 10 11 class OutputListeners; 11 12 class OutputEvent; 12 13 13 #include <qthread.h>14 #include <qevent.h>15 #include <qptrlist.h>16 14 #include "mythobservable.h" 17 15 18 16 class QObject; … … 24 22 25 23 class MPUBLIC OutputEvent : public MythEvent 26 24 { 27 public: 28 enum Type { Playing = (User + 200), Buffering, Info, Paused, 29 Stopped, Error }; 25 public: 26 enum Type 27 { 28 Playing = MythOutputEventBegin, 29 Buffering, 30 Info, 31 Paused, 32 Stopped, 33 Error, 34 }; 30 35 31 OutputEvent(Type t) 32 : MythEvent(t), error_msg(0), elasped_seconds(0), written_bytes(0), 33 brate(0), freq(0), prec(0), chan(0) 36 OutputEvent(Type t) : 37 MythEvent(t), error_msg(QString::null), 38 elapsed_seconds(0), written_bytes(0), 39 brate(0), freq(0), prec(0), chan(0) 34 40 { ; } 35 41 36 OutputEvent(long s, unsigned long w, int b, int f, int p, int c) 37 : MythEvent(Info), error_msg(0), elasped_seconds(s), written_bytes(w),38 42 OutputEvent(long s, unsigned long w, int b, int f, int p, int c) : 43 MythEvent(Info), error_msg(QString::null), elapsed_seconds(s), 44 written_bytes(w), brate(b), freq(f), prec(p), chan(c) 39 45 { ; } 40 46 41 OutputEvent(const QString &e) 42 : MythEvent(Error), elasped_seconds(0), written_bytes(0), 43 brate(0), freq(0), prec(0), chan(0) 44 { 45 error_msg = new QString(e.utf8()); 46 } 47 OutputEvent(const QString &e); 47 48 49 virtual MythEvent *clone(void) const { return new OutputEvent(*this); } 48 50 49 ~OutputEvent() 50 { 51 if (error_msg) 52 delete error_msg; 53 } 51 virtual ~OutputEvent() {} 54 52 55 const QString *errorMessage() const { return error_msg; } 53 QString GetErrorMessage(void) const; 54 long elapsedSeconds(void) const { return elapsed_seconds; } 55 unsigned long writtenBytes(void) const { return written_bytes; } 56 int bitrate(void) const { return brate; } 57 int frequency(void) const { return freq; } 58 int precision(void) const { return prec; } 59 int channels(void) const { return chan; } 56 60 57 const long &elapsedSeconds() const { return elasped_seconds; } 58 const unsigned long &writtenBytes() const { return written_bytes; } 59 const int &bitrate() const { return brate; } 60 const int &frequency() const { return freq; } 61 const int &precision() const { return prec; } 62 const int &channels() const { return chan; } 61 protected: 62 OutputEvent(const OutputEvent&); 63 OutputEvent(void); // prevent default ctor 64 OutputEvent &operator=(const OutputEvent &o); // prevent default copy ctor 63 65 64 virtual OutputEvent *clone() { return new OutputEvent(*this); }; 65 66 private: 67 QString *error_msg; 68 69 long elasped_seconds; 66 protected: 67 QString error_msg; 68 long elapsed_seconds; 70 69 unsigned long written_bytes; 71 int brate, freq, prec, chan; 70 int brate; 71 int freq; 72 int prec; 73 int chan; 72 74 }; 73 75 74 76 75 77 class MPUBLIC OutputListeners : public MythObservable 76 78 { 77 public:78 OutputListeners() ;79 virtual ~OutputListeners() ;79 public: 80 OutputListeners() : m_bufsize(0) {} 81 virtual ~OutputListeners() {} 80 82 81 83 void addVisual(MythTV::Visual *); 82 84 void removeVisual(MythTV::Visual *); 83 84 QMutex *mutex() { return &mtx; }85 85 86 void setBufferSize(unsigned int sz) { bufsize = sz; }87 unsigned int bufferSize( ) const { returnbufsize; }86 void setBufferSize(unsigned int sz) { m_bufsize = sz; } 87 unsigned int bufferSize(void) const { return m_bufsize; } 88 88 89 protected:89 protected: 90 90 void error(const QString &e); 91 void dispatchVisual(uchar *b, unsigned long b_len, 92 unsigned long written, int chan, int prec); 93 void prepareVisuals(); 91 void dispatchVisual( 92 uchar *buffer, unsigned long b_len, 93 unsigned long written, int chan, int prec); 94 void prepareVisuals(void); 94 95 95 private: 96 QMutex mtx; 97 QPtrList<MythTV::Visual> visuals; 98 99 unsigned int bufsize; 96 private: 97 typedef vector<MythTV::Visual*> VisualList; 98 VisualList m_visuals; 99 unsigned int m_bufsize; 100 100 }; 101 101 102 102 -
mythtv/libs/libmyth/mythcontext.cpp
3991 3991 return QDeepCopy<QString>(x11_display); 3992 3992 } 3993 3993 3994 void MythContext::dispatch( MythEvent &event)3994 void MythContext::dispatch(const MythEvent &event) 3995 3995 { 3996 3996 if (print_verbose_messages & VB_NETWORK) 3997 3997 VERBOSE(VB_NETWORK, QString("MythEvent: %1").arg(event.Message())); … … 3999 3999 MythObservable::dispatch(event); 4000 4000 } 4001 4001 4002 void MythContext::dispatchNow( MythEvent &event)4002 void MythContext::dispatchNow(const MythEvent &event) 4003 4003 { 4004 4004 if (print_verbose_messages & VB_NETWORK) 4005 4005 VERBOSE(VB_NETWORK, QString("MythEvent: %1").arg(event.Message())); -
mythtv/libs/libmyth/mythcontext.h
106 106 107 107 /// Update this whenever the plug-in API changes. 108 108 /// Including changes in the libmythtv class methods used by plug-ins. 109 #define MYTH_BINARY_VERSION "0.21.2008022 4-1"109 #define MYTH_BINARY_VERSION "0.21.20080226-1" 110 110 111 111 /** \brief Increment this whenever the MythTV network protocol changes. 112 112 * … … 318 318 QString removeCurrentLocation(void); 319 319 QString getCurrentLocation(void); 320 320 321 void dispatch( MythEvent &event);322 void dispatchNow( MythEvent &event);321 void dispatch(const MythEvent &event); 322 void dispatchNow(const MythEvent &event); 323 323 324 324 void sendPlaybackStart(void); 325 325 void sendPlaybackEnd(void); -
mythtv/libs/libmyth/output.cpp
1 // Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> 2 // 3 // Use, modification and distribution is allowed without limitation, 4 // warranty, or liability of any kind. 5 // 1 // -*- Mode: c++ -*- 2 /* 3 * Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> 4 * Copyright (c) 2008 Daniel Kristjansson <danielk@cuymedia.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 6 20 21 #include <algorithm> // for find 22 using namespace std; 23 7 24 #include <qobject.h> 8 25 #include <qapplication.h> 26 #include <qdeepcopy.h> 9 27 10 28 #include "output.h" 11 29 #include "visual.h" 12 30 13 OutputListeners::OutputListeners() 31 OutputEvent::OutputEvent(const OutputEvent &other) : 32 MythEvent(other), error_msg(QString::null), 33 elapsed_seconds(other.elapsed_seconds), 34 written_bytes(other.written_bytes), 35 brate(other.brate), freq(other.freq), 36 prec(other.prec), chan(other.chan) 14 37 { 15 bufsize=0; 38 if (!other.error_msg.isNull()) 39 error_msg = QDeepCopy<QString>(other.error_msg); 16 40 } 17 41 42 OutputEvent::OutputEvent(const QString &e) : 43 MythEvent(Error), error_msg(QString::null), 44 elapsed_seconds(0), written_bytes(0), 45 brate(0), freq(0), prec(0), chan(0) 46 { 47 error_msg = QDeepCopy<QString>(QString(e.utf8())); 48 } 18 49 19 OutputListeners::~OutputListeners() 50 QString OutputEvent::GetErrorMessage(void) const 20 51 { 52 return QDeepCopy<QString>(error_msg); 21 53 } 22 54 55 void OutputListeners::error(const QString &e) 56 { 57 QMutexLocker locker(&m_lock); 23 58 24 void OutputListeners::error(const QString &e) { 25 QObject *object = firstListener(); 26 while (object) { 27 QApplication::postEvent(object, new OutputEvent(e)); 28 object = nextListener(); 29 } 59 ListenerList::iterator it = m_listeners.begin(); 60 for ( ; it != m_listeners.end(); ++it) 61 QApplication::postEvent(*it, new OutputEvent(e)); 30 62 } 31 63 32 void OutputListeners::addVisual(MythTV::Visual *v )64 void OutputListeners::addVisual(MythTV::Visual *visual) 33 65 { 34 if (visuals.find(v) == -1) { 35 visuals.append(v); 36 } 66 QMutexLocker locker(&m_lock); 67 68 VisualList::iterator it = 69 find(m_visuals.begin(), m_visuals.end(), visual); 70 71 if (it == m_visuals.end()) 72 m_visuals.push_back(visual); 37 73 } 38 74 39 void OutputListeners::removeVisual(MythTV::Visual *v )75 void OutputListeners::removeVisual(MythTV::Visual *visual) 40 76 { 41 visuals.remove(v); 77 QMutexLocker locker(&m_lock); 78 79 VisualList::iterator it = 80 find(m_visuals.begin(), m_visuals.end(), visual); 81 82 if (it != m_visuals.end()) 83 m_visuals.erase(it); 42 84 } 43 85 44 void OutputListeners::dispatchVisual(uchar *buffer, unsigned long b_len, 45 unsigned long written, int chan, int prec) 86 void OutputListeners::dispatchVisual( 87 uchar *buffer, unsigned long b_len, 88 unsigned long written, int chan, int prec) 46 89 { 47 if (! 48 return;90 if (!buffer) 91 return; 49 92 50 MythTV::Visual *visual = visuals.first(); 51 while (visual) { 52 visual->mutex()->lock(); 53 visual->add(buffer, b_len, written, chan, prec); 54 visual->mutex()->unlock(); 93 QMutexLocker locker(&m_lock); 55 94 56 visual = visuals.next(); 95 VisualList::iterator it = m_visuals.begin(); 96 for ( ; it != m_visuals.end(); ++it) 97 { 98 (*it)->mutex()->lock(); 99 (*it)->add(buffer, b_len, written, chan, prec); 100 (*it)->mutex()->unlock(); 57 101 } 58 102 } 59 103 60 void OutputListeners::prepareVisuals( )104 void OutputListeners::prepareVisuals(void) 61 105 { 62 MythTV::Visual *visual = visuals.first(); 63 while (visual) { 64 visual->mutex()->lock(); 65 visual->prepare(); 66 visual->mutex()->unlock(); 106 QMutexLocker locker(&m_lock); 67 107 68 visual = visuals.next(); 108 VisualList::iterator it = m_visuals.begin(); 109 for ( ; it != m_visuals.end(); ++it) 110 { 111 (*it)->mutex()->lock(); 112 (*it)->prepare(); 113 (*it)->mutex()->unlock(); 69 114 } 70 115 } -
mythtv/libs/libmyth/mythobservable.cpp
1 // -*- Mode: c++ -*- 2 /* 3 * Copyright (c) 2008 Daniel Kristjansson <danielk@cuymedia.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program 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 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 #include <algorithm> // for find 21 using namespace std; 22 1 23 #include <qobject.h> 2 24 #include <qapplication.h> 25 3 26 #include "mythobservable.h" 4 27 5 MythObservable::MythObservable() 28 MythObservable::MythObservable() : m_lock(true) 6 29 { 7 30 } 8 31 … … 12 35 13 36 void MythObservable::addListener(QObject *listener) 14 37 { 15 if (m_listeners.find(listener) == -1) 16 m_listeners.append(listener); 38 QMutexLocker locker(&m_lock); 39 40 ListenerList::iterator it = 41 find(m_listeners.begin(), m_listeners.end(), listener); 42 43 if (it == m_listeners.end()) 44 m_listeners.push_back(listener); 17 45 } 18 46 19 47 void MythObservable::removeListener(QObject *listener) 20 48 { 21 if (m_listeners.find(listener) != -1) 22 m_listeners.remove(listener); 23 } 49 QMutexLocker locker(&m_lock); 24 50 25 QObject* MythObservable::firstListener() 26 { 27 return m_listeners.first(); 51 ListenerList::iterator it = 52 find(m_listeners.begin(), m_listeners.end(), listener); 53 54 if (it != m_listeners.end()) 55 m_listeners.erase(it); 28 56 } 29 57 30 QObject* MythObservable::nextListener()58 void MythObservable::dispatch(const MythEvent &event) 31 59 { 32 return m_listeners.next(); 33 } 60 QMutexLocker locker(&m_lock); 34 61 35 QPtrList<QObject> MythObservable::getListeners() 36 { 37 return m_listeners;62 ListenerList::iterator it = m_listeners.begin(); 63 for ( ; it != m_listeners.end(); ++it) 64 QApplication::postEvent(*it, event.clone()); 38 65 } 39 66 40 void MythObservable::dispatch (MythEvent &event)67 void MythObservable::dispatchNow(const MythEvent &event) 41 68 { 42 QObject *listener = firstListener(); 43 while (listener) 44 { 45 QApplication::postEvent(listener, event.clone()); 46 listener = nextListener(); 47 } 48 } 69 QMutexLocker locker(&m_lock); 49 70 50 void MythObservable::dispatchNow(MythEvent &event) 51 { 52 QObject *listener = firstListener(); 53 while (listener) 71 ListenerList::iterator it = m_listeners.begin(); 72 for ( ; it != m_listeners.end(); ++it) 54 73 { 55 74 // Note: unlike postEvent, send event does not take 56 75 // ownership of pointer and will not delete it. 57 QApplication::sendEvent(listener, &event); 58 listener = nextListener(); 76 MythEvent *tmp = event.clone(); 77 QApplication::sendEvent(*it, tmp); 78 delete tmp; 59 79 } 60 80 } 61 -
mythtv/libs/libmyth/mythevent.h
1 // -*- Mode: c++ -*- 1 2 #ifndef MYTHEVENT_H_ 2 3 #define MYTHEVENT_H_ 3 4 … … 16 17 class MPUBLIC MythEvent : public QCustomEvent 17 18 { 18 19 public: 19 enum Type { MythEventMessage = (User + 1000) }; 20 enum Type 21 { 22 MythEventBegin = (User + 200), 23 MythEventMessage = MythEventBegin, 24 MythEventEnd = (User + 299), 25 MythOutputEventBegin = (User + 300), 26 // defined in output.h 27 MythOutputEventEnd = (User + 399), 28 }; 20 29 21 30 MythEvent(int t); 22 31 MythEvent(const QString &lmessage); 23 32 MythEvent(const QString &lmessage, const QStringList &lextradata); 33 virtual MythEvent *clone(void) const { return new MythEvent(*this); } 24 34 25 35 virtual ~MythEvent(); 26 36 27 const QString& Message() const { return message; }28 const QString&ExtraData(int idx = 0) const;29 const QStringList& ExtraDataList() const { return extradata; }30 int ExtraDataCount() const { return extradata.size(); }37 QString Message(void) const; 38 QString ExtraData(int idx = 0) const; 39 QStringList ExtraDataList(void) const; 40 unsigned int ExtraDataCount(void) const; 31 41 32 virtual MythEvent* clone() { return new MythEvent(message, extradata); } 42 /// Note: do not assign the strings from this except with QDeepCopy 43 const QStringList &ExtraDataListUnsafe(void) const; 33 44 34 private: 35 QString message; 45 protected: 46 MythEvent(const MythEvent &other); 47 MythEvent(void); // prevent default ctor 48 MythEvent &operator=(const MythEvent &o); // prevent default copy ctor 49 50 protected: 51 QString message; 36 52 QStringList extradata; 37 53 }; 38 54 -
mythtv/libs/libmyth/mythevent.cpp
1 1 // -*- Mode: c++ -*- 2 /* 3 * Copyright (c) 2008 Daniel Kristjansson <danielk@cuymedia.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program 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 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 2 19 3 20 #include "mythevent.h" 4 21 #include <qdeepcopy.h> 5 22 23 MythEvent::MythEvent(const MythEvent &other) : 24 QCustomEvent(MythEventMessage) 25 { 26 message = QDeepCopy<QString>(other.message); 27 extradata = QDeepCopy<QStringList>(other.extradata); 28 } 29 6 30 MythEvent::MythEvent(int t) : 7 31 QCustomEvent(t), message(QString::null), extradata("empty") 8 32 { … … 26 50 { 27 51 } 28 52 29 const QString &MythEvent::ExtraData(int idx) const53 QString MythEvent::Message(void) const 30 54 { 55 return QDeepCopy<QString>(message); 56 } 57 58 QString MythEvent::ExtraData(int idx) const 59 { 31 60 if (((uint)idx) < extradata.size()) 32 return extradata[idx];61 return QDeepCopy<QString>(extradata[idx]); 33 62 return QString::null; 34 63 } 64 65 QStringList MythEvent::ExtraDataList(void) const 66 { 67 return QDeepCopy<QStringList>(extradata); 68 } 69 70 const QStringList &MythEvent::ExtraDataListUnsafe(void) const 71 { 72 return extradata; 73 } 74 75 unsigned int MythEvent::ExtraDataCount(void) const 76 { 77 return extradata.size(); 78 } -
mythtv/libs/libmyth/mythobservable.h
1 1 #ifndef MYTHOBSERVABLE_H_ 2 2 #define MYTHOBSERVABLE_H_ 3 3 4 #include <qptrlist.h> 4 // C++ headers 5 #include <vector> 6 using namespace std; 7 8 // Qt headers 9 #include <qmutex.h> 10 11 // MythTV headers 5 12 #include "mythexp.h" 6 13 #include "mythevent.h" 7 14 … … 14 21 listeners and iterating across them. It is typically used to post 15 22 events to listening QObjects. 16 23 17 For example, to post a custom event with event id 100 to all listeners :18 19 \code20 void dispatch()21 {22 QObject *listener = firstListener();23 while (listener) {24 QApplication::postEvent (listener, new QCustomEvent(100));25 listener = nextListener();26 }27 }28 \endcode29 30 24 MythEvents can be dispatched to all listeners by calling dispatch 31 25 or dispatchNow. The former is much preferred as it uses 32 26 QApplication::postEvent() while the latter uses the blocking … … 61 55 */ 62 56 void removeListener(QObject *listener); 63 57 64 /** \brief Begin iteration across listeners65 66 If you simply need to iterate across the listeners, use \p67 firstListener and \p nextListener to iterate across the68 listeners. Ie. instead of69 70 \code71 {72 QPtrList<QObject> listeners = getListeners();73 QObject *listener = listeners.first();74 while (listener) {75 // use listener...76 listener = listeners.next();77 }78 }79 \endcode80 81 you can avoid the copy and just do82 83 \code84 {85 QObject *listener = firstListener();86 while (listener) {87 // use listener...88 listener = nextListener();89 }90 }91 \endcode92 93 \returns pointer to the first listener, NULL if there are no listeners94 */95 QObject* firstListener();96 97 /** \brief Continue iteration to the next listener98 99 See firstListener. Returns NULL if there are no more listeners.100 101 \returns pointer to the next listener, NULL if there are no more listeners102 */103 QObject* nextListener();104 105 /** \brief Get a copy of the list of listener106 107 If you need access to more than just iteration via108 firstListener/nextListerner, you can call this to obtain a109 QPtrList with all the listeners.110 111 \returns a copy of the list of listener112 */113 QPtrList<QObject> getListeners(void);114 115 58 /** \brief Dispatch an event to all listeners 116 59 117 60 Makes a copy of the event on the heap by calling … … 120 63 121 64 \param event a MythEvent to dispatch. 122 65 */ 123 void dispatch( MythEvent &event);66 void dispatch(const MythEvent &event); 124 67 125 68 /** \brief Dispatch an event to all listeners 126 69 … … 131 74 132 75 \param event a MythEvent to dispatch. 133 76 */ 134 void dispatchNow( MythEvent &event);77 void dispatchNow(const MythEvent &event); 135 78 136 private: 137 QPtrList<QObject> m_listeners; 79 protected: 80 typedef vector<QObject*> ListenerList; 81 82 mutable QMutex m_lock; 83 ListenerList m_listeners; 138 84 }; 139 85 140 86 #endif /* MYTHOBSERVABLE_H */