Commit 1e84ceac authored by Clément Stenac's avatar Clément Stenac

Some size fixes

parent 17c96000
...@@ -104,16 +104,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) : ...@@ -104,16 +104,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
QFrame( NULL ), p_intf( _p_i ) QFrame( NULL ), p_intf( _p_i )
{ {
setFrameStyle(QFrame::StyledPanel | QFrame::Raised); setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
DrawBackground();
}
BackgroundWidget::~BackgroundWidget()
{
CleanBackground();
}
int BackgroundWidget::DrawBackground()
{
setAutoFillBackground( true ); setAutoFillBackground( true );
plt = palette(); plt = palette();
plt.setColor( QPalette::Active, QPalette::Window , Qt::black ); plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
...@@ -129,14 +120,12 @@ int BackgroundWidget::DrawBackground() ...@@ -129,14 +120,12 @@ int BackgroundWidget::DrawBackground()
backgroundLayout = new QHBoxLayout; backgroundLayout = new QHBoxLayout;
backgroundLayout->addWidget( label ); backgroundLayout->addWidget( label );
setLayout( backgroundLayout ); setLayout( backgroundLayout );
return 0;
} }
int BackgroundWidget::CleanBackground() BackgroundWidget::~BackgroundWidget()
{ {
backgroundLayout->takeAt(0); backgroundLayout->takeAt(0);
delete backgroundLayout; delete backgroundLayout;
return 0;
} }
QSize BackgroundWidget::sizeHint() const QSize BackgroundWidget::sizeHint() const
...@@ -153,6 +142,26 @@ void BackgroundWidget::resizeEvent( QResizeEvent *e ) ...@@ -153,6 +142,26 @@ void BackgroundWidget::resizeEvent( QResizeEvent *e )
label->setMaximumWidth( ICON_SIZE ); label->setMaximumWidth( ICON_SIZE );
} }
/**********************************************************************
* Visualization selector panel
**********************************************************************/
VisualSelector::VisualSelector( intf_thread_t *_p_i ) :
QFrame( NULL ), p_intf( _p_i )
{
setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
QHBoxLayout *layout = new QHBoxLayout( this );
QPushButton *prevButton = new QPushButton( "Prev" );
QPushButton *nextButton = new QPushButton( "Next");
layout->addWidget( prevButton );
layout->addWidget( nextButton );
setLayout( layout );
setMaximumHeight( 30 );
}
VisualSelector::~VisualSelector()
{
}
/********************************************************************** /**********************************************************************
* Playlist Widget. The embedded playlist * Playlist Widget. The embedded playlist
**********************************************************************/ **********************************************************************/
......
...@@ -78,6 +78,15 @@ private: ...@@ -78,6 +78,15 @@ private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
}; };
class VisualSelector : public QFrame
{
Q_OBJECT
public:
VisualSelector( intf_thread_t *);
virtual ~VisualSelector();
private:
intf_thread_t *p_intf;
};
/******************** Playlist Widget ****************/ /******************** Playlist Widget ****************/
#include <QModelIndex> #include <QModelIndex>
......
...@@ -50,6 +50,7 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf, ...@@ -50,6 +50,7 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
view->setIconSize( QSize(20,20) ); view->setIconSize( QSize(20,20) );
view->setAlternatingRowColors( true ); view->setAlternatingRowColors( true );
view->header()->resizeSection( 0, 230 ); view->header()->resizeSection( 0, 230 );
view->header()->resizeSection( 2, 60 );
view->header()->setSortIndicatorShown( true ); view->header()->setSortIndicatorShown( true );
view->header()->setClickable( true ); view->header()->setClickable( true );
view->setSelectionMode( QAbstractItemView::ExtendedSelection ); view->setSelectionMode( QAbstractItemView::ExtendedSelection );
......
...@@ -74,13 +74,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -74,13 +74,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
need_components_update = false; need_components_update = false;
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL; bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
embeddedPlaylistWasActive = false; embeddedPlaylistWasActive = videoIsActive = false;
videoIsActive= false;
setWindowTitle( QString::fromUtf8( _("VLC media player") ) ); setWindowTitle( QString::fromUtf8( _("VLC media player") ) );
handleMainUi( settings ); handleMainUi( settings );
QVLCMenu::createMenuBar( menuBar(), p_intf ); QVLCMenu::createMenuBar( menuBar(), p_intf );
/* Status bar */ /* Status bar */
timeLabel = new QLabel( 0 ); timeLabel = new QLabel( 0 );
nameLabel = new QLabel( 0 ); nameLabel = new QLabel( 0 );
...@@ -137,14 +137,16 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -137,14 +137,16 @@ void MainInterface::handleMainUi( QSettings *settings )
slider = new InputSlider( Qt::Horizontal, NULL ); slider = new InputSlider( Qt::Horizontal, NULL );
ui.hboxLayout->insertWidget( 0, slider ); ui.hboxLayout->insertWidget( 0, slider );
ui.prevButton->setText( "" ); ui.discFrame->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
ui.nextButton->setText( "" );
ui.playButton->setText( "" ); #define SET( button, image ) ui.button##Button->setText(""); \
ui.stopButton->setText( "" ); ui.button##Button->setIcon( QIcon( ":/pixmaps/"#image ) );
ui.prevButton->setIcon( QIcon( ":/pixmaps/previous.png" ) ); SET( prev, previous.png );
ui.nextButton->setIcon( QIcon( ":/pixmaps/next.png" ) ); SET( next, next.png );
ui.playButton->setIcon( QIcon( ":/pixmaps/play.png" ) ); SET( play, play.png );
ui.stopButton->setIcon( QIcon( ":/pixmaps/stop.png" ) ); SET( stop, stop.png );
SET( playlist, volume-low.png );
#undef SET
/* Volume */ /* Volume */
ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) ); ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
...@@ -156,9 +158,6 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -156,9 +158,6 @@ void MainInterface::handleMainUi( QSettings *settings )
ui.volHighLabel->installEventFilter(h); ui.volHighLabel->installEventFilter(h);
ui.volumeSlider->setFocusPolicy( Qt::NoFocus ); ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
ui.playlistButton->setText( "" );
ui.playlistButton->setIcon( QIcon( ":/pixmaps/volume-low.png" ) );
/* Fetch configuration from settings and vlc config */ /* Fetch configuration from settings and vlc config */
videoEmbeddedFlag = false; videoEmbeddedFlag = false;
if( config_GetInt( p_intf, "embedded-video" ) ) if( config_GetInt( p_intf, "embedded-video" ) )
...@@ -167,13 +166,16 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -167,13 +166,16 @@ void MainInterface::handleMainUi( QSettings *settings )
playlistEmbeddedFlag = true; playlistEmbeddedFlag = true;
/// \todo fetch playlist settings /// \todo fetch playlist settings
/* Set initial size */
resize ( PREF_W, PREF_H ); resize ( PREF_W, PREF_H );
addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
if( videoEmbeddedFlag ) if( videoEmbeddedFlag )
{ {
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
videoWidget->widgetSize = QSize( 1, 1 ); videoWidget->widgetSize = QSize( 1, 1 );
videoWidget->resize( videoWidget->widgetSize ); videoWidget->resize( videoWidget->widgetSize );
videoWidget->hide();
ui.vboxLayout->insertWidget( 0, videoWidget ); ui.vboxLayout->insertWidget( 0, videoWidget );
p_intf->pf_request_window = ::DoRequest; p_intf->pf_request_window = ::DoRequest;
...@@ -186,16 +188,13 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -186,16 +188,13 @@ void MainInterface::handleMainUi( QSettings *settings )
// bgWidget->widgetSize = settings->value( "backgroundSize", // bgWidget->widgetSize = settings->value( "backgroundSize",
// QSize( 200, 200 ) ).toSize(); // QSize( 200, 200 ) ).toSize();
// ui.vboxLayout->insertWidget( 0, bgWidget ); // ui.vboxLayout->insertWidget( 0, bgWidget );
// bgWidget->hide();
} }
} }
// visualSelector = new VisualSelector( p_intf );
// Size for fixed elements // visualSelector->hide();
addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
calculateInterfaceSize(); calculateInterfaceSize();
resize( mainSize ); resize( mainSize );
/// \bug still needed ?
mainSize = size(); mainSize = size();
setMinimumSize( PREF_W, addSize.height() ); setMinimumSize( PREF_W, addSize.height() );
...@@ -212,7 +211,7 @@ void MainInterface::calculateInterfaceSize() ...@@ -212,7 +211,7 @@ void MainInterface::calculateInterfaceSize()
{ {
width = bgWidget->widgetSize.width(); width = bgWidget->widgetSize.width();
height = bgWidget->widgetSize.height(); height = bgWidget->widgetSize.height();
assert( !playlistWidget->isVisible() ); assert( !(playlistWidget && playlistWidget->isVisible() ) );
} }
else if( playlistWidget && playlistWidget->isVisible() ) else if( playlistWidget && playlistWidget->isVisible() )
{ {
...@@ -239,22 +238,26 @@ void MainInterface::resizeEvent( QResizeEvent *e ) ...@@ -239,22 +238,26 @@ void MainInterface::resizeEvent( QResizeEvent *e )
*/ */
if( videoWidget ) if( videoWidget )
{ {
videoWidget->widgetSize.setWidth( e->size().width() -
addSize.width() );
if( videoIsActive ) if( videoIsActive )
{ {
videoWidget->widgetSize.setWidth( e->size().width() -
addSize.width() );
videoWidget->widgetSize.setHeight( e->size().height() - videoWidget->widgetSize.setHeight( e->size().height() -
addSize.height() ); addSize.height() );
videoWidget->updateGeometry(); videoWidget->updateGeometry();
} }
fprintf( stderr, "Video set to %ix%\ni", videoWidget->widgetSize.width(), videoWidget->widgetSize.height() ); fprintf( stderr, "Video set to %ix%i\n",
videoWidget->widgetSize.width(),
videoWidget->widgetSize.height() );
} }
if( playlistWidget ) if( playlistWidget )
{ {
playlistWidget->widgetSize.setWidth( e->size().width() -
addSize.width() );
if( playlistWidget->isVisible() ) if( playlistWidget->isVisible() )
{ {
playlistWidget->widgetSize.setWidth( e->size().width() -
addSize.width() );
playlistWidget->widgetSize.setHeight( e->size().height() - playlistWidget->widgetSize.setHeight( e->size().height() -
addSize.height() ); addSize.height() );
playlistWidget->updateGeometry(); playlistWidget->updateGeometry();
...@@ -279,6 +282,11 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -279,6 +282,11 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
embeddedPlaylistWasActive = true; embeddedPlaylistWasActive = true;
playlistWidget->hide(); playlistWidget->hide();
} }
if( bgWidget && bgWidget->isVisible() )
{
bgWidget->hide();
}
videoWidget->show();
videoWidget->widgetSize = QSize( *pi_width, *pi_height ); videoWidget->widgetSize = QSize( *pi_width, *pi_height );
videoWidget->updateGeometry(); /// FIXME: Needed ? videoWidget->updateGeometry(); /// FIXME: Needed ?
need_components_update = true; need_components_update = true;
...@@ -289,12 +297,15 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -289,12 +297,15 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
void MainInterface::releaseVideo( void *p_win ) void MainInterface::releaseVideo( void *p_win )
{ {
videoWidget->release( p_win ); videoWidget->release( p_win );
videoWidget->widgetSize = QSize( 1, 1 ); videoWidget->hide();
videoWidget->updateGeometry(); // videoWidget->widgetSize = QSize( 1, 1 );
// videoWidget->updateGeometry();
if( embeddedPlaylistWasActive ) if( embeddedPlaylistWasActive )
{
playlistWidget->show(); playlistWidget->show();
} else if( bgWidget )
bgWidget->show();
videoIsActive = false; videoIsActive = false;
need_components_update = true; need_components_update = true;
} }
......
...@@ -41,6 +41,7 @@ class VideoWidget; ...@@ -41,6 +41,7 @@ class VideoWidget;
class BackgroundWidget; class BackgroundWidget;
class PlaylistWidget; class PlaylistWidget;
class VolumeClickHandler; class VolumeClickHandler;
class VisualSelector;
class MainInterface : public QVLCMW class MainInterface : public QVLCMW
{ {
...@@ -74,6 +75,7 @@ private: ...@@ -74,6 +75,7 @@ private:
virtual void keyPressEvent( QKeyEvent *); virtual void keyPressEvent( QKeyEvent *);
BackgroundWidget *bgWidget; BackgroundWidget *bgWidget;
VisualSelector *visualSelector;
PlaylistWidget *playlistWidget; PlaylistWidget *playlistWidget;
bool playlistEmbeddedFlag; bool playlistEmbeddedFlag;
......
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