#ifndef MYTH_SYSTEM_EVENT_H_
#define MYTH_SYSTEM_EVENT_H_

#include <QEvent>
#include <QObject>

#include "programinfo.h"
#include "recordinginfo.h"
#include "rawsettingseditor.h"

// Helper commands for formatting and sending a MythSystemEvent
MPUBLIC void SendMythSystemEvent(const QString msg);
MPUBLIC void SendMythSystemRecEvent(const QString msg,
                                    const RecordingInfo *pginfo);
MPUBLIC void SendMythSystemPlayEvent(const QString msg,
                                     const ProgramInfo *pginfo);
MPUBLIC void SendMythSystemHostEvent(const QString msg, const QString &hostname,
                                     const QString args);

/** \class MythSystemEventHandler
 *  \brief Handles incoming MythSystemEvent messages
 *
 *  MythSystemEventHandler handles incoming MythSystemEvent messages and runs
 *  the appropriate event handler command on the local system if one is
 *  configured.
 */
class MPUBLIC MythSystemEventHandler : public QObject
{
    Q_OBJECT

  public:
    // Constructor
    MythSystemEventHandler();

    // Destructor
   ~MythSystemEventHandler();

  private:
    // Helpers for converting incoming events to command lines
    void SubstituteMatches(const QStringList &tokens, QString &command);
    QString EventNameToSetting(const QString &name);

    // Custom Event Handler
    void customEvent(QEvent *e);
};

/** \class MythSystemEventEditor
 *  \brief An editor for MythSystemEvent handler commands
 *
 *  This class extends RawSettingsEditor and automatically populates the
 *  settings list with the MythSystemEvent handler command settings names.
 */
class MPUBLIC MythSystemEventEditor : public RawSettingsEditor
{
    Q_OBJECT

  public:
    MythSystemEventEditor(MythScreenStack *parent, const char *name = 0);
};

#endif

/* vim: set expandtab tabstop=4 shiftwidth=4: */
