[vlc-devel] commit: Use var_ToggleBool when applicable. ( Rémi Duraffort )
git version control
git at videolan.org
Mon Jul 27 13:50:47 CEST 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Jul 27 12:18:34 2009 +0200| [ad80d3c3ca68fcdb998db1cb3f8a3a0242007379] | committer: Rémi Duraffort
Use var_ToggleBool when applicable.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ad80d3c3ca68fcdb998db1cb3f8a3a0242007379
---
modules/control/hotkeys.c | 9 +++------
modules/control/http/macro.c | 2 +-
modules/gui/macosx/controls.m | 4 +---
modules/gui/ncurses.c | 20 +++++---------------
modules/gui/qt4/actions_manager.cpp | 5 ++---
modules/gui/skins2/commands/cmd_fullscreen.cpp | 2 +-
6 files changed, 13 insertions(+), 29 deletions(-)
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 8d98461..aa4c59c 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -231,8 +231,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
{
vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout)
: VLC_OBJECT(p_playlist);
- bool b = var_GetBool( obj, "fullscreen" );
- var_SetBool( obj, "fullscreen", !b );
+ var_ToggleBool( obj, "fullscreen" );
break;
}
@@ -265,8 +264,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
{ /* FIXME: this is invalid if not using DirectX output!!! */
vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout)
: VLC_OBJECT(p_playlist);
- bool b = var_GetBool( obj, "directx-wallpaper" );
- var_SetBool( obj, "directx-wallpaper", !b );
+ var_ToggleBool( obj, "directx-wallpaper" );
}
#endif
@@ -287,8 +285,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
case ACTIONID_RANDOM:
{
- bool b = var_GetBool( p_playlist, "random" );
- var_SetBool( p_playlist, "random", !b );
+ var_ToggleBool( p_playlist, "random" );
}
case ACTIONID_PLAY_PAUSE:
diff --git a/modules/control/http/macro.c b/modules/control/http/macro.c
index 457f808..aa1644c 100644
--- a/modules/control/http/macro.c
+++ b/modules/control/http/macro.c
@@ -235,7 +235,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
p_vout = input_GetVout( p_sys->p_input );
if( p_vout )
{
- var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
+ var_ToggleBool( p_vout, "fullscreen" );
vlc_object_release( p_vout );
msg_Dbg( p_intf, "requested fullscreen toggle" );
}
diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
index d07ea81..f517c12 100644
--- a/modules/gui/macosx/controls.m
+++ b/modules/gui/macosx/controls.m
@@ -506,9 +506,7 @@
if( [o_title isEqualToString: _NS("Fullscreen")] ||
[sender isKindOfClass:[NSButton class]] )
{
- vlc_value_t val;
- var_Get( p_playlist, "fullscreen", &val );
- var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
+ var_ToggleBool( p_playlist, "fullscreen" );
}
pl_Release( VLCIntf );
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 137a461..ace16b6 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -563,19 +563,13 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
vlc_value_t val;
/* Playlist Settings */
case 'r':
- var_Get( p_playlist, "random", &val );
- val.b_bool = !val.b_bool;
- var_Set( p_playlist, "random", val );
+ var_ToggleBool( p_playlist, "random" );
goto end;
case 'l':
- var_Get( p_playlist, "loop", &val );
- val.b_bool = !val.b_bool;
- var_Set( p_playlist, "loop", val );
+ var_ToggleBool( p_playlist, "loop" );
goto end;
case 'R':
- var_Get( p_playlist, "repeat", &val );
- val.b_bool = !val.b_bool;
- var_Set( p_playlist, "repeat", val );
+ var_ToggleBool( p_playlist, "repeat" );
goto end;
/* Playlist sort */
@@ -1137,16 +1131,12 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{
- var_Get( p_vout, "fullscreen", &val );
- val.b_bool = !val.b_bool;
- var_Set( p_vout, "fullscreen", val );
+ var_ToggleBool( p_vout, "fullscreen" );
vlc_object_release( p_vout );
}
else
{
- var_Get( p_playlist, "fullscreen", &val );
- val.b_bool = !val.b_bool;
- var_Set( p_playlist, "fullscreen", val );
+ var_ToggleBool( p_playlist, "fullscreen" );
}
}
i_ret = 0;
diff --git a/modules/gui/qt4/actions_manager.cpp b/modules/gui/qt4/actions_manager.cpp
index 2dc3209..b07e390 100644
--- a/modules/gui/qt4/actions_manager.cpp
+++ b/modules/gui/qt4/actions_manager.cpp
@@ -117,7 +117,7 @@ void ActionsManager::fullscreen()
vout_thread_t *p_vout = THEMIM->getVout();
if( p_vout)
{
- var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
+ var_ToggleBool( p_vout, "fullscreen" );
vlc_object_release( p_vout );
}
}
@@ -143,8 +143,7 @@ void ActionsManager::record()
if( p_input )
{
/* This method won't work fine if the stream can't be cut anywhere */
- const bool b_recording = var_GetBool( p_input, "record" );
- var_SetBool( p_input, "record", !b_recording );
+ var_ToggleBool( p_input, "record" );
#if 0
else
{
diff --git a/modules/gui/skins2/commands/cmd_fullscreen.cpp b/modules/gui/skins2/commands/cmd_fullscreen.cpp
index b3bae4f..09177ea 100644
--- a/modules/gui/skins2/commands/cmd_fullscreen.cpp
+++ b/modules/gui/skins2/commands/cmd_fullscreen.cpp
@@ -37,7 +37,7 @@ void CmdFullscreen::execute()
if( pVout )
{
// Switch to fullscreen
- var_SetBool( pVout, "fullscreen", !var_GetBool( pVout, "fullscreen" ) );
+ var_ToggleBool( pVout, "fullscreen" );
vlc_object_release( pVout );
}
}
More information about the vlc-devel
mailing list