Go to the documentation of this file.
10 #include <QCoreApplication>
14 #include <QTextStream>
17 #include "libmythbase/mythconfig.h"
35 :
Eventing(
"MythFEXML",
"MYTHTV_Event", sSharePath),
36 m_sControlUrl(
"/MythFE")
83 LOG(VB_UPNP, LOG_INFO, QString(
"MythFEXML::ProcessRequest: %1 : %2")
119 int nWidth = pRequest->
m_mapParams[
"width" ].toInt();
120 int nHeight = pRequest->
m_mapParams[
"height" ].toInt();
121 QString sFormat = pRequest->
m_mapParams[
"format" ];
123 if (sFormat.isEmpty())
126 if (sFormat !=
"jpg" && sFormat !=
"png")
128 LOG(VB_GENERAL, LOG_ERR,
"Invalid screen shot format: " + sFormat);
132 LOG(VB_GENERAL, LOG_INFO,
133 QString(
"Screen shot requested (%1x%2), format %3")
134 .arg(nWidth).arg(nHeight).arg(sFormat));
136 QString sFileName = QString(
"/%1/myth-screenshot-XML.%2")
146 " <script type =\"text/javascript\">\n"
147 " function postaction(action) {\n"
148 " var myForm = document.createElement(\"form\");\n"
149 " myForm.method =\"Post\";\n"
150 " myForm.action =\"../Frontend/SendAction?\";\n"
151 " myForm.target =\"post_target\";\n"
152 " var myInput = document.createElement(\"input\");\n"
153 " myInput.setAttribute(\"name\", \"Action\");\n"
154 " myInput.setAttribute(\"value\", action);\n"
155 " myForm.appendChild(myInput);\n"
156 " document.body.appendChild(myForm);\n"
157 " myForm.submit();\n"
158 " document.body.removeChild(myForm);\n"
163 " <iframe id=\"hidden_target\" name=\"post_target\" src=\"\""
164 " style=\"width:0;height:0;border:0px solid #fff;\"></iframe>\n";
171 pRequest->
m_mapRespHeaders[
"Cache-Control" ] =
"no-cache=\"Ext\", max-age = 5000";
180 while (contexts.hasNext())
183 QStringList actions = contexts.value();
184 for (
const QString &
action : std::as_const(actions))
186 QStringList split =
action.split(
",");
187 if (split.size() == 2)
190 QString(
" <div>%1 <input type=\"button\" value=\"%2\" onClick=\"postaction('%2');\"></input> %3</div>\n")
191 .arg(contexts.key(), split[0], split[1]);
204 return QString(
" <input class=\"bigb\" type=\"button\" value=\"%1\" onClick=\"postaction('%2');\"></input>\r\n").arg(
action, desc);
210 pRequest->
m_mapRespHeaders[
"Cache-Control" ] =
"no-cache=\"Ext\", max-age = 5000";
216 " <style type=\"text/css\" title=\"Default\" media=\"all\">\r\n"
220 " width : 310px;\r\n"
224 " width : 100px;\r\n"
227 " text-align: center;\r\n"
230 " <title>MythFrontend Control</title>\r\n" <<
bool ProcessRequest(HTTPRequest *pRequest) override
QStringList GetBasePaths() override
static void GetScreenShot(HTTPRequest *pRequest)
static const QString PROCESS_ACTION
Main header for keybinding classes.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static void FormatErrorResponse(HTTPRequest *pRequest, UPnPResultCode eCode, const QString &sMsg="")
QStringMap m_mapRespHeaders
static MythFEXMLMethod GetMethod(const QString &sURI)
void RegisterService(UPnpDevice *device)
Creates a UPnpService and adds it to the UPnpDevice's list of services.
QStringList GetBasePaths() override
QString m_sServiceDescFileName
void RemoteScreenShot(QString Filename, int Width, int Height)
@ UPnPResult_InvalidAction
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static void GetActionListTest(HTTPRequest *pRequest)
static const QString HIDDEN_IFRAME
QString GetValue(const QString &setting)
void FormatFileResponse(const QString &sFileName)
HttpResponseType m_eResponseType
static QHash< QString, QStringList > gActionDescriptions
MythMainWindow * GetMythMainWindow(void)
MythFEXML(UPnpDevice *pDevice, const QString &sSharePath)
@ MFEXML_GetServiceDescription
static QString BUTTON(const char *action, const char *desc)
static void InitialiseActions(void)
static void GetRemote(HTTPRequest *pRequest)
QString GetSetting(const QString &key, const QString &defaultval="")