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 \
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)
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
dialogs/playlist.cpp \
dialogs/prefs_dialog.cpp \
dialogs/streaminfo.cpp \
+ dialogs/interaction.cpp \
components/infopanels.cpp \
components/preferences_widgets.cpp \
components/preferences.cpp \
dialogs/playlist.hpp \
dialogs/streaminfo.hpp \
dialogs/prefs_dialog.hpp \
+ dialogs/interaction.cpp \
components/infopanels.hpp \
components/preferences_widgets.hpp \
components/preferences.hpp \
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 \
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#include "dialogs_provider.hpp"
#include <vlc/vout.h>
#include "qt4.hpp"
#include "components/video_widget.hpp"
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 );
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()
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,
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();
}
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(),
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(),
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <QWidget>
+#include <QFrame>
-class VideoWidget : public QWidget
+class VideoWidget : public QFrame
{
+ Q_OBJECT
public:
VideoWidget( intf_thread_t *);
virtual ~VideoWidget();
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
--- /dev/null
+/*****************************************************************************
+ * 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 );
+}
--- /dev/null
+/*****************************************************************************
+ * 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
* 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 <QEvent>
+#include "dialogs_provider.hpp"
#include "dialogs/playlist.hpp"
#include "dialogs/prefs_dialog.hpp"
#include "dialogs/streaminfo.hpp"
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 */ );
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" );
}
}
}
{
}
+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();
#include <QTimer>
#include <QApplication>
#include <vlc/vlc.h>
+#include <vlc/intf.h>
+#include "dialogs/interaction.hpp"
class QEvent;
void messagesDialog();
void openDialog( int );
void popupMenu( int );
+ void doInteraction( intf_dialog_args_t * );
};
#include <assert.h>
#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 )
{
/* All UI stuff */
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 );
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()
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<QEvent*>(event) );
+ return VLC_SUCCESS;
+}
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 *);
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();
app->setQuitOnLastWindowClosed( false );
app->exec();
+ delete p_intf->p_sys->p_mi;
}
/*****************************************************************************
<exportmacro></exportmacro>
<class>MainInterfaceUI</class>
<widget class="QWidget" name="MainInterfaceUI" >
- <property name="geometry" >
+<!-- <property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>444</width>
<height>80</height>
</rect>
- </property>
+ </property> -->
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
--- /dev/null
+<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>
}
void writeSettings( QString name )
{
+ fprintf( stderr, "save\n" );
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name );
settings.setValue ("size", size() );
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 )