diff --git a/mythtv/libs/libmythbase/libmythbase.pro b/mythtv/libs/libmythbase/libmythbase.pro index 07581a4ca55..090ccfb3c31 100644 --- a/mythtv/libs/libmythbase/libmythbase.pro +++ b/mythtv/libs/libmythbase/libmythbase.pro @@ -17,7 +17,8 @@ HEADERS += verbosedefs.h mythversion.h compat.h mythconfig.h HEADERS += mythobservable.h mythevent.h HEADERS += mythtimer.h mythsignalingtimer.h mythdirs.h exitcodes.h HEADERS += lcddevice.h mythstorage.h remotefile.h logging.h loggingserver.h -HEADERS += mythcorecontext.h mythsystem.h mythlocale.h storagegroup.h +HEADERS += mythcorecontext.h mythsystem.h mythsystemprivate.h +HEADERS += mythlocale.h storagegroup.h HEADERS += mythcoreutil.h mythdownloadmanager.h mythtranslation.h HEADERS += unzip.h unzip_p.h zipentry_p.h iso639.h iso3166.h mythmedia.h HEADERS += mythmiscutil.h mythhdd.h mythcdrom.h autodeletedeque.h dbutil.h diff --git a/mythtv/libs/libmythbase/mythsystem.h b/mythtv/libs/libmythbase/mythsystem.h index 9a29ce9d60f..efa116f32b4 100644 --- a/mythtv/libs/libmythbase/mythsystem.h +++ b/mythtv/libs/libmythbase/mythsystem.h @@ -56,9 +56,6 @@ typedef enum MythSystemMask { #include #include #include // FIXME: This shouldn't be needed, Setting_t is not public -#include // FIXME: QPointer is deprecated - -#include "referencecounter.h" // FIXME: _t is not how we name types in MythTV... typedef QMap Setting_t; @@ -185,11 +182,12 @@ class MBASE_PUBLIC MythSystem : public QObject private: void initializePrivate(void); - MythSystemPrivate *d; + MythSystemPrivate *d; // FIXME we generally call this m_priv in MythTV protected: void ProcessFlags(uint flags); + // FIXME if we already have a private helper, why all this? uint m_status; QSemaphore m_semReady; @@ -205,63 +203,6 @@ class MBASE_PUBLIC MythSystem : public QObject QBuffer m_stdbuff[3]; }; -// FIXME: do we really need reference counting? -// it shouldn't be difficult to track the lifetime of a private object. -// FIXME: This should not live in the same header as MythSystem -class MythSystemPrivate : public QObject, public ReferenceCounter -{ - Q_OBJECT - - public: - MythSystemPrivate(const QString &debugName); - - virtual void Fork(time_t timeout) = 0; - virtual void Manage(void) = 0; - - virtual void Term(bool force=false) = 0; - virtual void Signal(int sig) = 0; - virtual void JumpAbort(void) = 0; - - virtual bool ParseShell(const QString &cmd, QString &abscmd, - QStringList &args) = 0; - - protected: - QPointer m_parent; - - uint GetStatus(void) { return m_parent->GetStatus(); } - void SetStatus(uint status) { m_parent->SetStatus(status); } - - // FIXME: We should not return a reference here - QString& GetLogCmd(void) { return m_parent->GetLogCmd(); } - // FIXME: We should not return a reference here - QString& GetDirectory(void) { return m_parent->GetDirectory(); } - - bool GetSetting(const char *setting) - { return m_parent->GetSetting(setting); } - - // FIXME: We should not return a reference here - QString& GetCommand(void) { return m_parent->GetCommand(); } - void SetCommand(QString &cmd) { m_parent->SetCommand(cmd); } - - // FIXME: We should not return a reference here - // FIXME: Rename "GetArguments" - QStringList &GetArgs(void) { return m_parent->GetArgs(); } - // FIXME: Rename "SetArguments" - void SetArgs(QStringList &args) { m_parent->SetArgs(args); } - - // FIXME: This is likely a bad idea, but possibly manageable - // since this is a private class. - QBuffer *GetBuffer(int index) { return m_parent->GetBuffer(index); } - // FIXME: This is likely a bad idea, but possibly manageable - // since this is a private class. - void Unlock(void) { m_parent->Unlock(); } - - signals: - void started(void); - void finished(void); - void error(uint status); - void readDataReady(int fd); -}; MBASE_PUBLIC uint myth_system(const QString &command, diff --git a/mythtv/libs/libmythbase/mythsystemprivate.h b/mythtv/libs/libmythbase/mythsystemprivate.h new file mode 100644 index 00000000000..ffcba883ab3 --- /dev/null +++ b/mythtv/libs/libmythbase/mythsystemprivate.h @@ -0,0 +1,81 @@ +/// -*- Mode: c++ -*- + +#ifndef MYTHSYSTEMPRIVATE_H_ +#define MYTHSYSTEMPRIVATE_H_ + +// C header +#include // for uint + +// Qt header +#include // FIXME: QPointer is deprecated +#include + +// MythTV header +#include "referencecounter.h" +#include "mythbaseexp.h" +#include "mythsystem.h" + +class QStringList; +class QString; +class QBuffer; + +// FIXME: do we really need reference counting? +// it shouldn't be difficult to track the lifetime of a private object. +// FIXME: This should not live in the same header as MythSystem +class MythSystemPrivate : public QObject, public ReferenceCounter +{ + Q_OBJECT + + public: + MythSystemPrivate(const QString &debugName); + + virtual void Fork(time_t timeout) = 0; + virtual void Manage(void) = 0; + + virtual void Term(bool force=false) = 0; + virtual void Signal(int sig) = 0; + virtual void JumpAbort(void) = 0; + + virtual bool ParseShell(const QString &cmd, QString &abscmd, + QStringList &args) = 0; + + protected: + // FIXME: QPointer uses global hash & is deprecated for good reason + QPointer m_parent; + + uint GetStatus(void) { return m_parent->GetStatus(); } + void SetStatus(uint status) { m_parent->SetStatus(status); } + + // FIXME: We should not return a reference here + QString& GetLogCmd(void) { return m_parent->GetLogCmd(); } + // FIXME: We should not return a reference here + QString& GetDirectory(void) { return m_parent->GetDirectory(); } + + bool GetSetting(const char *setting) + { return m_parent->GetSetting(setting); } + + // FIXME: We should not return a reference here + QString& GetCommand(void) { return m_parent->GetCommand(); } + void SetCommand(QString &cmd) { m_parent->SetCommand(cmd); } + + // FIXME: We should not return a reference here + // FIXME: Rename "GetArguments" + QStringList &GetArgs(void) { return m_parent->GetArgs(); } + // FIXME: Rename "SetArguments" + void SetArgs(QStringList &args) { m_parent->SetArgs(args); } + + // FIXME: This is likely a bad idea, but possibly manageable + // since this is a private class. + QBuffer *GetBuffer(int index) { return m_parent->GetBuffer(index); } + // FIXME: This is likely a bad idea, but possibly manageable + // since this is a private class. + void Unlock(void) { m_parent->Unlock(); } + + signals: + void started(void); + void finished(void); + void error(uint status); + void readDataReady(int fd); +}; + +#endif // MYTHSYSTEMPRIVATE_H_ diff --git a/mythtv/libs/libmythbase/mythsystemunix.h b/mythtv/libs/libmythbase/mythsystemunix.h index b3dd1f45196..afd894d7fa5 100644 --- a/mythtv/libs/libmythbase/mythsystemunix.h +++ b/mythtv/libs/libmythbase/mythsystemunix.h @@ -16,6 +16,7 @@ #include #include +#include "mythsystemprivate.h" #include "mythbaseexp.h" #include "mythsystem.h" #include "mthread.h" diff --git a/mythtv/libs/libmythbase/mythsystemwindows.h b/mythtv/libs/libmythbase/mythsystemwindows.h index 5fc1eb8480c..8d75d0bc3b1 100644 --- a/mythtv/libs/libmythbase/mythsystemwindows.h +++ b/mythtv/libs/libmythbase/mythsystemwindows.h @@ -12,6 +12,7 @@ #include #include +#include "mythsystemprivate.h" #include "mythbaseexp.h" #include "mythsystem.h" #include "mthread.h"