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 )
need_components_update = false;
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
embeddedPlaylistWasActive = videoIsActive = false;
bool b_createSystray = false;
bool b_createSystray = false;
input_name = "";
/**
* Configuration
* Configuration and settings
**/
settings = new QSettings( "VideoLAN", "VLC" );
settings->beginGroup( "MainWindow" );
/* Main settings */
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops(true);
setWindowIcon( QApplication::windowIcon() );
/* Set The Video In emebedded Mode or not */
videoEmbeddedFlag = false;
if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true;
if( config_GetInt( p_intf, "embedded-video" ) )
videoEmbeddedFlag = true;
alwaysVideoFlag = false;
if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ) )
{
alwaysVideoFlag = true;
}
/* Set the other interface settings */
playlistEmbeddedFlag = settings->value("playlist-embedded", true).toBool();
......@@ -125,10 +127,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setPalette(palette2);
#endif
/* Main settings */
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops(true);
/**
* UI design
**/
......@@ -283,14 +281,9 @@ void MainInterface::handleMainUi( QSettings *settings )
mainLayout->setMargin( 0 );
/* CONTROLS */
QWidget *controls = new QWidget( main );
QWidget *controls = new QWidget;
ui.setupUi( controls );
#if DEBUG_COLOR
/* QLabel *test = new QLabel("heheh");
mainLayout->addWidget( test );*/
#endif
/* Configure the UI */
slider = new InputSlider( Qt::Horizontal, NULL );
ui.vboxLayout->insertWidget( 0, slider );
......@@ -372,6 +365,59 @@ void MainInterface::handleMainUi( QSettings *settings )
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
*****************************************************************************/
......@@ -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,
int *pi_y, unsigned int *pi_width,
unsigned int *pi_height )
......
......@@ -9,30 +9,22 @@
<height>201</height>
</rect>
</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" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<property name="spacing" >
<number>0</number>
</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>
</property>
<item>
......@@ -41,12 +33,21 @@
<item>
<widget class="QFrame" name="discFrame" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</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>
<widget class="QPushButton" name="menuButton" >
<property name="text" >
......@@ -75,18 +76,25 @@
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</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>
<widget class="QPushButton" name="prevButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -108,9 +116,7 @@
<item>
<widget class="QPushButton" name="playButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -135,9 +141,7 @@
<item>
<widget class="QPushButton" name="stopButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -162,9 +166,7 @@
<item>
<widget class="QPushButton" name="nextButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -209,9 +211,7 @@
<item>
<widget class="QSlider" name="volumeSlider" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -230,9 +230,7 @@
<item>
<widget class="QPushButton" name="playlistButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</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