summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/README.extcap6
-rwxr-xr-xdoc/extcap_example.py2
-rw-r--r--extcap_parser.c8
-rw-r--r--extcap_parser.h2
-rw-r--r--ui/qt/extcap_argument.cpp3
5 files changed, 17 insertions, 4 deletions
diff --git a/doc/README.extcap b/doc/README.extcap
index 5707fd02fe..025c3ffb71 100644
--- a/doc/README.extcap
+++ b/doc/README.extcap
@@ -95,7 +95,7 @@ Example:
$ extcapbin --extcap-interface IFACE --extcap-config
arg {number=0}{call=--delay}{display=Time delay}{tooltip=Time delay between packages}{type=integer}{range=1,15}{required=true}
-arg {number=1}{call=--message}{display=Message}{tooltip=Package message content}{type=string}
+arg {number=1}{call=--message}{display=Message}{tooltip=Package message content}{placeholder=Please enter a message here ...}{type=string}
arg {number=2}{call=--verify}{display=Verify}{tooltip=Verify package content}{type=boolflag}
arg {number=3}{call=--remote}{display=Remote Channel}{tooltip=Remote Channel Selector}{type=selector}
arg {number=4}{call=--server}{display=IP address for log server}{type=string}{validation=\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b}
@@ -137,8 +137,8 @@ All options must provide a number, by which they are identified. No NUMBER may b
provided twice. Also all options must present the elements CALL and DISPLAY, where
call provides the arguments name on the command-line and display the name in the GUI.
-Additionally TOOLTIP may be provided, which will give the user an explanation within
-the GUI, about what to enter into this field.
+Additionally TOOLTIP and PLACEHOLDER may be provided, which will give the user an
+explanation within the GUI, about what to enter into this field.
These options do have types, for which the following types are being supported:
diff --git a/doc/extcap_example.py b/doc/extcap_example.py
index 446cccb8f1..3a3fde7aa7 100755
--- a/doc/extcap_example.py
+++ b/doc/extcap_example.py
@@ -98,7 +98,7 @@ def extcap_config(interface):
values = []
args.append ( (0, '--delay', 'Time delay', 'Time delay between packages', 'integer', '{range=1,15}{default=5}') )
- args.append ( (1, '--message', 'Message', 'Package message content', 'string', '{required=true}') )
+ args.append ( (1, '--message', 'Message', 'Package message content', 'string', '{required=true}{placeholder=Please enter a message here ...}') )
args.append ( (2, '--verify', 'Verify', 'Verify package content', 'boolflag', '{default=yes}') )
args.append ( (3, '--remote', 'Remote Channel', 'Remote Channel Selector', 'selector', ''))
args.append ( (4, '--fake_ip', 'Fake IP Address', 'Use this ip address as sender', 'string', '{save=false}{validation=\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b}'))
diff --git a/extcap_parser.c b/extcap_parser.c
index 889dbbe309..3fac966e8a 100644
--- a/extcap_parser.c
+++ b/extcap_parser.c
@@ -171,6 +171,8 @@ static extcap_token_sentence *extcap_tokenize_sentence(const gchar *s) {
param_type = EXTCAP_PARAM_RANGE;
} else if (g_ascii_strcasecmp(arg, "tooltip") == 0) {
param_type = EXTCAP_PARAM_TOOLTIP;
+ } else if (g_ascii_strcasecmp(arg, "placeholder") == 0) {
+ param_type = EXTCAP_PARAM_PLACEHOLDER;
} else if (g_ascii_strcasecmp(arg, "mustexist") == 0) {
param_type = EXTCAP_PARAM_FILE_MUSTEXIST;
} else if (g_ascii_strcasecmp(arg, "fileext") == 0) {
@@ -248,6 +250,7 @@ void extcap_free_arg(extcap_arg *a) {
g_free(a->call);
g_free(a->display);
g_free(a->tooltip);
+ g_free(a->placeholder);
g_free(a->fileextension);
g_free(a->regexp);
g_free(a->device_name);
@@ -355,6 +358,11 @@ static extcap_arg *extcap_parse_arg_sentence(GList *args, extcap_token_sentence
target_arg->tooltip = g_strdup(param_value);
}
+ if ((param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_PLACEHOLDER)))
+ != NULL) {
+ target_arg->placeholder = g_strdup(param_value);
+ }
+
if ((param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_FILE_MUSTEXIST)))
!= NULL) {
target_arg->fileexists = g_regex_match_simple(EXTCAP_BOOLEAN_REGEX, param_value, G_REGEX_CASELESS, (GRegexMatchFlags)0);
diff --git a/extcap_parser.h b/extcap_parser.h
index c8c40328d7..1fd4d42071 100644
--- a/extcap_parser.h
+++ b/extcap_parser.h
@@ -68,6 +68,7 @@ typedef enum {
EXTCAP_PARAM_VALUE,
EXTCAP_PARAM_RANGE,
EXTCAP_PARAM_TOOLTIP,
+ EXTCAP_PARAM_PLACEHOLDER,
EXTCAP_PARAM_NAME,
EXTCAP_PARAM_ENABLED,
EXTCAP_PARAM_FILE_MUSTEXIST,
@@ -108,6 +109,7 @@ typedef struct _extcap_arg {
gchar *call;
gchar *display;
gchar *tooltip;
+ gchar *placeholder;
gchar * fileextension;
gboolean fileexists;
diff --git a/ui/qt/extcap_argument.cpp b/ui/qt/extcap_argument.cpp
index 746797b920..7514459dba 100644
--- a/ui/qt/extcap_argument.cpp
+++ b/ui/qt/extcap_argument.cpp
@@ -380,6 +380,9 @@ QWidget * ExtArgText::createEditor(QWidget * parent)
if ( _argument->tooltip != NULL )
textBox->setToolTip(QString().fromUtf8(_argument->tooltip));
+ if ( _argument->placeholder != NULL )
+ textBox->setPlaceholderText(QString().fromUtf8(_argument->placeholder));
+
if (_argument->arg_type == EXTCAP_ARG_PASSWORD)
textBox->setEchoMode(QLineEdit::Password);