From: Clément Stenac Date: Sat, 8 Jul 2006 11:16:46 +0000 (+0000) Subject: Improve embedded video output X-Git-Tag: 0.9.0-test0~10901 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8a473ffa6e4ab4d51024fdb896133a45cdab4373;p=vlc Improve embedded video output Skeleton for interaction Fix window settings save --- diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am index 74dc93b2a8..1d4802c530 100644 --- a/modules/gui/qt4/Modules.am +++ b/modules/gui/qt4/Modules.am @@ -11,7 +11,8 @@ 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) TOMOC = main_interface \ @@ -21,11 +22,13 @@ TOMOC = main_interface \ dialogs/playlist \ dialogs/prefs_dialog \ dialogs/streaminfo \ + dialogs/interaction \ components/infopanels \ components/preferences_widgets \ components/preferences \ components/open \ components/playlist/panels \ + components/video_widget \ util/input_slider MOCCPP = $(TOMOC:%=%.moc.cpp) @@ -37,11 +40,13 @@ nodist_SOURCES_qt4 = \ dialogs/playlist.moc.cpp \ dialogs/streaminfo.moc.cpp \ dialogs/prefs_dialog.moc.cpp \ + dialogs/interaction.moc.cpp \ components/infopanels.moc.cpp \ components/preferences_widgets.moc.cpp \ components/preferences.moc.cpp \ components/open.moc.cpp \ components/playlist/panels.moc.cpp \ + components/video_widget.moc.cpp \ util/input_slider.moc.cpp \ resources.cpp @@ -72,6 +77,7 @@ SOURCES_qt4 = qt4.cpp \ dialogs/playlist.cpp \ dialogs/prefs_dialog.cpp \ dialogs/streaminfo.cpp \ + dialogs/interaction.cpp \ components/infopanels.cpp \ components/preferences_widgets.cpp \ components/preferences.cpp \ @@ -91,6 +97,7 @@ EXTRA_DIST += \ dialogs/playlist.hpp \ dialogs/streaminfo.hpp \ dialogs/prefs_dialog.hpp \ + dialogs/interaction.cpp \ components/infopanels.hpp \ components/preferences_widgets.hpp \ components/preferences.hpp \ @@ -99,6 +106,9 @@ EXTRA_DIST += \ components/video_widget.hpp \ util/input_slider.hpp \ ui/input_stats.ui \ + ui/file_open.ui \ + ui/main_interface.ui \ + ui/okcanceldialog.ui \ pixmaps/advanced.xpm \ pixmaps/audio.xpm \ pixmaps/codec.xpm \ diff --git a/modules/gui/qt4/components/video_widget.cpp b/modules/gui/qt4/components/video_widget.cpp index 9506c4abb6..34e177a076 100644 --- a/modules/gui/qt4/components/video_widget.cpp +++ b/modules/gui/qt4/components/video_widget.cpp @@ -21,6 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#include "dialogs_provider.hpp" #include #include "qt4.hpp" #include "components/video_widget.hpp" @@ -30,9 +31,10 @@ static void *DoRequest( intf_thread_t *, vout_thread_t *, int*,int*, unsigned int *, unsigned int * ); static void DoRelease( intf_thread_t *, void * ); 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 ) { vlc_mutex_init( p_intf, &lock ); @@ -43,8 +45,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QWidget( NULL ), p_intf->p_sys->p_video = this; p_vout = NULL; - i_video_width = i_video_height = 1; + setFrameStyle(QFrame::Panel | QFrame::Raised); + 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() @@ -72,7 +89,7 @@ VideoWidget::~VideoWidget() 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, @@ -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().height() ); - i_video_width = *pi_width; - i_video_height = *pi_height; + setMinimumSize( 1,1 ); + p_intf->p_sys->p_mi->videoSize = QSize( *pi_width, *pi_height ); updateGeometry(); - p_intf->p_sys->p_mi->setMinimumSize( - p_intf->p_sys->p_mi->i_saved_width, - 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", + need_update = true; + 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->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() ); + p_intf->p_sys->p_mi->maximumSize().height(), + minimumSize().width(), + minimumSize().height(), + maximumSize().width(), + maximumSize().height(), + sizeHint().width(),sizeHint().height() + ); return (void*)winId(); } @@ -121,7 +140,10 @@ static void DoRelease( intf_thread_t *p_intf, 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", p_intf->p_sys->p_mi->minimumSize().width(), p_intf->p_sys->p_mi->minimumSize().height(), @@ -129,8 +151,11 @@ void VideoWidget::Release( void *p_win ) p_intf->p_sys->p_mi->maximumSize().height() ); 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", p_intf->p_sys->p_mi->minimumSize().width(), diff --git a/modules/gui/qt4/components/video_widget.hpp b/modules/gui/qt4/components/video_widget.hpp index 6a9888a592..b8cda0753a 100644 --- a/modules/gui/qt4/components/video_widget.hpp +++ b/modules/gui/qt4/components/video_widget.hpp @@ -27,9 +27,11 @@ #include #include #include +#include -class VideoWidget : public QWidget +class VideoWidget : public QFrame { + Q_OBJECT public: VideoWidget( intf_thread_t *); virtual ~VideoWidget(); @@ -41,12 +43,13 @@ public: void Release( void * ); int Control( void *, int, va_list ); int i_video_height, i_video_width; + vout_thread_t *p_vout; private: QWidget *frame; intf_thread_t *p_intf; - vout_thread_t *p_vout; vlc_mutex_t lock; - +private slots: + void update(); }; #endif diff --git a/modules/gui/qt4/dialogs/interaction.cpp b/modules/gui/qt4/dialogs/interaction.cpp new file mode 100644 index 0000000000..914c83e8b8 --- /dev/null +++ b/modules/gui/qt4/dialogs/interaction.cpp @@ -0,0 +1,85 @@ +/***************************************************************************** + * 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 + * + * 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 + +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 ); +} diff --git a/modules/gui/qt4/dialogs/interaction.hpp b/modules/gui/qt4/dialogs/interaction.hpp new file mode 100644 index 0000000000..9ef4406dde --- /dev/null +++ b/modules/gui/qt4/dialogs/interaction.hpp @@ -0,0 +1,50 @@ +/***************************************************************************** + * 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 + * + * 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 +#include +#include + +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 diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index f59c0d18f7..bbdfc83c0a 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -20,9 +20,9 @@ * 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_provider.hpp" #include "qt4.hpp" #include +#include "dialogs_provider.hpp" #include "dialogs/playlist.hpp" #include "dialogs/prefs_dialog.hpp" #include "dialogs/streaminfo.hpp" @@ -33,8 +33,8 @@ DialogsProvider* DialogsProvider::instance = NULL; DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) : QObject( NULL ), p_intf( _p_intf ) { - idle_timer = new QTimer( this ); - // idle_timer->start( 0 ); +// idle_timer = new QTimer( this ); +// idle_timer->start( 0 ); fixed_timer = new QTimer( this ); fixed_timer->start( 150 /* milliseconds */ ); @@ -69,12 +69,13 @@ void DialogsProvider::customEvent( QEvent *event ) popupMenu( de->i_dialog ); break; case INTF_DIALOG_FILEINFO: streaminfoDialog(); break; - case INTF_DIALOG_VLM: case INTF_DIALOG_INTERACTION: + doInteraction( de->p_arg ); break; + case INTF_DIALOG_VLM: case INTF_DIALOG_BOOKMARKS: case INTF_DIALOG_WIZARD: default: - fprintf( stderr, "Unimplemented dialog\n"); + msg_Warn( p_intf, "unimplemented dialog\n" ); } } } @@ -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() { StreamInfoDialog::getInstance( p_intf, true )->toggleVisible(); diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp index 33d2103ee1..057dcf03f3 100644 --- a/modules/gui/qt4/dialogs_provider.hpp +++ b/modules/gui/qt4/dialogs_provider.hpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include "dialogs/interaction.hpp" class QEvent; @@ -57,6 +59,7 @@ public slots: void messagesDialog(); void openDialog( int ); void popupMenu( int ); + void doInteraction( intf_dialog_args_t * ); }; diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 5efd4c1db8..5bad4e13b5 100644 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -31,6 +31,9 @@ #include #include +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 ) { /* All UI stuff */ @@ -54,16 +57,43 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.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" ) ) + { 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 ); } + 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 */ MainInputManager::getInstance( p_intf ); @@ -91,17 +121,39 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) connect( ui.playlistButton, SLOT(clicked() ), 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() { + 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 ); - return QSize( i_width, i_saved_height + - p_intf->p_sys->p_video->i_video_height ); + fprintf( stderr, "Resized to %ix%i\n", e->size().width(), e->size().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() @@ -144,3 +196,17 @@ void MainInterface::closeEvent( QCloseEvent *e ) hide(); 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(event) ); + return VLC_SUCCESS; +} diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp index 5eb9437988..3154ab80ca 100644 --- a/modules/gui/qt4/main_interface.hpp +++ b/modules/gui/qt4/main_interface.hpp @@ -39,9 +39,9 @@ public: MainInterface( intf_thread_t *); virtual ~MainInterface(); - virtual QSize sizeHint() const; + void resizeEvent( QResizeEvent * ); - int i_saved_width, i_saved_height; + QSize videoSize, addSize; protected: void closeEvent( QCloseEvent *); diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp index 2c8d10cfca..31ba95384f 100644 --- a/modules/gui/qt4/qt4.cpp +++ b/modules/gui/qt4/qt4.cpp @@ -52,6 +52,7 @@ vlc_module_begin(); add_submodule(); set_description( "Dialogs provider" ); set_capability( "dialogs provider", 51 ); + add_bool( "qt-always-video", VLC_FALSE, NULL, "", "", VLC_TRUE ); set_callbacks( OpenDialogs, Close ); vlc_module_end(); @@ -140,6 +141,7 @@ static void Init( intf_thread_t *p_intf ) app->setQuitOnLastWindowClosed( false ); app->exec(); + delete p_intf->p_sys->p_mi; } /***************************************************************************** diff --git a/modules/gui/qt4/ui/main_interface.ui b/modules/gui/qt4/ui/main_interface.ui index 0bda8e4e0c..e4145c4bad 100644 --- a/modules/gui/qt4/ui/main_interface.ui +++ b/modules/gui/qt4/ui/main_interface.ui @@ -4,14 +4,14 @@ MainInterfaceUI - + 0 diff --git a/modules/gui/qt4/ui/okcanceldialog.ui b/modules/gui/qt4/ui/okcanceldialog.ui new file mode 100644 index 0000000000..966b65c7ee --- /dev/null +++ b/modules/gui/qt4/ui/okcanceldialog.ui @@ -0,0 +1,71 @@ + + + + + OKCancelDialog + + + + 0 + 0 + 400 + 122 + + + + + 9 + + + 6 + + + + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + diff --git a/modules/gui/qt4/util/qvlcframe.hpp b/modules/gui/qt4/util/qvlcframe.hpp index 04d9d56b3f..fa86c63093 100644 --- a/modules/gui/qt4/util/qvlcframe.hpp +++ b/modules/gui/qt4/util/qvlcframe.hpp @@ -75,6 +75,7 @@ protected: } void writeSettings( QString name ) { + fprintf( stderr, "save\n" ); QSettings settings( "VideoLAN", "VLC" ); settings.beginGroup( name ); settings.setValue ("size", size() ); @@ -100,8 +101,16 @@ protected: QSettings settings( "VideoLAN", "VLC" ); settings.beginGroup( name ); mainSize = settings.value( "size", defSize ).toSize(); - resize( mainSize ); - move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() ); + QPoint npos = 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(); } void writeSettings( QString name )