setWindowRole( "vlc-main" );
setWindowIcon( QApplication::windowIcon() );
setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
+#ifdef Q_WS_MAC
+ setAttribute( Qt::WA_MacBrushedMetal );
+#endif
/* Is video in embedded in the UI or not */
b_videoEmbedded = var_InheritBool( p_intf, "embedded-video" );
CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
+ CONNECT( this, askToQuit(), THEDP, quit() );
+
/** END of CONNECTS**/
/* Final sizing and showing */
setVisible( !b_hideAfterCreation );
- setMinimumWidth( __MAX( controls->sizeHint().width(),
- menuBar()->sizeHint().width() ) + 30 );
+ computeMinimumSize();
/* Switch to minimal view if needed, must be called after the show() */
if( b_minimalView )
if( stackCentralOldWidget == videoWidget )
showTab( bgWidget );
+ if( videoWidget )
+ releaseVideoSlot();
+
#ifdef WIN32
if( himl )
ImageList_Destroy( himl );
settings->setValue( "pl-dock-status", b_plDocked );
/* Save playlist state */
if( playlistWidget )
- {
- settings->setValue( "playlist-visible",
- isPlDocked() ?
- playlistVisible :
- playlistWidget->isVisible() /* FIXME */ );
- }
+ settings->setValue( "playlist-visible", playlistVisible );
settings->setValue( "adv-controls",
getControlsVisibilityStatus() & CONTROLS_ADVANCED );
p_intf->p_sys->p_mi = NULL;
}
+void MainInterface::computeMinimumSize()
+{
+ int minWidth = 30;
+ if( menuBar()->isVisible() )
+ minWidth += __MAX( controls->sizeHint().width(), menuBar()->sizeHint().width() );
+
+ setMinimumWidth( minWidth );
+}
+
/*****************************
* Main UI handling *
*****************************/
/* Bg Cone */
bgWidget = new BackgroundWidget( p_intf );
stackCentralW->addWidget( bgWidget );
+ if ( !var_InheritBool( p_intf, "qt-bgcone" ) )
+ bgWidget->setWithArt( false );
+ else
+ if ( var_InheritBool( p_intf, "qt-bgcone-expands" ) )
+ bgWidget->setExpandstoHeight( true );
/* And video Outputs */
if( b_videoEmbedded )
"QLabel:hover { background-color: rgba(255, 255, 255, 50%) }" );
speedLabel->setStyleSheet(
"QLabel:hover { background-color: rgba(255, 255, 255, 50%) }" );
+ /* pad both label and its tooltip */
+ nameLabel->setStyleSheet( "padding-left: 5px; padding-right: 5px;" );
/* and adding those */
statusBarr->addWidget( nameLabel, 8 );
CONNECT( THEMIM->getIM(), seekRequested( float ),
timeLabel, setDisplayPosition( float ) );
+
+ /* This shouldn't be necessary, but for somehow reason, the statusBarr
+ starts at height of 20px and when a text is shown it needs more space.
+ But, as the QMainWindow policy doesn't allow statusBar to change QMW's
+ geometry, we need to force a height. If you have a better idea, please
+ tell me -- jb
+ */
+ statusBarr->setFixedHeight( statusBarr->sizeHint().height() + 2 );
}
/**********************************************************************
/* Function that is CONNECTED to the previous emit */
void MainInterface::releaseVideoSlot( void )
{
+ /* This function is called when the embedded video window is destroyed,
+ * or in the rare case that the embedded window is still here but the
+ * Qt4 interface exits. */
+ assert( videoWidget );
videoWidget->release();
setVideoOnTop( false );
setVideoFullScreen( false );
playlistVisible = true;
}
+/*
+ * setMinimalView is the private function used by
+ * the SLOT toggleMinimalView and setVideoFullScreen
+ */
void MainInterface::setMinimalView( bool b_minimal )
{
menuBar()->setVisible( !b_minimal );
}
/*
- If b_minimal is false, then we are normalView
+ * This public SLOT is used for moving to minimal View Mode
+ *
+ * If b_minimal is false, then we are normalView
*/
void MainInterface::toggleMinimalView( bool b_minimal )
{
}
b_minimalView = b_minimal;
if( !b_videoFullScreen )
+ {
setMinimalView( b_minimalView );
+ computeMinimumSize();
+ }
emit minimalViewToggled( b_minimalView );
}
input_name = name; /* store it for the QSystray use */
/* Display it in the status bar, but also as a Tooltip in case it doesn't
fit in the label */
- nameLabel->setText( " " + name + " " );
- nameLabel->setToolTip( " " + name +" " );
+ nameLabel->setText( name );
+ nameLabel->setToolTip( name );
}
/**
void MainInterface::createSystray()
{
QIcon iconVLC;
- if( QDate::currentDate().dayOfYear() >= 354 )
+ if( QDate::currentDate().dayOfYear() >= QT_CHRISTMAS_TROLL_DAY )
iconVLC = QIcon( ":/logo/vlc128-christmas.png" );
else
iconVLC = QIcon( ":/logo/vlc128.png" );
QVLCMenu::updateSystrayMenu( this, p_intf );
}
+void MainInterface::showUpdateSystrayMenu()
+{
+ if( isHidden() )
+ show();
+ if( isMinimized() )
+ showNormal();
+ activateWindow();
+
+ QVLCMenu::updateSystrayMenu( this, p_intf );
+}
+
+void MainInterface::hideUpdateSystrayMenu()
+{
+ hide();
+ QVLCMenu::updateSystrayMenu( this, p_intf );
+}
+
void MainInterface::handleSystrayClick(
QSystemTrayIcon::ActivationReason reason )
{
{
case QSystemTrayIcon::Trigger:
case QSystemTrayIcon::DoubleClick:
+#ifdef Q_WS_MAC
+ QVLCMenu::updateSystrayMenu( this, p_intf );
+#else
toggleUpdateSystrayMenu();
+#endif
break;
case QSystemTrayIcon::MiddleClick:
sysTray->showMessage( qtr( "VLC media player" ),
{
if( url.isValid() )
{
- char* psz_uri = make_URI( qtu( url.toString() ) );
- playlist_Add( THEPL, psz_uri, NULL,
+ QString mrl = toURI( url.toEncoded().constData() );
+ playlist_Add( THEPL, qtu(mrl), NULL,
PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
PLAYLIST_END, true, pl_Unlocked );
- free( psz_uri );
first = false;
RecentsMRL::getInstance( p_intf )->addRecent( url.toString() );
}
if( !mimeData->hasUrls() && mimeData->hasText() &&
QUrl(mimeData->text()).isValid() )
{
- char *psz_uri = make_URI( qtu( mimeData->text() ) );
- playlist_Add( THEPL, psz_uri, NULL,
+ QString mrl = toURI( mimeData->text() );
+ playlist_Add( THEPL, qtu(mrl), NULL,
PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
PLAYLIST_END, true, pl_Unlocked );
- free( psz_uri );
}
event->accept();
}
void MainInterface::closeEvent( QCloseEvent *e )
{
- e->accept();
- hide();
- THEDP->quit();
+ e->ignore(); /* Do not quit */
+// hide();
+ emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
}
void MainInterface::setInterfaceFullScreen( bool fs )
{
if( fs )
- showFullScreen();
+ setWindowState( windowState() | Qt::WindowFullScreen );
else
- showNormal();
+ setWindowState( windowState() & ~Qt::WindowFullScreen );
}
void MainInterface::toggleInterfaceFullScreen()
{