Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
d40dc861
Commit
d40dc861
authored
Sep 30, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dialog: support format strings in dialog_Question()
parent
c6acfbb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
include/vlc_dialog.h
include/vlc_dialog.h
+5
-3
src/interface/dialog.c
src/interface/dialog.c
+16
-6
No files found.
include/vlc_dialog.h
View file @
d40dc861
...
@@ -91,9 +91,11 @@ typedef struct dialog_question_t
...
@@ -91,9 +91,11 @@ typedef struct dialog_question_t
int
answer
;
int
answer
;
}
dialog_question_t
;
}
dialog_question_t
;
VLC_API
int
dialog_Question
(
vlc_object_t
*
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
);
VLC_API
int
dialog_Question
(
vlc_object_t
*
,
const
char
*
,
const
char
*
,
#define dialog_Question(o, t, m, y, n, c) \
const
char
*
,
const
char
*
,
const
char
*
,
...)
dialog_Question(VLC_OBJECT(o), t, m, y, n, c)
VLC_FORMAT
(
3
,
7
);
#define dialog_Question(o, t, m, y, n, ...) \
dialog_Question(VLC_OBJECT(o), t, m, y, n, __VA_ARGS__)
typedef
struct
dialog_progress_bar_t
typedef
struct
dialog_progress_bar_t
{
/* Request-time parameters */
{
/* Request-time parameters */
...
...
src/interface/dialog.c
View file @
d40dc861
...
@@ -174,15 +174,15 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
...
@@ -174,15 +174,15 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
* Asks a total (Yes/No/Cancel) question through the user interface.
* Asks a total (Yes/No/Cancel) question through the user interface.
* @param obj VLC object emitting the question
* @param obj VLC object emitting the question
* @param title dialog box title
* @param title dialog box title
* @param
text
dialog box text
* @param
fmt format string for the
dialog box text
* @param yes first choice/button text
* @param yes first choice/button text
* @param no second choice/button text
* @param no second choice/button text
* @param cancel third answer/button text, or NULL if no third option
* @param cancel third answer/button text, or NULL if no third option
* @return 0 if the user could not answer the question (e.g. there is no UI),
* @return 0 if the user could not answer the question (e.g. there is no UI),
* 1, 2 resp. 3 if the user pressed the first, second resp. third button.
* 1, 2 resp. 3 if the user pressed the first, second resp. third button.
*/
*/
int
dialog_Question
(
vlc_object_t
*
obj
,
const
char
*
title
,
const
char
*
tex
t
,
int
dialog_Question
(
vlc_object_t
*
obj
,
const
char
*
title
,
const
char
*
fm
t
,
const
char
*
yes
,
const
char
*
no
,
const
char
*
cancel
)
const
char
*
yes
,
const
char
*
no
,
const
char
*
cancel
,
...
)
{
{
if
(
obj
->
i_flags
&
OBJECT_FLAGS_NOINTERACT
)
if
(
obj
->
i_flags
&
OBJECT_FLAGS_NOINTERACT
)
return
0
;
return
0
;
...
@@ -191,10 +191,20 @@ int dialog_Question (vlc_object_t *obj, const char *title, const char *text,
...
@@ -191,10 +191,20 @@ int dialog_Question (vlc_object_t *obj, const char *title, const char *text,
if
(
provider
==
NULL
)
if
(
provider
==
NULL
)
return
0
;
return
0
;
dialog_question_t
dialog
=
{
title
,
text
,
yes
,
no
,
cancel
,
0
,
};
char
*
text
;
var_SetAddress
(
provider
,
"dialog-question"
,
&
dialog
);
va_list
ap
;
int
answer
=
0
;
va_start
(
ap
,
cancel
);
if
(
vasprintf
(
&
text
,
fmt
,
ap
)
!=
-
1
)
{
dialog_question_t
dialog
=
{
title
,
text
,
yes
,
no
,
cancel
,
0
,
};
var_SetAddress
(
provider
,
"dialog-question"
,
&
dialog
);
answer
=
dialog
.
answer
;
}
va_end
(
ap
);
vlc_object_release
(
provider
);
vlc_object_release
(
provider
);
return
dialog
.
answer
;
return
answer
;
}
}
#undef dialog_ProgressCreate
#undef dialog_ProgressCreate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment