Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
fada667b
Commit
fada667b
authored
Jul 17, 2007
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: Systray Menu segfaults. Don't register the connects if you don't have a systray.
parent
8820f0c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
42 deletions
+67
-42
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+61
-38
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+6
-4
No files found.
modules/gui/qt4/main_interface.cpp
View file @
fada667b
...
...
@@ -95,7 +95,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
need_components_update
=
false
;
bgWidget
=
NULL
;
videoWidget
=
NULL
;
playlistWidget
=
NULL
;
embeddedPlaylistWasActive
=
videoIsActive
=
false
;
input_name
=
""
;
videoEmbeddedFlag
=
false
;
...
...
@@ -122,6 +122,18 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setFocusPolicy
(
Qt
::
StrongFocus
);
setAcceptDrops
(
true
);
/* Systray */
systray
=
NULL
;
if
(
QSystemTrayIcon
::
isSystemTrayAvailable
()
&&
(
config_GetInt
(
p_intf
,
"qt-start-mininimized"
)
==
1
)
)
{
hide
();
createSystrayMenu
();
}
if
(
QSystemTrayIcon
::
isSystemTrayAvailable
()
&&
(
config_GetInt
(
p_intf
,
"qt-system-tray"
)
==
1
)
)
createSystrayMenu
();
/* Init input manager */
MainInputManager
::
getInstance
(
p_intf
);
ON_TIMEOUT
(
updateOnTimer
()
);
...
...
@@ -138,10 +150,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Naming in the controller */
CONNECT
(
THEMIM
->
getIM
(),
nameChanged
(
QString
),
this
,
setName
(
QString
)
);
if
(
config_GetInt
(
p_intf
,
"qt-system-tray"
)
)
if
(
config_GetInt
(
p_intf
,
"qt-system-tray"
)
&&
systray
)
{
CONNECT
(
THEMIM
->
getIM
(),
nameChanged
(
QString
),
this
,
updateSystrayTooltipName
(
QString
)
);
updateSystrayTooltipName
(
QString
)
);
}
if
(
config_GetInt
(
p_intf
,
"qt-name-in-title"
)
)
{
...
...
@@ -153,10 +165,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT
(
THEMIM
->
getIM
(),
statusChanged
(
int
),
this
,
setStatus
(
int
)
);
CONNECT
(
THEMIM
->
getIM
(),
navigationChanged
(
int
),
this
,
setNavigation
(
int
)
);
if
(
config_GetInt
(
p_intf
,
"qt-system-tray"
)
)
if
(
config_GetInt
(
p_intf
,
"qt-system-tray"
)
&&
systray
)
{
CONNECT
(
THEMIM
->
getIM
(),
statusChanged
(
int
),
this
,
updateSystrayTooltipStatus
(
int
)
);
updateSystrayTooltipStatus
(
int
)
);
}
CONNECT
(
slider
,
sliderDragged
(
float
),
THEMIM
->
getIM
(),
sliderUpdate
(
float
)
);
...
...
@@ -182,15 +194,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
var_AddCallback
(
p_playlist
,
"intf-show"
,
IntfShowCB
,
p_intf
);
vlc_object_release
(
p_playlist
);
}
if
(
QSystemTrayIcon
::
isSystemTrayAvailable
()
&&
(
config_GetInt
(
p_intf
,
"qt-start-mininimized"
)
==
1
))
{
hide
();
createSystrayMenu
();
}
if
(
QSystemTrayIcon
::
isSystemTrayAvailable
()
&&
(
config_GetInt
(
p_intf
,
"qt-system-tray"
)
==
1
))
createSystrayMenu
();
}
...
...
@@ -292,7 +295,7 @@ void MainInterface::handleMainUi( QSettings *settings )
{
videoWidget
=
new
VideoWidget
(
p_intf
);
videoWidget
->
widgetSize
=
QSize
(
1
,
1
);
videoWidget
->
resize
(
videoWidget
->
widgetSize
);
//
videoWidget->resize( videoWidget->widgetSize );
ui
.
vboxLayout
->
insertWidget
(
0
,
videoWidget
);
p_intf
->
pf_request_window
=
::
DoRequest
;
...
...
@@ -302,19 +305,30 @@ void MainInterface::handleMainUi( QSettings *settings )
setMinimumSize
(
PREF_W
,
addSize
.
height
()
);
}
void
MainInterface
::
createSystrayMenu
()
/**
* Create a SystemTray icon and a menu that would go with it.
* Connects to a click handler on the icon.
**/
void
MainInterface
::
createSystray
()
{
QIcon
iconVLC
=
QIcon
(
QPixmap
(
":/vlc128.png"
)
);
sysTray
=
new
QSystemTrayIcon
(
iconVLC
,
this
);
sysTray
->
setToolTip
(
qtr
(
"VLC media player"
));
systrayMenu
=
new
QMenu
(
qtr
(
"VLC media player"
),
this
);
systrayMenu
->
setIcon
(
iconVLC
);
sysTray
->
setToolTip
(
qtr
(
"VLC media player"
));
QVLCMenu
::
updateSystrayMenu
(
this
,
p_intf
,
true
);
sysTray
->
show
();
CONNECT
(
sysTray
,
activated
(
QSystemTrayIcon
::
ActivationReason
),
this
,
handleSystrayClick
(
QSystemTrayIcon
::
ActivationReason
)
);
}
/**
* Update the menu of the Systray Icon.
* May be unneedded, since it just calls QVLCMenu::update
**/
void
MainInterface
::
updateSystrayMenu
(
int
status
)
{
QVLCMenu
::
updateSystrayMenu
(
this
,
p_intf
)
;
...
...
@@ -341,7 +355,10 @@ void MainInterface::handleSystrayClick( QSystemTrayIcon::ActivationReason reason
}
}
/**
* Updates the name of the systray Icon tooltip.
* Doesn't check if the systray exists, check before you call it.
**/
void
MainInterface
::
updateSystrayTooltipName
(
QString
name
)
{
if
(
name
.
isEmpty
()
)
...
...
@@ -354,29 +371,34 @@ void MainInterface::updateSystrayTooltipName( QString name )
}
}
/**
* Updates the status of the systray Icon tooltip.
* Doesn't check if the systray exists, check before you call it.
**/
void
MainInterface
::
updateSystrayTooltipStatus
(
int
i_status
)
{
switch
(
i_status
)
{
case
0
:
{
sysTray
->
setToolTip
(
qtr
(
"VLC media player"
)
);
break
;
}
case
PLAYING_S
:
{
sysTray
->
setToolTip
(
input_name
);
//+ " - " + qtr( "Playing" ) );
break
;
}
case
PAUSE_S
:
{
sysTray
->
setToolTip
(
input_name
+
" - "
+
qtr
(
"Paused"
)
);
break
;
}
}
{
case
0
:
{
sysTray
->
setToolTip
(
qtr
(
"VLC media player"
)
);
break
;
}
case
PLAYING_S
:
{
sysTray
->
setToolTip
(
input_name
);
//+ " - " + qtr( "Playing" ) );
break
;
}
case
PAUSE_S
:
{
sysTray
->
setToolTip
(
input_name
+
" - "
+
qtr
(
"Paused"
)
);
break
;
}
}
}
/**********************************************************************
* Handling of the components
**********************************************************************/
...
...
@@ -793,7 +815,8 @@ void MainInterface::setStatus( int status )
ui
.
playButton
->
setIcon
(
QIcon
(
":/pixmaps/pause.png"
)
);
else
ui
.
playButton
->
setIcon
(
QIcon
(
":/pixmaps/play.png"
)
);
updateSystrayMenu
(
status
);
if
(
systrayMenu
)
updateSystrayMenu
(
status
);
}
#define HELP_MENU N_("Menu")
...
...
modules/gui/qt4/menus.cpp
View file @
fada667b
...
...
@@ -241,6 +241,8 @@ QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
{
QMenu
*
menu
=
new
QMenu
();
menu
->
addMenu
(
SDMenu
(
p_intf
)
);
menu
->
addAction
(
QIcon
(
":/pixmaps/vlc_playlist_16px.png"
),
qtr
(
"Playlist"
),
mi
,
SLOT
(
playlist
()
)
);
menu
->
addSeparator
();
DP_SADD
(
menu
,
qtr
(
I_PL_LOAD
),
""
,
""
,
openPlaylist
(),
"Ctrl+L"
);
...
...
@@ -287,8 +289,8 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
adv
->
setCheckable
(
true
);
if
(
adv_controls_enabled
)
adv
->
setChecked
(
true
);
DP_SADD
(
menu
,
qtr
(
"Hide Menus..."
),
""
,
""
,
hideMenus
(),
"Ctrl+H"
);
menu
->
addSeparator
();
DP_SADD
(
menu
,
qtr
(
"Hide Menus..."
),
""
,
""
,
hideMenus
(),
"Ctrl+H"
);
menu
->
addSeparator
();
#if 0 /* For Visualisations. Not yet working */
adv = menu->addAction( qtr("Visualizations selector" ),
...
...
@@ -296,8 +298,8 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
adv->setCheckable( true );
if( visual_selector_enabled ) adv->setChecked( true );
#endif
menu
->
addAction
(
QIcon
(
":/pixmaps/vlc_playlist_16px.png"
),
qtr
(
"Playlist"
),
mi
,
SLOT
(
playlist
()
)
);
menu
->
addAction
(
QIcon
(
":/pixmaps/vlc_playlist_16px.png"
),
qtr
(
"Playlist"
),
mi
,
SLOT
(
playlist
()
)
);
}
DP_SADD
(
menu
,
qtr
(
I_MENU_EXT
),
""
,
":/pixmaps/vlc_settings_16px.png"
,
extendedDialog
()
,
"Ctrl+E"
);
...
...
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