Ticket #10894: add-network-control-command-message_pause.patch

File add-network-control-command-message_pause.patch, 3.0 KB (added by Tobias Maier <diespambox@…>, 7 years ago)
  • mythtv/programs/mythfrontend/networkcontrol.cpp

    From 35b707d55bf13557fc64a1b89150318dec9acf95 Mon Sep 17 00:00:00 2001
    From: Tobias Maier <diespambox@gmx.net>
    Date: Fri, 6 Jul 2012 20:57:03 +0200
    Subject: [PATCH] add network control command "message_pause"
    
    message_pause displays a simple textmessage and pauses playback
    ---
     mythtv/programs/mythfrontend/networkcontrol.cpp |   27 +++++++++++++++++++++-
     1 files changed, 25 insertions(+), 2 deletions(-)
    
    diff --git a/mythtv/programs/mythfrontend/networkcontrol.cpp b/mythtv/programs/mythfrontend/networkcontrol.cpp
    index bfcf7be..c7b6735 100644
    a b void NetworkControl::processNetworkControlCommand(NetworkCommand *nc) 
    290290        result = processHelp(nc);
    291291    else if (is_abbrev("message", nc->getArg(0)))
    292292        result = processMessage(nc);
     293    else if (is_abbrev("message_pause", nc->getArg(0)))
     294        result = processMessage(nc);
    293295    else if ((nc->getArg(0).toLower() == "exit") || (nc->getArg(0).toLower() == "quit"))
    294296        QCoreApplication::postEvent(this,
    295297                                new NetworkControlCloseEvent(nc->getClient()));
    QString NetworkControl::processHelp(NetworkCommand *nc) 
    11711173        helpText +=
    11721174            "message               - Displays a simple text message popup\r\n";
    11731175    }
     1176    else if (is_abbrev("message_pause", command))
     1177    {
     1178        helpText +=
     1179            "message_pause         - Displays a text message popup and pauses video playback\r\n";
     1180    }
    11741181
    11751182    if (!helpText.isEmpty())
    11761183        return helpText;
    QString NetworkControl::processHelp(NetworkCommand *nc) 
    11881195        "set                - Changes\r\n"
    11891196        "screenshot         - Capture screenshot\r\n"
    11901197        "message            - Display a simple text message\r\n"
     1198        "message_pause      - Same as 'message' but pauses video playback\r\n";
    11911199        "exit               - Exit Network Control\r\n"
    11921200        "\r\n"
    11931201        "Type 'help COMMANDNAME' for help on any specific command.\r\n";
    QString NetworkControl::processMessage(NetworkCommand *nc) 
    12011209        return QString("ERROR: See 'help %1' for usage information")
    12021210                       .arg(nc->getArg(0));
    12031211
    1204     QString message = nc->getCommand().remove(0, 7).trimmed();
     1212    QString message;
     1213    bool pause = false;
     1214    if (is_abbrev("message", nc->getArg(0))){
     1215        message = nc->getCommand().remove(0, 7).trimmed();
     1216    }
     1217    else if (is_abbrev("message_pause", nc->getArg(0))){
     1218        message = nc->getCommand().remove(0, 14).trimmed();
     1219        pause = true;
     1220    }
     1221
    12051222    MythMainWindow *window = GetMythMainWindow();
    1206     MythEvent* me = new MythEvent(MythEvent::MythUserMessage, message);
     1223    QStringList extraData;
     1224    if (pause)
     1225    {
     1226        extraData << "pauseplayback";
     1227    }
     1228
     1229    MythEvent* me = new MythEvent(MythEvent::MythUserMessage, message, extraData);
    12071230    qApp->postEvent(window, me);
    12081231    return QString("OK");
    12091232}