Skip to content

Commit

Permalink
MythFrontend: Move the SendMessage method into the service api.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Kendall committed Nov 11, 2011
1 parent 94bf2f1 commit 836a072
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
Expand Up @@ -17,6 +17,7 @@ class SERVICE_PUBLIC FrontendServices : public Service

public slots:
virtual DTC::FrontendStatus* GetStatus(void) = 0;
virtual bool SendMessage(const QString &Message) = 0;
};

#endif // FRONTENDSERVICES_H
15 changes: 0 additions & 15 deletions mythtv/programs/mythfrontend/mythfexml.cpp
Expand Up @@ -61,7 +61,6 @@ MythFEXMLMethod MythFEXML::GetMethod(const QString &sURI)
{
if (sURI == "GetServDesc") return MFEXML_GetServiceDescription;
if (sURI == "GetScreenShot") return MFEXML_GetScreenShot;
if (sURI == "SendMessage") return MFEXML_Message;
if (sURI == "SendAction") return MFEXML_Action;
if (sURI == "GetActionList") return MFEXML_ActionList;
if (sURI == "GetActionTest") return MFEXML_ActionListTest;
Expand Down Expand Up @@ -102,9 +101,6 @@ bool MythFEXML::ProcessRequest( HTTPRequest *pRequest )
case MFEXML_GetScreenShot:
GetScreenShot(pRequest);
break;
case MFEXML_Message:
SendMessage(pRequest);
break;
case MFEXML_Action:
SendAction(pRequest);
break;
Expand Down Expand Up @@ -163,17 +159,6 @@ void MythFEXML::GetScreenShot(HTTPRequest *pRequest)
pRequest->m_sFileName = sFileName;
}

void MythFEXML::SendMessage(HTTPRequest *pRequest)
{
pRequest->m_eResponseType = ResponseTypeHTML;
QString sText = pRequest->m_mapParams[ "text" ];
LOG(VB_GENERAL, LOG_DEBUG, QString("UPNP message: ") + sText);

MythMainWindow *window = GetMythMainWindow();
MythEvent* me = new MythEvent(MythEvent::MythUserMessage, sText);
qApp->postEvent(window, me);
}

void MythFEXML::SendAction(HTTPRequest *pRequest)
{
QStringMap* map = &pRequest->m_mapParams;
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/mythfexml.h
Expand Up @@ -17,7 +17,6 @@ typedef enum
MFEXML_Unknown = 0,
MFEXML_GetServiceDescription,
MFEXML_GetScreenShot,
MFEXML_Message,
MFEXML_Action,
MFEXML_ActionList,
MFEXML_ActionListTest,
Expand Down Expand Up @@ -48,7 +47,6 @@ class MythFEXML : public Eventing
MythFEXMLMethod GetMethod( const QString &sURI );

void GetScreenShot ( HTTPRequest *pRequest );
void SendMessage ( HTTPRequest *pRequest );
void SendAction ( HTTPRequest *pRequest );
void GetActionList ( HTTPRequest *pRequest );
void GetActionListTest( HTTPRequest *pRequest );
Expand Down
13 changes: 13 additions & 0 deletions mythtv/programs/mythfrontend/services/frontend.cpp
@@ -1,4 +1,7 @@
#include <QCoreApplication>
#include "mythevent.h"
#include "mythuistatetracker.h"
#include "mythmainwindow.h"
#include "frontend.h"

DTC::FrontendStatus* Frontend::GetStatus(void)
Expand All @@ -7,3 +10,13 @@ DTC::FrontendStatus* Frontend::GetStatus(void)
MythUIStateTracker::GetFreshState(status->State());
return status;
}

bool Frontend::SendMessage(const QString &Message)
{
if (Message.isEmpty())
return false;

qApp->postEvent(GetMythMainWindow(),
new MythEvent(MythEvent::MythUserMessage, Message));
return true;
}
1 change: 1 addition & 0 deletions mythtv/programs/mythfrontend/services/frontend.h
Expand Up @@ -13,6 +13,7 @@ class Frontend : public FrontendServices

public:
DTC::FrontendStatus* GetStatus(void);
bool SendMessage(const QString &Message);
};

class ScriptableFrontend : public QObject
Expand Down

0 comments on commit 836a072

Please sign in to comment.