Commit 82153a98 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: Cleanup of main_interface.

No functionnal change
parent 1c795114
...@@ -118,6 +118,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -118,6 +118,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Are we in the enhanced always-video mode or not ? */ /* Are we in the enhanced always-video mode or not ? */
i_visualmode = config_GetInt( p_intf, "qt-display-mode" ); i_visualmode = config_GetInt( p_intf, "qt-display-mode" );
/* Do we want anoying popups or not */
notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" );
/* Set the other interface settings */ /* Set the other interface settings */
settings = getSettings(); settings = getSettings();
settings->beginGroup( "MainWindow" ); settings->beginGroup( "MainWindow" );
...@@ -131,9 +134,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -131,9 +134,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize(); mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize();
mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize(); mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize();
/* Do we want anoying popups or not */
notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" );
/************** /**************
* Status Bar * * Status Bar *
**************/ **************/
...@@ -164,40 +164,37 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -164,40 +164,37 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
dockPL->hide(); dockPL->hide();
#endif #endif
/********************
* Input Manager *
********************/
MainInputManager::getInstance( p_intf );
/********************************* /*********************************
* Create the Systray Management * * Create the Systray Management *
*********************************/ *********************************/
initSystray(); initSystray();
/************************** /********************
* Various CONNECTs on IM * * Input Manager *
**************************/ ********************/
/* Connect the input manager to the GUI elements it manages */ MainInputManager::getInstance( p_intf );
/************************************************************
* Connect the input manager to the GUI elements it manages *
************************************************************/
/** /**
* Connects on nameChanged() * Connects on nameChanged()
* Those connects are not merged because different options can trigger * Those connects are different because options can impeach them to trigger.
* them down. **/
*/ /* Main Interface statusbar */
/* Naming in the controller statusbar */
CONNECT( THEMIM->getIM(), nameChanged( const QString& ), CONNECT( THEMIM->getIM(), nameChanged( const QString& ),
this, setName( const QString& ) ); this, setName( const QString& ) );
/* and in the systray */ /* and systray */
if( sysTray ) if( sysTray )
{ {
CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, CONNECT( THEMIM->getIM(), nameChanged( const QString& ),
updateSystrayTooltipName( const QString& ) ); this, updateSystrayTooltipName( const QString& ) );
} }
/* and in the title of the controller */ /* and title of the Main Interface*/
if( config_GetInt( p_intf, "qt-name-in-title" ) ) if( config_GetInt( p_intf, "qt-name-in-title" ) )
{ {
CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, CONNECT( THEMIM->getIM(), nameChanged( const QString& ),
setVLCWindowsTitle( const QString& ) ); this, setVLCWindowsTitle( const QString& ) );
} }
/** /**
...@@ -210,7 +207,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -210,7 +207,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
this, updateSystrayTooltipStatus( int ) ); this, updateSystrayTooltipStatus( int ) );
} }
/* END CONNECTS ON IM */ /* END CONNECTS ON IM */
/************ /************
...@@ -261,11 +257,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -261,11 +257,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
} }
} }
bool b_visible = settings->value( "playlist-visible", 0 ).toInt(); bool b_pl_visible = settings->value( "playlist-visible", 0 ).toInt();
settings->endGroup(); settings->endGroup();
/* Playlist */ /* Playlist */
if( b_visible ) togglePlaylist(); if( b_pl_visible ) togglePlaylist();
/* Enable the popup menu in the MI */ /* Enable the popup menu in the MI */
setContextMenuPolicy( Qt::CustomContextMenu ); setContextMenuPolicy( Qt::CustomContextMenu );
...@@ -283,7 +279,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -283,7 +279,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
toggleMinimalView( true ); toggleMinimalView( true );
/* Update the geometry : It is useful if you switch between /* Update the geometry : It is useful if you switch between
qt-display-modes ?*/ qt-display-modes */
updateGeometry(); updateGeometry();
resize( sizeHint() ); resize( sizeHint() );
...@@ -1238,30 +1234,27 @@ void MainInterface::dropEvent(QDropEvent *event) ...@@ -1238,30 +1234,27 @@ void MainInterface::dropEvent(QDropEvent *event)
void MainInterface::dropEventPlay( QDropEvent *event, bool b_play ) void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
{ {
event->setDropAction( Qt::CopyAction ); event->setDropAction( Qt::CopyAction );
if( !event->possibleActions() & Qt::CopyAction ) if( !event->possibleActions() & Qt::CopyAction )
return; return;
const QMimeData *mimeData = event->mimeData(); const QMimeData *mimeData = event->mimeData();
/* D&D of a subtitles file, add it on the fly */ /* D&D of a subtitles file, add it on the fly */
if( mimeData->urls().size() == 1 ) if( mimeData->urls().size() == 1 && THEMIM->getIM()->hasInput() )
{ {
if( THEMIM->getIM()->hasInput() ) if( !input_AddSubtitle( THEMIM->getInput(),
qtu( toNativeSeparators( mimeData->urls()[0].toLocalFile() ) ),
true ) )
{ {
if( !input_AddSubtitle( THEMIM->getInput(), event->accept();
qtu( toNativeSeparators( return;
mimeData->urls()[0].toLocalFile() ) ),
true ) )
{
event->accept();
return;
}
} }
} }
bool first = b_play;
foreach( const QUrl &url, mimeData->urls() ) bool first = b_play;
{ foreach( const QUrl &url, mimeData->urls() )
{
QString s = toNativeSeparators( url.toLocalFile() ); QString s = toNativeSeparators( url.toLocalFile() );
if( s.length() > 0 ) { if( s.length() > 0 ) {
...@@ -1273,8 +1266,8 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play ) ...@@ -1273,8 +1266,8 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
first = false; first = false;
RecentsMRL::getInstance( p_intf )->addRecent( s ); RecentsMRL::getInstance( p_intf )->addRecent( s );
} }
} }
event->accept(); event->accept();
} }
void MainInterface::dragEnterEvent(QDragEnterEvent *event) void MainInterface::dragEnterEvent(QDragEnterEvent *event)
{ {
......
...@@ -54,8 +54,8 @@ class QMenu; ...@@ -54,8 +54,8 @@ class QMenu;
class QSize; class QSize;
enum { enum {
CONTROLS_VISIBLE = 0x1, CONTROLS_VISIBLE = 0x1,
CONTROLS_HIDDEN = 0x2, CONTROLS_HIDDEN = 0x2,
CONTROLS_ADVANCED = 0x4, CONTROLS_ADVANCED = 0x4,
}; };
...@@ -83,8 +83,8 @@ public: ...@@ -83,8 +83,8 @@ public:
int controlVideo( int i_query, va_list args ); int controlVideo( int i_query, va_list args );
/* Getters */ /* Getters */
QSystemTrayIcon *getSysTray() { return sysTray; }; QSystemTrayIcon *getSysTray() { return sysTray; }
QMenu *getSysTrayMenu() { return systrayMenu; }; QMenu *getSysTrayMenu() { return systrayMenu; }
int getControlsVisibilityStatus(); int getControlsVisibilityStatus();
/* Sizehint() */ /* Sizehint() */
......
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