Skip to content

Commit

Permalink
Add error and visibility option to mythutil
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Jul 18, 2013
1 parent fc6ec79 commit 6594304
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions mythtv/programs/mythutil/commandlineparser.cpp
Expand Up @@ -176,6 +176,10 @@ void MythUtilCommandLineParser::LoadArguments(void)
->SetChildOf("notification");
add("--fullscreen", "fullscreen", false, "(optional) display notification in full screen mode", "")
->SetChildOf("notification");
add("--error", "error", false, "(optional) set notification to be displayed as an error", "")
->SetChildOf("notification");
add("--visibility", "visibility", 0, "(optional) bitmask indicating where to show the notification", "")
->SetChildOf("notification");

// Generic Options used by more than one utility
addRecording();
Expand Down
14 changes: 12 additions & 2 deletions mythtv/programs/mythutil/messageutils.cpp
Expand Up @@ -24,14 +24,16 @@ const QString kMessage =
const QString kNotification =
"<mythnotification version=\"1\">\n"
" <text>%message_text%</text>\n"
" <timeout>%timeout%</timeout>\n"
" <image>%image%</image>\n"
" <origin>%origin%</origin>\n"
" <description>%description%</description>\n"
" <error>%error%</error>\n"
" <timeout>%timeout%</timeout>\n"
" <image>%image%</image>\n"
" <extra>%extra%</extra>\n"
" <progress_text>%progress_text%</progress_text>\n"
" <progress>%progress%</progress>\n"
" <fullscreen>%fullscreen%</fullscreen>\n"
" <visibility>%visibility%</visibility>\n"
"</mythnotification>";

static int PrintMTemplate(const MythUtilCommandLineParser &cmdline)
Expand Down Expand Up @@ -61,6 +63,8 @@ static int SendMessage(const MythUtilCommandLineParser &cmdline)
QString progress_text = "";
QString progress = "-1";
QString fullscreen = "false";
QString error = "false";
QString visibility = "0";

QString message = notification ? kNotification : kMessage;

Expand Down Expand Up @@ -97,6 +101,12 @@ static int SendMessage(const MythUtilCommandLineParser &cmdline)
if (cmdline.toBool("fullscreen"))
fullscreen = cmdline.toString("fullscreen");
message.replace("%fullscreen%", fullscreen);
if (cmdline.toBool("error"))
error = cmdline.toString("error");
message.replace("%error%", error);
if (cmdline.toBool("visibility"))
visibility = cmdline.toString("visibility");
message.replace("%visibility%", visibility);
}

// extra optional argument
Expand Down

0 comments on commit 6594304

Please sign in to comment.