Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
880de496
Commit
880de496
authored
Mar 11, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt, menus: code simplification
No functionnal change
parent
33ead5bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
21 deletions
+12
-21
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+12
-20
modules/gui/qt4/menus.hpp
modules/gui/qt4/menus.hpp
+0
-1
No files found.
modules/gui/qt4/menus.cpp
View file @
880de496
...
...
@@ -263,23 +263,28 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object,
* Simple Code
*****************************************************************************/
// Static menu
#define BAR_ADD( func, title ) { \
QMenu *_menu = func; _menu->setTitle( title ); bar->addMenu( _menu ); }
// Dynamic menu
#define BAR_DADD( func, title, id ) { \
QMenu *_menu = func; _menu->setTitle( title ); bar->addMenu( _menu ); \
MenuFunc *f = new MenuFunc( _menu, id ); \
CONNECT( _menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
THEDP->menusUpdateMapper->setMapping( _menu, f ); }
// Add a simple action
#define ACT_ADD( _menu, val, title ) { \
QAction *_action = new QAction( title, _menu ); _action->setData( val ); \
_menu->addAction( _action ); }
// Add an action with a submenu
#define ACT_ADDMENU( _menu, val, title ) { \
QAction *_action = new QAction( title, _menu ); _action->setData( val ); \
_action->setMenu( new QMenu( _menu ) ); _menu->addAction( _action ); }
// Add an action that is a checkbox
#define ACT_ADDCHECK( _menu, val, title ) { \
QAction *_action = new QAction( title, _menu ); _action->setData( val ); \
_action->setCheckable( true ); _menu->addAction( _action ); }
...
...
@@ -303,15 +308,15 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
BAR_DADD
(
VideoMenu
(
p_intf
,
bar
),
qtr
(
"&Video"
),
2
);
BAR_ADD
(
ToolsMenu
(
bar
),
qtr
(
"&Tools"
)
);
QMenu
*
_menu
=
ViewMenu
(
p_intf
,
bar
);
_menu
->
setTitle
(
qtr
(
"V&iew"
)
);
bar
->
addMenu
(
_menu
);
ViewMenu
(
p_intf
,
_menu
,
mi
);
/* View menu, a bit different */
BAR_DADD
(
ViewMenu
(
p_intf
,
_menu
,
mi
),
qtr
(
"V&iew"
),
4
);
BAR_ADD
(
HelpMenu
(
bar
),
qtr
(
"&Help"
)
);
}
#undef BAR_ADD
#undef BAR_DADD
//
#undef BAR_DADD
/**
* Media ( File ) Menu
...
...
@@ -411,19 +416,6 @@ QMenu *QVLCMenu::ToolsMenu( QWidget *parent )
return
ToolsMenu
(
new
QMenu
(
parent
)
);
}
/**
* Dynamic View Menu
* Connect signal "aboutToShow" to the creation of the View Menu
**/
QMenu
*
QVLCMenu
::
ViewMenu
(
intf_thread_t
*
p_intf
,
QWidget
*
parent
)
{
QMenu
*
viewMenu
=
new
QMenu
(
parent
);
MenuFunc
*
f
=
new
MenuFunc
(
viewMenu
,
4
);
CONNECT
(
viewMenu
,
aboutToShow
(),
THEDP
->
menusUpdateMapper
,
map
()
);
THEDP
->
menusUpdateMapper
->
setMapping
(
viewMenu
,
f
);
return
viewMenu
;
}
/**
* View Menu
* Interface modification, load other interfaces, activate Extensions
...
...
@@ -1058,8 +1050,8 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
}
else
{
QMenu
*
viewmenu
=
menu
->
addMenu
(
qtr
(
"V&iew"
)
)
;
ViewMenu
(
p_intf
,
viewmenu
);
QMenu
*
bar
=
menu
;
BAR_DADD
(
ViewMenu
(
p_intf
,
_menu
,
mi
),
qtr
(
"V&iew"
),
4
);
}
menu
->
addMenu
(
submenu
);
...
...
modules/gui/qt4/menus.hpp
View file @
880de496
...
...
@@ -99,7 +99,6 @@ private:
static
QMenu
*
ToolsMenu
(
QMenu
*
);
static
QMenu
*
ToolsMenu
(
QWidget
*
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
QMenu
*
,
MainInterface
*
mi
=
NULL
);
static
QMenu
*
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
...
...
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