Commit b9bfa887 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: menus, minor code reorg.

parent 5987ab5a
...@@ -110,6 +110,26 @@ void addDPStaticEntry( QMenu *menu, ...@@ -110,6 +110,26 @@ void addDPStaticEntry( QMenu *menu,
action->setData( true ); action->setData( true );
} }
/***
* Same for MIM
***/
void addMIMStaticEntry( intf_thread_t *p_intf,
QMenu *menu,
const QString text,
const char *icon,
const char *member )
{
if( strlen( icon ) > 0 )
{
QAction *action = menu->addAction( text, THEMIM, member );
action->setIcon( QIcon( icon ) );
}
else
{
menu->addAction( text, THEMIM, member );
}
}
/** /**
* @brief Enable all static entries, disable the others * @brief Enable all static entries, disable the others
* @param enable if false, disable all entries * @param enable if false, disable all entries
...@@ -144,24 +164,18 @@ int DeleteNonStaticEntries( QMenu *menu ) ...@@ -144,24 +164,18 @@ int DeleteNonStaticEntries( QMenu *menu )
return i_ret; return i_ret;
} }
/*** /**
* Same for MIM * \return QAction associated to psz_var variable
***/ **/
void addMIMStaticEntry( intf_thread_t *p_intf, static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
QMenu *menu,
const QString text,
const char *icon,
const char *member )
{ {
if( strlen( icon ) > 0 ) QList< QAction* > actions = menu->actions();
{ for( int i = 0; i < actions.size(); ++i )
QAction *action = menu->addAction( text, THEMIM, member );
action->setIcon( QIcon( icon ) );
}
else
{ {
menu->addAction( text, THEMIM, member ); if( actions[i]->data().toString() == psz_var )
return actions[i];
} }
return NULL;
} }
/***************************************************************************** /*****************************************************************************
...@@ -225,17 +239,6 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object, ...@@ -225,17 +239,6 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
{
QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.size(); ++i )
{
if( actions[i]->data().toString() == psz_var )
return actions[i];
}
return NULL;
}
/***************************************************************************** /*****************************************************************************
* All normal menus * All normal menus
* Simple Code * Simple Code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment