Commit 3777d840 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: change mainLayout

And use a QStackedWidget.
This will be usefull in the future to:
 - simplify the code about states and video-resize
 - support Qt Animations
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent d317eb91
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <QLabel> #include <QLabel>
#include <QGroupBox> #include <QGroupBox>
#include <QPushButton> #include <QPushButton>
#include <QStackedWidget>
#ifdef WIN32 #ifdef WIN32
#include <vlc_windows_interfaces.h> #include <vlc_windows_interfaces.h>
...@@ -365,9 +366,9 @@ void MainInterface::recreateToolbars() ...@@ -365,9 +366,9 @@ void MainInterface::recreateToolbars()
this, doComponentsUpdate() ); this, doComponentsUpdate() );
inputC = new InputControlsWidget( p_intf, this ); inputC = new InputControlsWidget( p_intf, this );
mainLayout->addWidget( inputC, 2, 0, 1, -1, Qt::AlignBottom ); mainLayout->insertWidget( 2, inputC );
mainLayout->addWidget( controls, settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3, mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
0, 1, -1, Qt::AlignBottom ); controls );
settings->endGroup(); settings->endGroup();
} }
...@@ -376,7 +377,7 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -376,7 +377,7 @@ void MainInterface::createMainWidget( QSettings *settings )
/* Create the main Widget and the mainLayout */ /* Create the main Widget and the mainLayout */
QWidget *main = new QWidget; QWidget *main = new QWidget;
setCentralWidget( main ); setCentralWidget( main );
mainLayout = new QGridLayout( main ); mainLayout = new QVBoxLayout( main );
/* Margins, spacing */ /* Margins, spacing */
main->setContentsMargins( 0, 0, 0, 0 ); main->setContentsMargins( 0, 0, 0, 0 );
...@@ -392,6 +393,7 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -392,6 +393,7 @@ void MainInterface::createMainWidget( QSettings *settings )
visualSelector->hide(); visualSelector->hide();
#endif #endif
QStackedWidget *stackCentralW = new QStackedWidget( main );
/* Bg Cone */ /* Bg Cone */
bgWidget = new BackgroundWidget( p_intf ); bgWidget = new BackgroundWidget( p_intf );
bgWidget->resize( bgWidget->resize(
...@@ -403,10 +405,14 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -403,10 +405,14 @@ void MainInterface::createMainWidget( QSettings *settings )
{ {
bgWidget->hide(); bgWidget->hide();
} }
stackCentralW->addWidget( bgWidget );
/* And video Outputs */ /* And video Outputs */
if( videoEmbeddedFlag ) if( videoEmbeddedFlag )
{
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
stackCentralW->addWidget( videoWidget );
}
/* Create the CONTROLS Widget */ /* Create the CONTROLS Widget */
controls = new ControlsWidget( p_intf, controls = new ControlsWidget( p_intf,
...@@ -417,17 +423,12 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -417,17 +423,12 @@ void MainInterface::createMainWidget( QSettings *settings )
this, doComponentsUpdate() ); this, doComponentsUpdate() );
inputC = new InputControlsWidget( p_intf, this ); inputC = new InputControlsWidget( p_intf, this );
mainLayout->insertWidget( 1, stackCentralW, 10 );
/* Add the controls Widget to the main Widget */
if( videoWidget ){
mainLayout->addWidget( videoWidget, 0, 0, 1, -1 );
mainLayout->setRowStretch( 0, 10 );
}
mainLayout->addWidget( bgWidget, 1, 0, 1, -1 );
//mainLayout->setRowStretch( 1, 10 ); //mainLayout->setRowStretch( 1, 10 );
mainLayout->addWidget( inputC, 2, 0, 1, -1, Qt::AlignBottom ); mainLayout->insertWidget( 2, inputC );
mainLayout->addWidget( controls, settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3, mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
0, 1, -1, Qt::AlignBottom ); controls );
/* Finish the sizing */ /* Finish the sizing */
main->updateGeometry(); main->updateGeometry();
......
...@@ -50,6 +50,7 @@ class ControlsWidget; ...@@ -50,6 +50,7 @@ class ControlsWidget;
class InputControlsWidget; class InputControlsWidget;
class FullscreenControllerWidget; class FullscreenControllerWidget;
class SpeedControlWidget; class SpeedControlWidget;
class QVBoxLayout;
class QMenu; class QMenu;
class QSize; class QSize;
...@@ -123,7 +124,7 @@ private: ...@@ -123,7 +124,7 @@ private:
QMenu *systrayMenu; QMenu *systrayMenu;
#endif #endif
QString input_name; QString input_name;
QGridLayout *mainLayout; QVBoxLayout *mainLayout;
ControlsWidget *controls; ControlsWidget *controls;
InputControlsWidget *inputC; InputControlsWidget *inputC;
FullscreenControllerWidget *fullscreenControls; FullscreenControllerWidget *fullscreenControls;
......
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