Commit b83c1d09 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - lame attempt for the resizing of the interface.

parent 70027747
...@@ -41,9 +41,6 @@ ...@@ -41,9 +41,6 @@
#include <QPalette> #include <QPalette>
#include <QResizeEvent> #include <QResizeEvent>
#define ICON_SIZE 128
#define MAX_BG_SIZE 300
/********************************************************************** /**********************************************************************
* Video Widget. A simple frame on which video is drawn * Video Widget. A simple frame on which video is drawn
* This class handles resize issues * This class handles resize issues
...@@ -57,6 +54,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i ) ...@@ -57,6 +54,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{ {
vlc_mutex_init( p_intf, &lock ); vlc_mutex_init( p_intf, &lock );
p_vout = NULL; p_vout = NULL;
CONNECT( this, askResize(), this, SetMinSize() ); CONNECT( this, askResize(), this, SetMinSize() );
CONNECT( this, askVideoToShow(), this, show() ); CONNECT( this, askVideoToShow(), this, show() );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
...@@ -110,37 +108,48 @@ void VideoWidget::release( void *p_win ) ...@@ -110,37 +108,48 @@ void VideoWidget::release( void *p_win )
{ {
p_vout = NULL; p_vout = NULL;
} }
/********************************************************************** /**********************************************************************
* Background Widget. Show a simple image background. Currently, * Background Widget. Show a simple image background. Currently,
* it's a static cone. * it's a static cone.
**********************************************************************/ **********************************************************************/
#define ICON_SIZE 128
#define MAX_BG_SIZE 400
#define MIN_BG_SIZE 64
BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) : BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
QFrame( NULL ), p_intf( _p_i ) QFrame( NULL ), p_intf( _p_i )
{ {
/* We should use that one to take the more size it can */
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
/* A dark background */
setAutoFillBackground( true ); setAutoFillBackground( true );
plt = palette(); plt = palette();
plt.setColor( QPalette::Active, QPalette::Window , Qt::black ); plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black ); plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt ); setPalette( plt );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred);
/* A cone in the middle */
label = new QLabel; label = new QLabel;
// label->setScaledContents( true );
label->setMargin( 5 );
label->setMaximumHeight( MAX_BG_SIZE ); label->setMaximumHeight( MAX_BG_SIZE );
label->setMaximumWidth( MAX_BG_SIZE ); label->setMaximumWidth( MAX_BG_SIZE );
label->setScaledContents( true ); label->setMinimumHeight( MIN_BG_SIZE );
label->setMinimumWidth( MIN_BG_SIZE );
label->setPixmap( QPixmap( ":/vlc128.png" ) ); label->setPixmap( QPixmap( ":/vlc128.png" ) );
backgroundLayout = new QHBoxLayout;
QVBoxLayout *backgroundLayout = new QVBoxLayout( this );
backgroundLayout->addWidget( label ); backgroundLayout->addWidget( label );
setLayout( backgroundLayout );
resize( 300, 150 );
updateGeometry(); updateGeometry();
} }
BackgroundWidget::~BackgroundWidget() BackgroundWidget::~BackgroundWidget()
{ {}
backgroundLayout->takeAt( 0 );
delete backgroundLayout;
}
void BackgroundWidget::setArt( QString url ) void BackgroundWidget::setArt( QString url )
{ {
...@@ -153,20 +162,15 @@ void BackgroundWidget::setArt( QString url ) ...@@ -153,20 +162,15 @@ void BackgroundWidget::setArt( QString url )
QSize BackgroundWidget::sizeHint() const QSize BackgroundWidget::sizeHint() const
{ {
return label->maximumSize(); return label->size();
} }
void BackgroundWidget::resizeEvent( QResizeEvent *e ) void BackgroundWidget::resizeEvent( QResizeEvent *e )
{ {
if( e->size().height() < MAX_BG_SIZE -1 ) msg_Dbg( p_intf, "BG size, %i, %i", e->size().width(), e->size().height() );
if( e->size().height() < label->height() )
{ {
label->setMaximumWidth( e->size().height() ); label->resize( e->size().height(), e->size().height() );
label->setMaximumHeight( e->size().width() );
}
else
{
label->setMaximumHeight( MAX_BG_SIZE );
label->setMaximumWidth( MAX_BG_SIZE );
} }
} }
...@@ -174,6 +178,7 @@ void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event ) ...@@ -174,6 +178,7 @@ void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
{ {
QVLCMenu::PopupMenu( p_intf, true ); QVLCMenu::PopupMenu( p_intf, true );
} }
/********************************************************************** /**********************************************************************
* Visualization selector panel * Visualization selector panel
**********************************************************************/ **********************************************************************/
...@@ -203,7 +208,6 @@ VisualSelector::VisualSelector( intf_thread_t *_p_i ) : ...@@ -203,7 +208,6 @@ VisualSelector::VisualSelector( intf_thread_t *_p_i ) :
VisualSelector::~VisualSelector() VisualSelector::~VisualSelector()
{ {
} }
void VisualSelector::prev() void VisualSelector::prev()
...@@ -242,25 +246,24 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) : ...@@ -242,25 +246,24 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
advLayout->setMargin( 0 ); advLayout->setMargin( 0 );
advLayout->setSpacing( 0 ); advLayout->setSpacing( 0 );
/* FIXME A to B function */ /* A to B Button */
ABButton = new QPushButton( "AB" ); ABButton = new QPushButton( "AB" );
ABButton->setMaximumSize( QSize( 26, 26 ) ); ABButton->setMaximumSize( QSize( 26, 26 ) );
ABButton->setIconSize( QSize( 20, 20 ) ); ABButton->setIconSize( QSize( 20, 20 ) );
advLayout->addWidget( ABButton ); advLayout->addWidget( ABButton );
BUTTON_SET_ACT( ABButton, "AB", qtr( "A to B" ), fromAtoB() ); BUTTON_SET_ACT( ABButton, "AB", qtr( "A to B" ), fromAtoB() );
timeA = 0; timeA = timeB = 0;
timeB = 0;
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
this, AtoBLoop( float, int, int ) ); this, AtoBLoop( float, int, int ) );
//FIXME Frame by frame function //FIXME Frame by frame function
frameButton = new QPushButton( "Fr" ); frameButton = new QPushButton( "Fr" );
frameButton->setMaximumSize( QSize( 26, 26 ) ); frameButton->setMaximumSize( QSize( 26, 26 ) );
frameButton->setIconSize( QSize( 20, 20 ) ); frameButton->setIconSize( QSize( 20, 20 ) );
advLayout->addWidget( frameButton ); advLayout->addWidget( frameButton );
BUTTON_SET_ACT( frameButton, "Fr", qtr( "Frame by Frame" ), frame() ); BUTTON_SET_ACT( frameButton, "Fr", qtr( "Frame by Frame" ), frame() );
/* FIXME Record function */ /* FIXME Record function */
recordButton = new QPushButton( "R" ); recordButton = new QPushButton( "R" );
recordButton->setMaximumSize( QSize( 26, 26 ) ); recordButton->setMaximumSize( QSize( 26, 26 ) );
recordButton->setIconSize( QSize( 20, 20 ) ); recordButton->setIconSize( QSize( 20, 20 ) );
...@@ -268,23 +271,23 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) : ...@@ -268,23 +271,23 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
BUTTON_SET_ACT_I( recordButton, "", record_16px.png, BUTTON_SET_ACT_I( recordButton, "", record_16px.png,
qtr( "Record" ), record() ); qtr( "Record" ), record() );
/* Snapshot Button */
snapshotButton = new QPushButton( "S" ); snapshotButton = new QPushButton( "S" );
snapshotButton->setMaximumSize( QSize( 26, 26 ) ); snapshotButton->setMaximumSize( QSize( 26, 26 ) );
snapshotButton->setIconSize( QSize( 20, 20 ) ); snapshotButton->setIconSize( QSize( 20, 20 ) );
advLayout->addWidget( snapshotButton ); advLayout->addWidget( snapshotButton );
BUTTON_SET_ACT( snapshotButton, "S", qtr( "Take a snapshot" ), snapshot() ); BUTTON_SET_ACT( snapshotButton, "S", qtr( "Take a snapshot" ), snapshot() );
} }
AdvControlsWidget::~AdvControlsWidget() AdvControlsWidget::~AdvControlsWidget()
{ {}
}
void AdvControlsWidget::enableInput( bool enable ) void AdvControlsWidget::enableInput( bool enable )
{ {
ABButton->setEnabled( enable ); ABButton->setEnabled( enable );
recordButton->setEnabled( enable ); recordButton->setEnabled( enable );
} }
void AdvControlsWidget::enableVideo( bool enable ) void AdvControlsWidget::enableVideo( bool enable )
{ {
snapshotButton->setEnabled( enable ); snapshotButton->setEnabled( enable );
...@@ -293,14 +296,12 @@ void AdvControlsWidget::enableVideo( bool enable ) ...@@ -293,14 +296,12 @@ void AdvControlsWidget::enableVideo( bool enable )
void AdvControlsWidget::snapshot() void AdvControlsWidget::snapshot()
{ {
vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); vout_thread_t *p_vout =
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout ) vout_Control( p_vout, VOUT_SNAPSHOT ); if( p_vout ) vout_Control( p_vout, VOUT_SNAPSHOT );
} }
void AdvControlsWidget::frame() /* Function called when the button is clicked() */
{
}
void AdvControlsWidget::fromAtoB() void AdvControlsWidget::fromAtoB()
{ {
if( !timeA ) if( !timeA )
...@@ -321,8 +322,7 @@ void AdvControlsWidget::fromAtoB() ...@@ -321,8 +322,7 @@ void AdvControlsWidget::fromAtoB()
ABButton->setText( "AB" ); ABButton->setText( "AB" );
} }
void AdvControlsWidget::record(){} /* Function called regularly when in an AtoB loop */
void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length ) void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
{ {
if( timeB ) if( timeB )
...@@ -332,6 +332,9 @@ void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length ) ...@@ -332,6 +332,9 @@ void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
} }
} }
void AdvControlsWidget::record(){}
void AdvControlsWidget::frame(){}
/***************************** /*****************************
* DA Control Widget ! * DA Control Widget !
*****************************/ *****************************/
...@@ -342,14 +345,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -342,14 +345,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
{ {
controlLayout = new QGridLayout( this ); controlLayout = new QGridLayout( this );
controlLayout->setSpacing( 0 ); controlLayout->setSpacing( 0 );
setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Fixed ); setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Minimum );
/** The main Slider **/ /** The main Slider **/
slider = new InputSlider( Qt::Horizontal, NULL ); slider = new InputSlider( Qt::Horizontal, NULL );
controlLayout->addWidget( slider, 0, 1, 1, 16 ); controlLayout->addWidget( slider, 0, 1, 1, 16 );
/* Update the position when the IM has changed */ /* Update the position when the IM has changed */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
slider, setPosition( float,int, int ) ); slider, setPosition( float, int, int ) );
/* And update the IM, when the position has changed */ /* And update the IM, when the position has changed */
CONNECT( slider, sliderDragged( float ), CONNECT( slider, sliderDragged( float ),
THEMIM->getIM(), sliderUpdate( float ) ); THEMIM->getIM(), sliderUpdate( float ) );
...@@ -431,7 +434,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -431,7 +434,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
playButton->setMinimumSize( QSize( 45, 45 ) ); playButton->setMinimumSize( QSize( 45, 45 ) );
playButton->setIconSize( QSize( 30, 30 ) ); playButton->setIconSize( QSize( 30, 30 ) );
controlLayout->addWidget( playButton, 2, 0, 2, 2 ); controlLayout->addWidget( playButton, 2, 0, 2, 2, Qt::AlignBottom );
controlLayout->setColumnMinimumWidth( 2, 20 ); controlLayout->setColumnMinimumWidth( 2, 20 );
controlLayout->setColumnStretch( 2, 0 ); controlLayout->setColumnStretch( 2, 0 );
...@@ -462,7 +465,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -462,7 +465,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
controlButLayout->addWidget( nextButton ); controlButLayout->addWidget( nextButton );
/* Add this block to the main layout */ /* Add this block to the main layout */
controlLayout->addLayout( controlButLayout, 3, 3, 1, 3 ); controlLayout->addLayout( controlButLayout, 3, 3, 1, 3, Qt::AlignBottom );
BUTTON_SET_ACT_I( playButton, "", play.png, qtr( "Play" ), play() ); BUTTON_SET_ACT_I( playButton, "", play.png, qtr( "Play" ), play() );
BUTTON_SET_ACT_I( prevButton, "" , previous.png, BUTTON_SET_ACT_I( prevButton, "" , previous.png,
...@@ -481,12 +484,12 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -481,12 +484,12 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
fullscreenButton = new QPushButton( "F" ); fullscreenButton = new QPushButton( "F" );
BUTTON_SET_ACT( fullscreenButton, "F", qtr( "Fullscreen" ), fullscreen() ); BUTTON_SET_ACT( fullscreenButton, "F", qtr( "Fullscreen" ), fullscreen() );
setupSmallButton( fullscreenButton ); setupSmallButton( fullscreenButton );
controlLayout->addWidget( fullscreenButton, 3, 10 ); controlLayout->addWidget( fullscreenButton, 3, 10, Qt::AlignBottom );
/** Playlist Button **/ /** Playlist Button **/
playlistButton = new QPushButton; playlistButton = new QPushButton;
setupSmallButton( playlistButton ); setupSmallButton( playlistButton );
controlLayout->addWidget( playlistButton, 3, 11 ); controlLayout->addWidget( playlistButton, 3, 11, Qt::AlignBottom );
BUTTON_SET_IMG( playlistButton, "" , playlist.png, qtr( "Show playlist" ) ); BUTTON_SET_IMG( playlistButton, "" , playlist.png, qtr( "Show playlist" ) );
/** extended Settings **/ /** extended Settings **/
...@@ -494,7 +497,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -494,7 +497,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
BUTTON_SET_ACT( extSettingsButton, "Ex", qtr( "Extended Settings" ), BUTTON_SET_ACT( extSettingsButton, "Ex", qtr( "Extended Settings" ),
extSettings() ); extSettings() );
setupSmallButton( extSettingsButton ); setupSmallButton( extSettingsButton );
controlLayout->addWidget( extSettingsButton, 3, 12 ); controlLayout->addWidget( extSettingsButton, 3, 12, Qt::AlignBottom );
controlLayout->setColumnStretch( 14, 5 ); controlLayout->setColumnStretch( 14, 5 );
...@@ -505,7 +508,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -505,7 +508,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) ); volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) );
volMuteLabel->setToolTip( qtr( "Mute" ) ); volMuteLabel->setToolTip( qtr( "Mute" ) );
volMuteLabel->installEventFilter( hVolLabel ); volMuteLabel->installEventFilter( hVolLabel );
controlLayout->addWidget( volMuteLabel, 3, 15 ); controlLayout->addWidget( volMuteLabel, 3, 15, Qt::AlignBottom );
if( b_shiny ) if( b_shiny )
{ {
...@@ -521,7 +524,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -521,7 +524,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
volumeSlider->setMaximumSize( QSize( 200, 40 ) ); volumeSlider->setMaximumSize( QSize( 200, 40 ) );
volumeSlider->setMinimumSize( QSize( 80, 20 ) ); volumeSlider->setMinimumSize( QSize( 80, 20 ) );
volumeSlider->setFocusPolicy( Qt::NoFocus ); volumeSlider->setFocusPolicy( Qt::NoFocus );
controlLayout->addWidget( volumeSlider, 3, 16, 1, 2 ); controlLayout->addWidget( volumeSlider, 3, 16, 1, 2, Qt::AlignBottom );
/* Set the volume from the config */ /* Set the volume from the config */
volumeSlider->setValue( ( config_GetInt( p_intf, "volume" ) ) * volumeSlider->setValue( ( config_GetInt( p_intf, "volume" ) ) *
...@@ -532,15 +535,17 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -532,15 +535,17 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) ); CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
msg_Dbg( p_intf, "controls size: %i - %i", size().width(), size().height() ); msg_Dbg( p_intf, "controls size: %i - %i", size().width(), size().height() );
} }
ControlsWidget::~ControlsWidget() ControlsWidget::~ControlsWidget()
{ {
} }
/*
QSize ControlsWidget::sizeHint() const QSize ControlsWidget::sizeHint() const
{ {
return QSize( 300, 50 ); return QSize( 300, 50 );
} }
*/
void ControlsWidget::stop() void ControlsWidget::stop()
{ {
...@@ -646,7 +651,8 @@ void ControlsWidget::setStatus( int status ) ...@@ -646,7 +651,8 @@ void ControlsWidget::setStatus( int status )
*/ */
void ControlsWidget::fullscreen() void ControlsWidget::fullscreen()
{ {
vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); vout_thread_t *p_vout =
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout) if( p_vout)
{ {
var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) ); var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
...@@ -710,9 +716,16 @@ void ControlsWidget::toggleAdvanced() ...@@ -710,9 +716,16 @@ void ControlsWidget::toggleAdvanced()
#include "components/playlist/panels.hpp" #include "components/playlist/panels.hpp"
#include "components/playlist/selector.hpp" #include "components/playlist/selector.hpp"
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : #include <QSplitter>
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) :
p_intf ( _p_i ) p_intf ( _p_i )
{ {
/* In case we want to keep the splitter informations */
settings->beginGroup( "Playlist" );
restoreState(settings->value("splitterSizes").toByteArray());
settings->endGroup();
/* Left Part and design */ /* Left Part and design */
QWidget *leftW = new QWidget( this ); QWidget *leftW = new QWidget( this );
QVBoxLayout *left = new QVBoxLayout( leftW ); QVBoxLayout *left = new QVBoxLayout( leftW );
...@@ -760,10 +773,10 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : ...@@ -760,10 +773,10 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) :
setCollapsible( 1, false ); setCollapsible( 1, false );
QList<int> sizeList; QList<int> sizeList;
sizeList << 180 << 520 ; sizeList << 180 << 420 ;
setSizes( sizeList ); setSizes( sizeList );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
resize(700,200); resize( 600, 300 );
updateGeometry(); updateGeometry();
} }
...@@ -784,13 +797,20 @@ void PlaylistWidget::setArt( QString url ) ...@@ -784,13 +797,20 @@ void PlaylistWidget::setArt( QString url )
QSize PlaylistWidget::sizeHint() const QSize PlaylistWidget::sizeHint() const
{ {
return QSize( 700, 200 ); return QSize( 600 , 300 );
} }
PlaylistWidget::~PlaylistWidget() PlaylistWidget::~PlaylistWidget()
{ {
} }
void PlaylistWidget::saveSettings( QSettings *settings )
{
settings->beginGroup( "Playlist" );
settings->setValue("splitterSizes", saveState() );
settings->endGroup();
}
/********************************************************************** /**********************************************************************
* Speed control widget * Speed control widget
**********************************************************************/ **********************************************************************/
...@@ -828,8 +848,7 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) : ...@@ -828,8 +848,7 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
} }
SpeedControlWidget::~SpeedControlWidget() SpeedControlWidget::~SpeedControlWidget()
{ {}
}
#define RATE_SLIDER_MAXIMUM 3.0 #define RATE_SLIDER_MAXIMUM 3.0
#define RATE_SLIDER_MINIMUM 0.3 #define RATE_SLIDER_MINIMUM 0.3
...@@ -884,7 +903,7 @@ void SpeedControlWidget::updateRate( int sliderValue ) ...@@ -884,7 +903,7 @@ void SpeedControlWidget::updateRate( int sliderValue )
if( sliderValue < 0.0 ) if( sliderValue < 0.0 )
{ {
rate = INPUT_RATE_DEFAULT* RATE_SLIDER_LENGTH / rate = INPUT_RATE_DEFAULT* RATE_SLIDER_LENGTH /
( sliderValue * ( 1.0 - RATE_SLIDER_MINIMUM ) + RATE_SLIDER_LENGTH ) ; ( sliderValue * ( 1.0 - RATE_SLIDER_MINIMUM ) + RATE_SLIDER_LENGTH );
} }
else else
{ {
...@@ -899,5 +918,3 @@ void SpeedControlWidget::resetRate() ...@@ -899,5 +918,3 @@ void SpeedControlWidget::resetRate()
{ {
THEMIM->getIM()->setRate(INPUT_RATE_DEFAULT); THEMIM->getIM()->setRate(INPUT_RATE_DEFAULT);
} }
...@@ -83,11 +83,8 @@ public: ...@@ -83,11 +83,8 @@ public:
private: private:
QPalette plt; QPalette plt;
QLabel *label; QLabel *label;
QHBoxLayout *backgroundLayout;
virtual void resizeEvent( QResizeEvent *e ); virtual void resizeEvent( QResizeEvent *e );
virtual void contextMenuEvent( QContextMenuEvent *event ); virtual void contextMenuEvent( QContextMenuEvent *event );
int DrawBackground();
int CleanBackground();
intf_thread_t *p_intf; intf_thread_t *p_intf;
public slots: public slots:
void setArt( QString ); void setArt( QString );
...@@ -149,7 +146,7 @@ class ControlsWidget : public QFrame ...@@ -149,7 +146,7 @@ class ControlsWidget : public QFrame
public: public:
/* p_intf, advanced control visible or not, blingbling or not */ /* p_intf, advanced control visible or not, blingbling or not */
ControlsWidget( intf_thread_t *, bool, bool ); ControlsWidget( intf_thread_t *, bool, bool );
QSize sizeHint() const; // QSize sizeHint() const;
virtual ~ControlsWidget(); virtual ~ControlsWidget();
QPushButton *playlistButton; QPushButton *playlistButton;
...@@ -239,14 +236,16 @@ class QSignalMapper; ...@@ -239,14 +236,16 @@ class QSignalMapper;
class PLSelector; class PLSelector;
class PLPanel; class PLPanel;
class QPushButton; class QPushButton;
class QSettings;
class PlaylistWidget : public QSplitter class PlaylistWidget : public QSplitter
{ {
Q_OBJECT; Q_OBJECT;
public: public:
PlaylistWidget( intf_thread_t *_p_i ) ; PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) ;
virtual ~PlaylistWidget(); virtual ~PlaylistWidget();
QSize sizeHint() const; QSize sizeHint() const;
void saveSettings( QSettings *settings );
private: private:
PLSelector *selector; PLSelector *selector;
PLPanel *rightPanel; PLPanel *rightPanel;
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
PlaylistDialog *PlaylistDialog::instance = NULL; PlaylistDialog *PlaylistDialog::instance = NULL;
PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
: QVLCMW( _p_intf )
{ {
QWidget *main = new QWidget( this ); QWidget *main = new QWidget( this );
setCentralWidget( main ); setCentralWidget( main );
...@@ -45,7 +46,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -45,7 +46,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) ); setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
QHBoxLayout *l = new QHBoxLayout( centralWidget() ); QHBoxLayout *l = new QHBoxLayout( centralWidget() );
PlaylistWidget *plw = new PlaylistWidget( p_intf ); PlaylistWidget *plw = new PlaylistWidget( p_intf, NULL );
l->addWidget( plw ); l->addWidget( plw );
readSettings( "playlist", QSize( 600,700 ) ); readSettings( "playlist", QSize( 600,700 ) );
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
class QSignalMapper; class QSignalMapper;
class PLSelector; class PLSelector;
class PLPanel; class PLPanel;
class QSettings;
class PlaylistDialog : public QVLCMW class PlaylistDialog : public QVLCMW
{ {
......
...@@ -96,9 +96,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -96,9 +96,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL; bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
embeddedPlaylistWasActive = videoIsActive = false; embeddedPlaylistWasActive = videoIsActive = false;
input_name = ""; input_name = "";
playlistWidget = new PlaylistWidget( p_intf );
/* Ask for the network policy on first startup */ /**
* Ask for the network policy on FIRST STARTUP
*/
if( config_GetInt( p_intf, "privacy-ask") ) if( config_GetInt( p_intf, "privacy-ask") )
{ {
QList<ConfigControl *> controls; QList<ConfigControl *> controls;
...@@ -145,16 +146,15 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -145,16 +146,15 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
* UI and Widgets design * UI and Widgets design
**************************/ **************************/
setVLCWindowsTitle(); setVLCWindowsTitle();
dockPL = new QDockWidget( qtr("Playlist"), this ); handleMainUi( settings );
/* Create a Dock to get the playlist */ /* Create a Dock to get the playlist */
handleMainUi( settings ); dockPL = new QDockWidget( qtr("Playlist"), this );
dockPL->setAllowedAreas( Qt::LeftDockWidgetArea dockPL->setAllowedAreas( Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea | Qt::RightDockWidgetArea
| Qt::BottomDockWidgetArea ); | Qt::BottomDockWidgetArea );
dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures ); dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures );
dockPL->setWidget( playlistWidget ); dockPL->setWidget( playlistWidget );
addDockWidget( Qt::BottomDockWidgetArea, dockPL );
/* Menu Bar */ /* Menu Bar */
QVLCMenu::createMenuBar( this, p_intf, visualSelectorEnabled ); QVLCMenu::createMenuBar( this, p_intf, visualSelectorEnabled );
...@@ -222,8 +222,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -222,8 +222,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Init input manager */ /* Init input manager */
MainInputManager::getInstance( p_intf ); MainInputManager::getInstance( p_intf );
ON_TIMEOUT( updateOnTimer() ); ON_TIMEOUT( updateOnTimer() );
// ON_TIMEOUT( debug() ); //ON_TIMEOUT( debug() );
/******************** /********************
* Various CONNECTs * * Various CONNECTs *
...@@ -284,6 +283,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -284,6 +283,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( this, askReleaseVideo( void * ), this, releaseVideoSlot( void * ) ); CONNECT( this, askReleaseVideo( void * ), this, releaseVideoSlot( void * ) );
CONNECT( dockPL, topLevelChanged( bool ), this, doComponentsUpdate() );
// DEBUG FIXME // DEBUG FIXME
hide(); hide();
updateGeometry(); updateGeometry();
...@@ -301,9 +301,10 @@ MainInterface::~MainInterface() ...@@ -301,9 +301,10 @@ MainInterface::~MainInterface()
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
settings->setValue( "playlist-embedded", !dockPL->isFloating() ); settings->setValue( "playlist-floats", dockPL->isFloating() );
settings->setValue( "adv-controls", getControlsVisibilityStatus() & CONTROLS_ADVANCED ); settings->setValue( "adv-controls", getControlsVisibilityStatus() & CONTROLS_ADVANCED );
settings->setValue( "pos", pos() ); settings->setValue( "pos", pos() );
playlistWidget->saveSettings( settings );
settings->endGroup(); settings->endGroup();
delete settings; delete settings;
p_intf->b_interaction = VLC_FALSE; p_intf->b_interaction = VLC_FALSE;
...@@ -383,7 +384,6 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -383,7 +384,6 @@ void MainInterface::handleMainUi( QSettings *settings )
bgWidget->updateGeometry(); bgWidget->updateGeometry();
mainLayout->insertWidget( 0, bgWidget ); mainLayout->insertWidget( 0, bgWidget );
CONNECT( this, askBgWidgetToToggle(), bgWidget, toggle() ); CONNECT( this, askBgWidgetToToggle(), bgWidget, toggle() );
CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) );
} }
if( videoEmbeddedFlag ) if( videoEmbeddedFlag )
...@@ -415,15 +415,16 @@ void MainInterface::privacyDialog( QList<ConfigControl *> controls ) ...@@ -415,15 +415,16 @@ void MainInterface::privacyDialog( QList<ConfigControl *> controls )
QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Warning" ) ); QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Warning" ) );
QGridLayout *blablaLayout = new QGridLayout( blabla ); QGridLayout *blablaLayout = new QGridLayout( blabla );
QLabel *text = new QLabel( qtr( QLabel *text = new QLabel( qtr(
"<p>The <i>VideoLAN Team</i> doesn't like when an application goes online without " "<p>The <i>VideoLAN Team</i> doesn't like when an application goes "
"authorisation.</p>\n " "online without authorisation.</p>\n "
"<p><i>VLC media player</i> can request limited information on " "<p><i>VLC media player</i> can request limited information on "
"Internet, espically to get CD Covers and songs metadata or to know " "Internet, espically to get CD Covers and songs metadata or to know "
"if updates are available.</p>\n" "if updates are available.</p>\n"
"<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> information, even anonymously about your " "<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> "
"information, even anonymously about your "
"usage.</p>\n" "usage.</p>\n"
"<p>Therefore please check the following options, the default being almost no " "<p>Therefore please check the following options, the default being "
"access on the web.</p>\n") ); "almost no access on the web.</p>\n") );
text->setWordWrap( true ); text->setWordWrap( true );
text->setTextFormat( Qt::RichText ); text->setTextFormat( Qt::RichText );
...@@ -476,6 +477,25 @@ void MainInterface::debug() ...@@ -476,6 +477,25 @@ void MainInterface::debug()
/********************************************************************** /**********************************************************************
* Handling of sizing of the components * Handling of sizing of the components
**********************************************************************/ **********************************************************************/
QSize MainInterface::sizeHint() const
{
msg_Dbg( p_intf, "Annoying debug to remove, main sizeHint was called %i %i ",
menuBar()->size().height(), menuBar()->size().width() );
QSize tempSize = controls->sizeHint() +
QSize( 100, menuBar()->size().height() + statusBar()->size().height() );
if( VISIBLE( bgWidget ) )
tempSize += bgWidget->sizeHint();
else if( videoIsActive )
tempSize += videoWidget->size();
if( !dockPL->isFloating() && dockPL->widget() )
tempSize += dockPL->widget()->size();
return tempSize;
}
#if 0 #if 0
void MainInterface::calculateInterfaceSize() void MainInterface::calculateInterfaceSize()
{ {
...@@ -563,8 +583,9 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -563,8 +583,9 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
if( ret ) if( ret )
{ {
videoIsActive = true; videoIsActive = true;
bool bgWasVisible = false; bool bgWasVisible = false;
/* Did we have a bg */
if( VISIBLE( bgWidget) ) if( VISIBLE( bgWidget) )
{ {
bgWasVisible = true; bgWasVisible = true;
...@@ -655,9 +676,10 @@ void MainInterface::togglePlaylist() ...@@ -655,9 +676,10 @@ void MainInterface::togglePlaylist()
if( !playlistWidget ) if( !playlistWidget )
{ {
msg_Dbg( p_intf, "Creating a new playlist" ); msg_Dbg( p_intf, "Creating a new playlist" );
playlistWidget = new PlaylistWidget( p_intf ); playlistWidget = new PlaylistWidget( p_intf, settings );
if( bgWidget ) if( bgWidget )
CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) ); CONNECT( playlistWidget, artSet( QString ),
bgWidget, setArt(QString) );
//FIXME //FIXME
/* playlistWidget->widgetSize = settings->value( "playlistSize", /* playlistWidget->widgetSize = settings->value( "playlistSize",
...@@ -671,12 +693,11 @@ void MainInterface::togglePlaylist() ...@@ -671,12 +693,11 @@ void MainInterface::togglePlaylist()
msg_Dbg( p_intf, "Creating a new playlist" ); msg_Dbg( p_intf, "Creating a new playlist" );
/* Make the playlist floating is requested. Default is not. */ /* Make the playlist floating is requested. Default is not. */
if( !(settings->value( "playlist-embedded", true )).toBool() ); if( settings->value( "playlist-floats", false ).toBool() );
{ {
msg_Dbg( p_intf, "we don't want it inside"); msg_Dbg( p_intf, "we don't want it inside");
//dockPL->setFloating( true ); dockPL->setFloating( true );
} }
} }
else else
{ {
...@@ -731,13 +752,13 @@ void MainInterface::toggleMinimalView() ...@@ -731,13 +752,13 @@ void MainInterface::toggleMinimalView()
/* Video widget cannot do this synchronously as it runs in another thread */ /* Video widget cannot do this synchronously as it runs in another thread */
/* Well, could it, actually ? Probably dangerous ... */ /* Well, could it, actually ? Probably dangerous ... */
#if 0
void MainInterface::doComponentsUpdate() void MainInterface::doComponentsUpdate()
{ {
calculateInterfaceSize(); msg_Dbg( p_intf, "trying" );
resize( mainSize );
resize( sizeHint() );
} }
#endif
void MainInterface::toggleAdvanced() void MainInterface::toggleAdvanced()
{ {
......
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
QSystemTrayIcon *getSysTray() { return sysTray; }; QSystemTrayIcon *getSysTray() { return sysTray; };
QMenu *getSysTrayMenu() { return systrayMenu; }; QMenu *getSysTrayMenu() { return systrayMenu; };
int getControlsVisibilityStatus(); int getControlsVisibilityStatus();
QSize sizeHint() const;
protected: protected:
// void resizeEvent( QResizeEvent * ); // void resizeEvent( QResizeEvent * );
void dropEvent( QDropEvent *); void dropEvent( QDropEvent *);
...@@ -96,7 +97,7 @@ private: ...@@ -96,7 +97,7 @@ private:
void handleMainUi( QSettings* ); void handleMainUi( QSettings* );
void handleSystray(); void handleSystray();
void doComponentsUpdate();
void createSystray(); void createSystray();
void privacyDialog( QList<ConfigControl *> controls ); void privacyDialog( QList<ConfigControl *> controls );
...@@ -143,7 +144,7 @@ public slots: ...@@ -143,7 +144,7 @@ public slots:
private slots: private slots:
void debug(); void debug();
void updateOnTimer(); void updateOnTimer();
void doComponentsUpdate();
void setStatus( int ); void setStatus( int );
void setRate( int ); void setRate( int );
void setName( QString ); void setName( QString );
......
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