Commit 8a473ffa authored by Clément Stenac's avatar Clément Stenac

Improve embedded video output

Skeleton for interaction
Fix window settings save
parent 3ebf4f30
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
AUTOMAKE_OPTIONS = subdir-objects AUTOMAKE_OPTIONS = subdir-objects
TOUI = ui/input_stats ui/main_interface ui/file_open TOUI = ui/input_stats ui/main_interface ui/file_open \
ui/okcanceldialog
UIH = $(TOUI:%=%.h) UIH = $(TOUI:%=%.h)
TOMOC = main_interface \ TOMOC = main_interface \
...@@ -21,11 +22,13 @@ TOMOC = main_interface \ ...@@ -21,11 +22,13 @@ TOMOC = main_interface \
dialogs/playlist \ dialogs/playlist \
dialogs/prefs_dialog \ dialogs/prefs_dialog \
dialogs/streaminfo \ dialogs/streaminfo \
dialogs/interaction \
components/infopanels \ components/infopanels \
components/preferences_widgets \ components/preferences_widgets \
components/preferences \ components/preferences \
components/open \ components/open \
components/playlist/panels \ components/playlist/panels \
components/video_widget \
util/input_slider util/input_slider
MOCCPP = $(TOMOC:%=%.moc.cpp) MOCCPP = $(TOMOC:%=%.moc.cpp)
...@@ -37,11 +40,13 @@ nodist_SOURCES_qt4 = \ ...@@ -37,11 +40,13 @@ nodist_SOURCES_qt4 = \
dialogs/playlist.moc.cpp \ dialogs/playlist.moc.cpp \
dialogs/streaminfo.moc.cpp \ dialogs/streaminfo.moc.cpp \
dialogs/prefs_dialog.moc.cpp \ dialogs/prefs_dialog.moc.cpp \
dialogs/interaction.moc.cpp \
components/infopanels.moc.cpp \ components/infopanels.moc.cpp \
components/preferences_widgets.moc.cpp \ components/preferences_widgets.moc.cpp \
components/preferences.moc.cpp \ components/preferences.moc.cpp \
components/open.moc.cpp \ components/open.moc.cpp \
components/playlist/panels.moc.cpp \ components/playlist/panels.moc.cpp \
components/video_widget.moc.cpp \
util/input_slider.moc.cpp \ util/input_slider.moc.cpp \
resources.cpp resources.cpp
...@@ -72,6 +77,7 @@ SOURCES_qt4 = qt4.cpp \ ...@@ -72,6 +77,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/playlist.cpp \ dialogs/playlist.cpp \
dialogs/prefs_dialog.cpp \ dialogs/prefs_dialog.cpp \
dialogs/streaminfo.cpp \ dialogs/streaminfo.cpp \
dialogs/interaction.cpp \
components/infopanels.cpp \ components/infopanels.cpp \
components/preferences_widgets.cpp \ components/preferences_widgets.cpp \
components/preferences.cpp \ components/preferences.cpp \
...@@ -91,6 +97,7 @@ EXTRA_DIST += \ ...@@ -91,6 +97,7 @@ EXTRA_DIST += \
dialogs/playlist.hpp \ dialogs/playlist.hpp \
dialogs/streaminfo.hpp \ dialogs/streaminfo.hpp \
dialogs/prefs_dialog.hpp \ dialogs/prefs_dialog.hpp \
dialogs/interaction.cpp \
components/infopanels.hpp \ components/infopanels.hpp \
components/preferences_widgets.hpp \ components/preferences_widgets.hpp \
components/preferences.hpp \ components/preferences.hpp \
...@@ -99,6 +106,9 @@ EXTRA_DIST += \ ...@@ -99,6 +106,9 @@ EXTRA_DIST += \
components/video_widget.hpp \ components/video_widget.hpp \
util/input_slider.hpp \ util/input_slider.hpp \
ui/input_stats.ui \ ui/input_stats.ui \
ui/file_open.ui \
ui/main_interface.ui \
ui/okcanceldialog.ui \
pixmaps/advanced.xpm \ pixmaps/advanced.xpm \
pixmaps/audio.xpm \ pixmaps/audio.xpm \
pixmaps/codec.xpm \ pixmaps/codec.xpm \
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include "dialogs_provider.hpp"
#include <vlc/vout.h> #include <vlc/vout.h>
#include "qt4.hpp" #include "qt4.hpp"
#include "components/video_widget.hpp" #include "components/video_widget.hpp"
...@@ -30,9 +31,10 @@ static void *DoRequest( intf_thread_t *, vout_thread_t *, int*,int*, ...@@ -30,9 +31,10 @@ static void *DoRequest( intf_thread_t *, vout_thread_t *, int*,int*,
unsigned int *, unsigned int * ); unsigned int *, unsigned int * );
static void DoRelease( intf_thread_t *, void * ); static void DoRelease( intf_thread_t *, void * );
static int DoControl( intf_thread_t *, void *, int, va_list ); static int DoControl( intf_thread_t *, void *, int, va_list );
VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QWidget( NULL ), bool need_update;
VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ),
p_intf( _p_i ) p_intf( _p_i )
{ {
vlc_mutex_init( p_intf, &lock ); vlc_mutex_init( p_intf, &lock );
...@@ -43,8 +45,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QWidget( NULL ), ...@@ -43,8 +45,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QWidget( NULL ),
p_intf->p_sys->p_video = this; p_intf->p_sys->p_video = this;
p_vout = NULL; p_vout = NULL;
i_video_width = i_video_height = 1; setFrameStyle(QFrame::Panel | QFrame::Raised);
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
connect( DialogsProvider::getInstance(NULL)->fixed_timer,
SIGNAL( timeout() ), this, SLOT( update() ) );
need_update = false;
}
void VideoWidget::update()
{
if( need_update )
{
p_intf->p_sys->p_mi->resize( p_intf->p_sys->p_mi->sizeHint() );
need_update = false;
}
} }
VideoWidget::~VideoWidget() VideoWidget::~VideoWidget()
...@@ -72,7 +89,7 @@ VideoWidget::~VideoWidget() ...@@ -72,7 +89,7 @@ VideoWidget::~VideoWidget()
QSize VideoWidget::sizeHint() const QSize VideoWidget::sizeHint() const
{ {
return QSize( i_video_width, i_video_height ); return p_intf->p_sys->p_mi->videoSize;
} }
static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout, static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout,
...@@ -97,19 +114,21 @@ void *VideoWidget::Request( vout_thread_t *p_nvout, int *pi_x, int *pi_y, ...@@ -97,19 +114,21 @@ void *VideoWidget::Request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
p_intf->p_sys->p_mi->maximumSize().width(), p_intf->p_sys->p_mi->maximumSize().width(),
p_intf->p_sys->p_mi->maximumSize().height() ); p_intf->p_sys->p_mi->maximumSize().height() );
i_video_width = *pi_width; setMinimumSize( 1,1 );
i_video_height = *pi_height; p_intf->p_sys->p_mi->videoSize = QSize( *pi_width, *pi_height );
updateGeometry(); updateGeometry();
p_intf->p_sys->p_mi->setMinimumSize( need_update = true;
p_intf->p_sys->p_mi->i_saved_width, fprintf( stderr, "[After update] MI constraints %ix%i -> %ix%i - Fr %ix%i -> %ix%i (hint %ix%i)\n",
p_intf->p_sys->p_mi->i_saved_height );
p_intf->p_sys->p_mi->resize( p_intf->p_sys->p_mi->sizeHint() );
fprintf( stderr, "[After update] MI constraints %ix%i -> %ix%i\n",
p_intf->p_sys->p_mi->minimumSize().width(), p_intf->p_sys->p_mi->minimumSize().width(),
p_intf->p_sys->p_mi->minimumSize().height(), p_intf->p_sys->p_mi->minimumSize().height(),
p_intf->p_sys->p_mi->maximumSize().width(), p_intf->p_sys->p_mi->maximumSize().width(),
p_intf->p_sys->p_mi->maximumSize().height() ); p_intf->p_sys->p_mi->maximumSize().height(),
minimumSize().width(),
minimumSize().height(),
maximumSize().width(),
maximumSize().height(),
sizeHint().width(),sizeHint().height()
);
return (void*)winId(); return (void*)winId();
} }
...@@ -121,7 +140,10 @@ static void DoRelease( intf_thread_t *p_intf, void *p_win ) ...@@ -121,7 +140,10 @@ static void DoRelease( intf_thread_t *p_intf, void *p_win )
void VideoWidget::Release( void *p_win ) void VideoWidget::Release( void *p_win )
{ {
i_video_height = i_video_width = 1; if( !config_GetInt( p_intf, "qt-always-video" ) );
{
p_intf->p_sys->p_mi->videoSize = QSize ( 1,1 );
}
fprintf( stderr, "[Before R update] MI constraints %ix%i -> %ix%i\n", fprintf( stderr, "[Before R update] MI constraints %ix%i -> %ix%i\n",
p_intf->p_sys->p_mi->minimumSize().width(), p_intf->p_sys->p_mi->minimumSize().width(),
p_intf->p_sys->p_mi->minimumSize().height(), p_intf->p_sys->p_mi->minimumSize().height(),
...@@ -129,8 +151,11 @@ void VideoWidget::Release( void *p_win ) ...@@ -129,8 +151,11 @@ void VideoWidget::Release( void *p_win )
p_intf->p_sys->p_mi->maximumSize().height() ); p_intf->p_sys->p_mi->maximumSize().height() );
updateGeometry(); updateGeometry();
p_intf->p_sys->p_mi->setMinimumSize( p_intf->p_sys->p_mi->sizeHint() );
p_intf->p_sys->p_mi->resize( p_intf->p_sys->p_mi->sizeHint() ); // p_intf->p_sys->p_mi->setMinimumSize( 500,
// p_intf->p_sys->p_mi->addSize.height() );
if( !config_GetIntf( p_intf, "qt-always-video" ) )
need_update = true;
fprintf( stderr, "[After R update] MI constraints %ix%i -> %ix%i\n", fprintf( stderr, "[After R update] MI constraints %ix%i -> %ix%i\n",
p_intf->p_sys->p_mi->minimumSize().width(), p_intf->p_sys->p_mi->minimumSize().width(),
......
...@@ -27,9 +27,11 @@ ...@@ -27,9 +27,11 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <QWidget> #include <QWidget>
#include <QFrame>
class VideoWidget : public QWidget class VideoWidget : public QFrame
{ {
Q_OBJECT
public: public:
VideoWidget( intf_thread_t *); VideoWidget( intf_thread_t *);
virtual ~VideoWidget(); virtual ~VideoWidget();
...@@ -41,12 +43,13 @@ public: ...@@ -41,12 +43,13 @@ public:
void Release( void * ); void Release( void * );
int Control( void *, int, va_list ); int Control( void *, int, va_list );
int i_video_height, i_video_width; int i_video_height, i_video_width;
vout_thread_t *p_vout;
private: private:
QWidget *frame; QWidget *frame;
intf_thread_t *p_intf; intf_thread_t *p_intf;
vout_thread_t *p_vout;
vlc_mutex_t lock; vlc_mutex_t lock;
private slots:
void update();
}; };
#endif #endif
/*****************************************************************************
* interaction.cpp : Interaction stuff
****************************************************************************
* Copyright (C) 2000-2005 the VideoLAN team
* $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
#include "dialogs/interaction.hpp"
#include <vlc/intf.h>
InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
interaction_dialog_t *_p_dialog ) :
p_intf( _p_intf), p_dialog( _p_dialog )
{
if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
{
uiOkCancel = new Ui::OKCancelDialog;
uiOkCancel->setupUi( this );
uiOkCancel->description->setText( p_dialog->psz_description );
connect( uiOkCancel->okButton, SIGNAL( clicked() ),
this, SLOT( OK() ) );
connect( uiOkCancel->cancelButton, SIGNAL( clicked() ),
this, SLOT( cancel() ) );
}
else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
{
}
else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
{
}
else if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
{
}
else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL )
{
}
else
msg_Err( p_intf, "unknown dialog type" );
}
void InteractionDialog::Update()
{
}
InteractionDialog::~InteractionDialog()
{
}
void InteractionDialog::OK()
{
Finish( DIALOG_OK_YES, NULL, NULL );
}
void InteractionDialog::cancel()
{
Finish( DIALOG_CANCELLED, NULL, NULL );
}
void InteractionDialog::Finish( int i_ret, QString *r1, QString *r2 )
{
vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
p_dialog->i_status = ANSWERED_DIALOG;
p_dialog->i_return = i_ret;
hide();
vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
}
/*****************************************************************************
* interaction.hpp : Interaction dialogs
****************************************************************************
* Copyright (C) 2000-2005 the VideoLAN team
* $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
#ifndef _INTERACTION_H_
#define _INTERACTION_H_
#include <vlc/vlc.h>
#include <vlc_interaction.h>
#include <ui/okcanceldialog.h>
class InteractionDialog : public QWidget
{
Q_OBJECT
public:
InteractionDialog( intf_thread_t *, interaction_dialog_t * );
virtual ~InteractionDialog();
void Update();
private:
intf_thread_t *p_intf;
interaction_dialog_t *p_dialog;
Ui::OKCancelDialog *uiOkCancel;
void Finish( int, QString *, QString * );
private slots:
void OK();
void cancel();
};
#endif
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
#include "dialogs_provider.hpp"
#include "qt4.hpp" #include "qt4.hpp"
#include <QEvent> #include <QEvent>
#include "dialogs_provider.hpp"
#include "dialogs/playlist.hpp" #include "dialogs/playlist.hpp"
#include "dialogs/prefs_dialog.hpp" #include "dialogs/prefs_dialog.hpp"
#include "dialogs/streaminfo.hpp" #include "dialogs/streaminfo.hpp"
...@@ -33,8 +33,8 @@ DialogsProvider* DialogsProvider::instance = NULL; ...@@ -33,8 +33,8 @@ DialogsProvider* DialogsProvider::instance = NULL;
DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) : DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
QObject( NULL ), p_intf( _p_intf ) QObject( NULL ), p_intf( _p_intf )
{ {
idle_timer = new QTimer( this ); // idle_timer = new QTimer( this );
// idle_timer->start( 0 ); // idle_timer->start( 0 );
fixed_timer = new QTimer( this ); fixed_timer = new QTimer( this );
fixed_timer->start( 150 /* milliseconds */ ); fixed_timer->start( 150 /* milliseconds */ );
...@@ -69,12 +69,13 @@ void DialogsProvider::customEvent( QEvent *event ) ...@@ -69,12 +69,13 @@ void DialogsProvider::customEvent( QEvent *event )
popupMenu( de->i_dialog ); break; popupMenu( de->i_dialog ); break;
case INTF_DIALOG_FILEINFO: case INTF_DIALOG_FILEINFO:
streaminfoDialog(); break; streaminfoDialog(); break;
case INTF_DIALOG_VLM:
case INTF_DIALOG_INTERACTION: case INTF_DIALOG_INTERACTION:
doInteraction( de->p_arg ); break;
case INTF_DIALOG_VLM:
case INTF_DIALOG_BOOKMARKS: case INTF_DIALOG_BOOKMARKS:
case INTF_DIALOG_WIZARD: case INTF_DIALOG_WIZARD:
default: default:
fprintf( stderr, "Unimplemented dialog\n"); msg_Warn( p_intf, "unimplemented dialog\n" );
} }
} }
} }
...@@ -88,6 +89,36 @@ void DialogsProvider::openDialog( int i_dialog ) ...@@ -88,6 +89,36 @@ void DialogsProvider::openDialog( int i_dialog )
{ {
} }
void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
{
InteractionDialog *qdialog;
interaction_dialog_t *p_dialog = p_arg->p_dialog;
switch( p_dialog->i_action )
{
case INTERACT_NEW:
qdialog = new InteractionDialog( p_intf, p_dialog );
p_dialog->p_private = (void*)qdialog;
qdialog->show();
break;
case INTERACT_UPDATE:
qdialog = (InteractionDialog*)(p_dialog->p_private);
if( qdialog)
qdialog->Update();
break;
case INTERACT_HIDE:
qdialog = (InteractionDialog*)(p_dialog->p_private);
if( qdialog )
qdialog->hide();
p_dialog->i_status = HIDDEN_DIALOG;
break;
case INTERACT_DESTROY:
qdialog = (InteractionDialog*)(p_dialog->p_private);
delete qdialog;
p_dialog->i_status = DESTROYED_DIALOG;
break;
}
}
void DialogsProvider::streaminfoDialog() void DialogsProvider::streaminfoDialog()
{ {
StreamInfoDialog::getInstance( p_intf, true )->toggleVisible(); StreamInfoDialog::getInstance( p_intf, true )->toggleVisible();
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <QTimer> #include <QTimer>
#include <QApplication> #include <QApplication>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h>
#include "dialogs/interaction.hpp"
class QEvent; class QEvent;
...@@ -57,6 +59,7 @@ public slots: ...@@ -57,6 +59,7 @@ public slots:
void messagesDialog(); void messagesDialog();
void openDialog( int ); void openDialog( int );
void popupMenu( int ); void popupMenu( int );
void doInteraction( intf_dialog_args_t * );
}; };
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include <assert.h> #include <assert.h>
#include <QPushButton> #include <QPushButton>
static int InteractCallback( vlc_object_t *, const char *, vlc_value_t,
vlc_value_t, void *);
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{ {
/* All UI stuff */ /* All UI stuff */
...@@ -54,16 +57,43 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -54,16 +57,43 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) ); ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
ui.volHighLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) ); ui.volHighLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) );
//QVLCMenu::createMenuBar();
resize (500, 131 );
fprintf( stderr, "Before creating the video widget, size is %ix%i\n", size().width(), size().height() );
// if( config_GetInt( p_intf, "embedded" ) ) // if( config_GetInt( p_intf, "embedded" ) )
{ {
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
videoWidget->resize( 1,1 ); if( config_GetInt( p_intf, "qt-always-video" ) )
{
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( "MainWindow" );
videoSize = settings.value( "videoSize", QSize( 200, 200 ) ).
toSize();
}
else
videoSize = QSize( 1,1 );
videoWidget->resize( videoSize );
ui.vboxLayout->insertWidget( 0, videoWidget ); ui.vboxLayout->insertWidget( 0, videoWidget );
} }
fprintf( stderr, "Margin : %i\n",ui.vboxLayout->margin() );
readSettings( "MainWindow" );
readSettings( "MainWindow" , QSize( 500, 131) ); addSize = QSize( ui.vboxLayout->margin() * 2, 131 );
if( config_GetInt( p_intf, "qt-always-video" ) )
mainSize = videoSize + addSize;
else
mainSize = QSize( 500,131 );
resize( 500,131 );
resize( mainSize );
mainSize = size();
//QVLCMenu::createMenuBar(); fprintf( stderr, "Size is %ix%i - Video %ix%i\n", mainSize.width(), mainSize.height(), videoSize.width(), videoSize.height() );
fprintf( stderr, "Additional size around video %ix%i", addSize.width(), addSize.height() );
setMinimumSize( 500, addSize.height() );
/* Init input manager */ /* Init input manager */
MainInputManager::getInstance( p_intf ); MainInputManager::getInstance( p_intf );
...@@ -91,17 +121,39 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -91,17 +121,39 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
connect( ui.playlistButton, SLOT(clicked() ), connect( ui.playlistButton, SLOT(clicked() ),
DialogsProvider::getInstance( p_intf ), SLOT( playlistDialog() ) ); DialogsProvider::getInstance( p_intf ), SLOT( playlistDialog() ) );
var_Create( p_intf, "interaction", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "interaction", InteractCallback, this );
p_intf->b_interaction = VLC_TRUE;
} }
MainInterface::~MainInterface() MainInterface::~MainInterface()
{ {
writeSettings( "MainWindow" );
if( config_GetInt( p_intf, "qt-always-video" ) )
{
QSettings s("VideoLAN", "VLC" );
s.beginGroup( "MainWindow" );
s.setValue( "videoSize", videoSize );
s.endGroup();
}
p_intf->b_interaction = VLC_FALSE;
var_DelCallback( p_intf, "interaction", InteractCallback, this );
} }
QSize MainInterface::sizeHint() const void MainInterface::resizeEvent( QResizeEvent *e )
{ {
int i_width = __MAX( i_saved_width, p_intf->p_sys->p_video->i_video_width ); fprintf( stderr, "Resized to %ix%i\n", e->size().width(), e->size().height() );
return QSize( i_width, i_saved_height +
p_intf->p_sys->p_video->i_video_height ); fprintf( stderr, "MI constraints %ix%i -> %ix%i\n",
p_intf->p_sys->p_mi->minimumSize().width(),
p_intf->p_sys->p_mi->minimumSize().height(),
p_intf->p_sys->p_mi->maximumSize().width(),
p_intf->p_sys->p_mi->maximumSize().height() );
videoSize.setHeight( e->size().height() - addSize.height() );
videoSize.setWidth( e->size().width() - addSize.width() );
p_intf->p_sys->p_video->updateGeometry() ;
} }
void MainInterface::stop() void MainInterface::stop()
...@@ -144,3 +196,17 @@ void MainInterface::closeEvent( QCloseEvent *e ) ...@@ -144,3 +196,17 @@ void MainInterface::closeEvent( QCloseEvent *e )
hide(); hide();
p_intf->b_die = VLC_TRUE; p_intf->b_die = VLC_TRUE;
} }
static int InteractCallback( vlc_object_t *p_this,
const char *psz_var, vlc_value_t old_val,
vlc_value_t new_val, void *param )
{
intf_dialog_args_t *p_arg = new intf_dialog_args_t;
p_arg->p_dialog = (interaction_dialog_t *)(new_val.p_address);
MainInterface *p_interface = (MainInterface*)param;
DialogEvent *event = new DialogEvent( INTF_DIALOG_INTERACTION, 0, p_arg );
QApplication::postEvent( DialogsProvider::getInstance( NULL ),
static_cast<QEvent*>(event) );
return VLC_SUCCESS;
}
...@@ -39,9 +39,9 @@ public: ...@@ -39,9 +39,9 @@ public:
MainInterface( intf_thread_t *); MainInterface( intf_thread_t *);
virtual ~MainInterface(); virtual ~MainInterface();
virtual QSize sizeHint() const; void resizeEvent( QResizeEvent * );
int i_saved_width, i_saved_height; QSize videoSize, addSize;
protected: protected:
void closeEvent( QCloseEvent *); void closeEvent( QCloseEvent *);
......
...@@ -52,6 +52,7 @@ vlc_module_begin(); ...@@ -52,6 +52,7 @@ vlc_module_begin();
add_submodule(); add_submodule();
set_description( "Dialogs provider" ); set_description( "Dialogs provider" );
set_capability( "dialogs provider", 51 ); set_capability( "dialogs provider", 51 );
add_bool( "qt-always-video", VLC_FALSE, NULL, "", "", VLC_TRUE );
set_callbacks( OpenDialogs, Close ); set_callbacks( OpenDialogs, Close );
vlc_module_end(); vlc_module_end();
...@@ -140,6 +141,7 @@ static void Init( intf_thread_t *p_intf ) ...@@ -140,6 +141,7 @@ static void Init( intf_thread_t *p_intf )
app->setQuitOnLastWindowClosed( false ); app->setQuitOnLastWindowClosed( false );
app->exec(); app->exec();
delete p_intf->p_sys->p_mi;
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<exportmacro></exportmacro> <exportmacro></exportmacro>
<class>MainInterfaceUI</class> <class>MainInterfaceUI</class>
<widget class="QWidget" name="MainInterfaceUI" > <widget class="QWidget" name="MainInterfaceUI" >
<property name="geometry" > <!-- <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>444</width> <width>444</width>
<height>80</height> <height>80</height>
</rect> </rect>
</property> </property> -->
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy>
<hsizetype>0</hsizetype> <hsizetype>0</hsizetype>
......
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>OKCancelDialog</class>
<widget class="QWidget" name="OKCancelDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>122</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="description" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okButton" >
<property name="text" >
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
...@@ -75,6 +75,7 @@ protected: ...@@ -75,6 +75,7 @@ protected:
} }
void writeSettings( QString name ) void writeSettings( QString name )
{ {
fprintf( stderr, "save\n" );
QSettings settings( "VideoLAN", "VLC" ); QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name ); settings.beginGroup( name );
settings.setValue ("size", size() ); settings.setValue ("size", size() );
...@@ -100,8 +101,16 @@ protected: ...@@ -100,8 +101,16 @@ protected:
QSettings settings( "VideoLAN", "VLC" ); QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name ); settings.beginGroup( name );
mainSize = settings.value( "size", defSize ).toSize(); mainSize = settings.value( "size", defSize ).toSize();
resize( mainSize ); QPoint npos = settings.value( "pos", QPoint( 0,0 ) ).toPoint();
move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() ); if( npos.x() > 0 )
move( npos );
settings.endGroup();
}
void readSettings( QString name )
{
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name );
mainSize = settings.value( "size", QSize( 0,0 ) ).toSize();
settings.endGroup(); settings.endGroup();
} }
void writeSettings( QString name ) void writeSettings( QString name )
......
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