Commit 1c462d81 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - MainInterface: small change on size behaviour and fixes.

parent fa303262
...@@ -92,27 +92,29 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -92,27 +92,29 @@ 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 = videoIsActive = false; embeddedPlaylistWasActive = videoIsActive = false;
bool b_createSystray = false;
bool b_createSystray = false;
input_name = ""; input_name = "";
/** /**
* Configuration * Configuration and settings
**/ **/
settings = new QSettings( "VideoLAN", "VLC" ); settings = new QSettings( "VideoLAN", "VLC" );
settings->beginGroup( "MainWindow" ); settings->beginGroup( "MainWindow" );
/* Main settings */
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops(true);
setWindowIcon( QApplication::windowIcon() ); setWindowIcon( QApplication::windowIcon() );
/* Set The Video In emebedded Mode or not */ /* Set The Video In emebedded Mode or not */
videoEmbeddedFlag = false; videoEmbeddedFlag = false;
if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true; if( config_GetInt( p_intf, "embedded-video" ) )
videoEmbeddedFlag = true;
alwaysVideoFlag = false; alwaysVideoFlag = false;
if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ) ) if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ) )
{
alwaysVideoFlag = true; alwaysVideoFlag = true;
}
/* Set the other interface settings */ /* Set the other interface settings */
playlistEmbeddedFlag = settings->value("playlist-embedded", true).toBool(); playlistEmbeddedFlag = settings->value("playlist-embedded", true).toBool();
...@@ -125,10 +127,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -125,10 +127,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setPalette(palette2); setPalette(palette2);
#endif #endif
/* Main settings */
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops(true);
/** /**
* UI design * UI design
**/ **/
...@@ -283,14 +281,9 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -283,14 +281,9 @@ void MainInterface::handleMainUi( QSettings *settings )
mainLayout->setMargin( 0 ); mainLayout->setMargin( 0 );
/* CONTROLS */ /* CONTROLS */
QWidget *controls = new QWidget( main ); QWidget *controls = new QWidget;
ui.setupUi( controls ); ui.setupUi( controls );
#if DEBUG_COLOR
/* QLabel *test = new QLabel("heheh");
mainLayout->addWidget( test );*/
#endif
/* Configure the UI */ /* Configure the UI */
slider = new InputSlider( Qt::Horizontal, NULL ); slider = new InputSlider( Qt::Horizontal, NULL );
ui.vboxLayout->insertWidget( 0, slider ); ui.vboxLayout->insertWidget( 0, slider );
...@@ -372,6 +365,59 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -372,6 +365,59 @@ void MainInterface::handleMainUi( QSettings *settings )
setMinimumSize( PREF_W, addSize.height() ); setMinimumSize( PREF_W, addSize.height() );
} }
/**********************************************************************
* Handling of the components
**********************************************************************/
void MainInterface::calculateInterfaceSize()
{
int width = 0, height = 0;
if( VISIBLE( bgWidget ) )
{
width = bgWidget->widgetSize.width();
height = bgWidget->widgetSize.height();
assert( !(playlistWidget && playlistWidget->isVisible() ) );
}
else if( VISIBLE( playlistWidget ) )
{
width = playlistWidget->widgetSize.width();
height = playlistWidget->widgetSize.height();
}
else if( videoIsActive )
{
width = videoWidget->widgetSize.width() ;
height = videoWidget->widgetSize.height();
}
else
{
width = PREF_W - addSize.width();
height = PREF_H - addSize.height();
}
if( VISIBLE( visualSelector ) )
height += visualSelector->height();
if( VISIBLE( advControls) )
{
height += advControls->sizeHint().height();
}
mainSize = QSize( width + addSize.width(), height + addSize.height() );
}
void MainInterface::resizeEvent( QResizeEvent *e )
{
videoWidget->widgetSize.setWidth( e->size().width() - addSize.width() );
if( videoWidget && videoIsActive && videoWidget->widgetSize.height() > 1 )
{
SET_WH( videoWidget, e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
videoWidget->updateGeometry();
}
if( VISIBLE( playlistWidget ) )
{
SET_WH( playlistWidget , e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
playlistWidget->updateGeometry();
}
}
/***************************************************************************** /*****************************************************************************
* Systray Icon and Systray Menu * Systray Icon and Systray Menu
*****************************************************************************/ *****************************************************************************/
...@@ -475,60 +521,6 @@ void MainInterface::updateSystrayTooltipStatus( int i_status ) ...@@ -475,60 +521,6 @@ void MainInterface::updateSystrayTooltipStatus( int i_status )
} }
} }
} }
/**********************************************************************
* Handling of the components
**********************************************************************/
void MainInterface::calculateInterfaceSize()
{
int width = 0, height = 0;
if( VISIBLE( bgWidget ) )
{
width = bgWidget->widgetSize.width();
height = bgWidget->widgetSize.height();
assert( !(playlistWidget && playlistWidget->isVisible() ) );
}
else if( VISIBLE( playlistWidget ) )
{
width = playlistWidget->widgetSize.width();
height = playlistWidget->widgetSize.height();
}
else if( videoIsActive )
{
width = videoWidget->widgetSize.width() ;
height = videoWidget->widgetSize.height();
}
else
{
width = PREF_W - addSize.width();
height = PREF_H - addSize.height();
}
if( VISIBLE( visualSelector ) )
height += visualSelector->height();
if( VISIBLE( advControls) )
{
height += advControls->sizeHint().height();
}
mainSize = QSize( width + addSize.width(), height + addSize.height() );
}
void MainInterface::resizeEvent( QResizeEvent *e )
{
videoWidget->widgetSize.setWidth( e->size().width() - addSize.width() );
if( videoWidget && videoIsActive && videoWidget->widgetSize.height() > 1 )
{
SET_WH( videoWidget, e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
videoWidget->updateGeometry();
}
if( VISIBLE( playlistWidget ) )
{
SET_WH( playlistWidget , e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
playlistWidget->updateGeometry();
}
}
void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
int *pi_y, unsigned int *pi_width, int *pi_y, unsigned int *pi_width,
unsigned int *pi_height ) unsigned int *pi_height )
......
...@@ -9,30 +9,22 @@ ...@@ -9,30 +9,22 @@
<height>201</height> <height>201</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>_("VLC media player")</string>
</property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" > <property name="spacing" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
...@@ -41,12 +33,21 @@ ...@@ -41,12 +33,21 @@
<item> <item>
<widget class="QFrame" name="discFrame" > <widget class="QFrame" name="discFrame" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QPushButton" name="menuButton" > <widget class="QPushButton" name="menuButton" >
<property name="text" > <property name="text" >
...@@ -75,18 +76,25 @@ ...@@ -75,18 +76,25 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QPushButton" name="prevButton" > <widget class="QPushButton" name="prevButton" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
...@@ -108,9 +116,7 @@ ...@@ -108,9 +116,7 @@
<item> <item>
<widget class="QPushButton" name="playButton" > <widget class="QPushButton" name="playButton" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
...@@ -135,9 +141,7 @@ ...@@ -135,9 +141,7 @@
<item> <item>
<widget class="QPushButton" name="stopButton" > <widget class="QPushButton" name="stopButton" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
...@@ -162,9 +166,7 @@ ...@@ -162,9 +166,7 @@
<item> <item>
<widget class="QPushButton" name="nextButton" > <widget class="QPushButton" name="nextButton" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
...@@ -209,9 +211,7 @@ ...@@ -209,9 +211,7 @@
<item> <item>
<widget class="QSlider" name="volumeSlider" > <widget class="QSlider" name="volumeSlider" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
...@@ -230,9 +230,7 @@ ...@@ -230,9 +230,7 @@
<item> <item>
<widget class="QPushButton" name="playlistButton" > <widget class="QPushButton" name="playlistButton" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
......
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