#include <assert.h>
#include <vlc_keys.h>
#include <vlc/vout.h>
+#include <aout_internal.h>
#ifdef WIN32
#define PREF_W 410
#define PREF_H 125
#endif
-#define BUTTON_SET( button, image, tooltip ) ui.button##Button->setText(""); \
- ui.button##Button->setIcon( QIcon( ":/pixmaps/"#image ) ); \
- ui.button##Button->setToolTip( tooltip );
-
#define VISIBLE(i) (i && i->isVisible())
#define SET_WIDTH(i,j) i->widgetSize.setWidth(j)
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
embeddedPlaylistWasActive = videoIsActive = false;
+ /* Fetch configuration from settings and vlc config */
+ videoEmbeddedFlag = false;
+ if( config_GetInt( p_intf, "embedded-video" ) )
+ videoEmbeddedFlag = true;
+
+ alwaysVideoFlag = false;
+ if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ))
+ alwaysVideoFlag = true;
+
+ playlistEmbeddedFlag = settings->value( "playlist-embedded", true ).
+ toBool();
+ advControlsEnabled= settings->value( "adv-controls", false ).toBool();
+
setWindowTitle( QString::fromUtf8( _("VLC media player") ) );
handleMainUi( settings );
- QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag );
+ QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag,
+ advControlsEnabled );
/* Status bar */
timeLabel = new QLabel( 0 );
MainInterface::~MainInterface()
{
- /// \todo Save everything
+ settings->setValue( "playlist-embedded", playlistEmbeddedFlag );
+ settings->setValue( "adv-controls", advControlsEnabled );
+ settings->setValue( "pos", pos() );
+ settings->endGroup();
+ delete settings;
p_intf->b_interaction = VLC_FALSE;
var_DelCallback( p_intf, "interaction", InteractCallback, this );
slider = new InputSlider( Qt::Horizontal, NULL );
ui.hboxLayout->insertWidget( 0, slider );
- BUTTON_SET( prev, previous.png, qtr( "Previous" ) );
- BUTTONACT( ui.prevButton, prev() );
- BUTTON_SET( next, next.png , qtr( "Next" ) );
- BUTTONACT( ui.nextButton, next() );
- BUTTON_SET( play, play.png , qtr( "Play" ) );
- BUTTONACT( ui.playButton, play() );
- BUTTON_SET( stop, stop.png , qtr( "Stop" ) );
- BUTTONACT( ui.stopButton, stop() );
-
- BUTTON_SET( visual, stop.png, qtr( "Audio visualizations" ) );
- BUTTONACT( ui.visualButton, visual() );
+ BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png,
+ qtr("Previous"), prev() );
+ BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() );
+ BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() );
+ BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() );
+ BUTTON_SET_ACT_I( ui.visualButton, "", stop.png,
+ qtr( "Audio visualizations" ), visual() );
/* Volume */
ui.volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
ui.volMuteLabel->installEventFilter(h);
ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
- /* Fetch configuration from settings and vlc config */
- videoEmbeddedFlag = false;
- if( config_GetInt( p_intf, "embedded-video" ) )
- videoEmbeddedFlag = true;
-
- alwaysVideoFlag = false;
- if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ))
- alwaysVideoFlag = true;
-
- playlistEmbeddedFlag = true;
- /// \todo fetch playlist settings
-
- BUTTON_SET( playlist, volume-low.png, playlistEmbeddedFlag ?
- qtr( "Show playlist" ) :
+ BUTTON_SET_IMG( ui.playlistButton, "" ,volume-low.png,
+ playlistEmbeddedFlag ? qtr( "Show playlist" ) :
qtr( "Open playlist" ) );
BUTTONACT( ui.playlistButton, playlist() );
addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
+ advControls = new ControlsWidget( p_intf );
+ ui.vboxLayout->insertWidget( 0, advControls );
+ advControls->updateGeometry();
+ if( !advControlsEnabled ) advControls->hide();
+ need_components_update = true;
+
visualSelector = new VisualSelector( p_intf );
ui.vboxLayout->insertWidget( 0, visualSelector );
visualSelector->hide();
p_intf->pf_release_window = ::DoRelease;
p_intf->pf_control_window = ::DoControl;
}
-
- calculateInterfaceSize();
- resize( mainSize );
-
setMinimumSize( PREF_W, addSize.height() );
}
}
if( VISIBLE( visualSelector ) )
height += visualSelector->height();
+ fprintf( stderr, "Adv %p - visible %i\n", advControls, advControls->isVisible() );
+ if( VISIBLE( advControls) )
+ {
+ fprintf( stderr, "visible\n" );
+ height += advControls->sizeHint().height();
+ }
+ fprintf( stderr, "Adv height %i\n", advControls->sizeHint().height() );
fprintf( stderr, "Setting to %ix%i\n",
width + addSize.width() , height + addSize.height() );
SET_WH( videoWidget, e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
videoWidget->updateGeometry();
- fprintf( stderr, "Video set to %ix%i\n", DS( videoWidget->widgetSize) );
}
if( VISIBLE( playlistWidget ) )
{
SET_WH( playlistWidget , e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
playlistWidget->updateGeometry();
- fprintf( stderr, "PL set to %ix%i\n",DS(playlistWidget->widgetSize ) );
}
}
return i_ret;
}
+void MainInterface::advanced()
+{
+ if( !VISIBLE( advControls ) )
+ {
+ advControls->show();
+ advControlsEnabled = true;
+ }
+ else
+ {
+ advControls->hide();
+ advControlsEnabled = false;
+ }
+ doComponentsUpdate();
+}
+
void MainInterface::visual()
{
if( !VISIBLE( visualSelector) )
/// Todo, reset its size ?
if( VISIBLE( playlistWidget) )
{
- fprintf( stderr, "hiding playlist\n" );
playlistWidget->hide();
if( videoIsActive )
{
}
else
{
- fprintf( stderr, "showing playlist\n" );
playlistWidget->show();
if( videoIsActive )
{
playlistEmbeddedFlag = false;
menuBar()->clear();
- QVLCMenu::createMenuBar( this, p_intf, false );
+ QVLCMenu::createMenuBar( this, p_intf, false, advControlsEnabled );
if( videoIsActive )
{
PlaylistDialog::killInstance();
playlistEmbeddedFlag = true;
menuBar()->clear();
- QVLCMenu::createMenuBar(this, p_intf, true );
+ QVLCMenu::createMenuBar(this, p_intf, true, advControlsEnabled );
playlist();
}
}
void MainInterface::updateOnTimer()
{
+ aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find( p_intf,
+ VLC_OBJECT_AOUT, FIND_ANYWHERE );
+ /* Todo: make this event-driven */
+ if( p_aout )
+ {
+ ui.visualButton->setEnabled( true );
+ vlc_object_release( p_aout );
+ }
+ else
+ ui.visualButton->setEnabled( false );
+
+ /* And this too */
+ advControls->enableInput( THEMIM->getIM()->hasInput() );
+ advControls->enableVideo( THEMIM->getIM()->hasVideo() );
+
if( p_intf->b_die )
{
QApplication::closeAllWindows();
{
intf_dialog_args_t *p_arg = new intf_dialog_args_t;
p_arg->p_dialog = (interaction_dialog_t *)(new_val.p_address);
-
- MainInterface *p_interface = (MainInterface*)param;
DialogEvent *event = new DialogEvent( INTF_DIALOG_INTERACTION, 0, p_arg );
QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
return VLC_SUCCESS;