Commit 23a3d91d authored by Clément Stenac's avatar Clément Stenac

Don't laugh

parent 3c9aa734
...@@ -31,16 +31,17 @@ ...@@ -31,16 +31,17 @@
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{ {
/* Init UI */ /* Init UI */
slider = new InputSlider( Qt::Horizontal, this ); setWindowTitle( _("VLC media player") );
ui.setupUi( this );
slider = new InputSlider( Qt::Horizontal, ui.sliderBox );
QVBoxLayout *box_layout = new QVBoxLayout();
box_layout->addWidget( slider );
ui.sliderBox->setLayout( box_layout );
/* Init input manager */ /* Init input manager */
p_input = NULL; p_input = NULL;
main_input_manager = new InputManager( this, p_intf ); main_input_manager = new InputManager( this, p_intf );
// QPushButton *button = new QPushButton( "prefs", this );
// connect( button, SIGNAL( clicked() ),
// DialogsProvider::getInstance(p_intf), SLOT( prefsDialog() ) );
/* Get timer updates */ /* Get timer updates */
connect( DialogsProvider::getInstance(NULL)->fixed_timer, connect( DialogsProvider::getInstance(NULL)->fixed_timer,
SIGNAL( timeout() ), this, SLOT(updateOnTimer() ) ); SIGNAL( timeout() ), this, SLOT(updateOnTimer() ) );
...@@ -48,19 +49,77 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -48,19 +49,77 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
connect( this, SIGNAL( inputChanged( input_thread_t * ) ), connect( this, SIGNAL( inputChanged( input_thread_t * ) ),
main_input_manager, SLOT( setInput( input_thread_t * ) ) ); main_input_manager, SLOT( setInput( input_thread_t * ) ) );
/* Connect the slider and the input manager (both ways) */ /* Connect the input manager to the GUI elements it manages */
connect( main_input_manager, SIGNAL(positionUpdated( float, int, int ) ), connect( main_input_manager, SIGNAL(positionUpdated( float, int, int ) ),
slider, SLOT( setPosition( float,int, int ) ) ); slider, SLOT( setPosition( float,int, int ) ) );
connect( slider, SIGNAL( sliderDragged( float ) ), connect( slider, SIGNAL( sliderDragged( float ) ),
main_input_manager, SLOT( sliderUpdate( float ) ) ); main_input_manager, SLOT( sliderUpdate( float ) ) );
connect( main_input_manager, SIGNAL( positionUpdated( float, int, int ) ),
this, SLOT( setDisplay( float, int, int ) ) );
/* Connect the display and the input manager */ /* Actions */
connect( ui.playButton, SLOT( clicked() ), this, SLOT( play() ) );
connect( ui.stopButton, SLOT( clicked() ), this, SLOT( stop() ) );
connect( ui.nextButton, SLOT( clicked() ), this, SLOT( next() ) );
connect( ui.prevButton, SLOT( clicked() ), this, SLOT( prev() ) );
} }
MainInterface::~MainInterface() MainInterface::~MainInterface()
{ {
} }
void MainInterface::stop()
{
/// \todo store playlist globally
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( !p_playlist ) return;
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
void MainInterface::play()
{
/// \todo store playlist globally
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( !p_playlist ) return;
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
void MainInterface::prev()
{
/// \todo store playlist globally
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( !p_playlist ) return;
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
}
void MainInterface::next()
{
/// \todo store playlist globally
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( !p_playlist ) return;
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
}
void MainInterface::setDisplay( float pos, int time, int length )
{
char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
secstotimestr( psz_length, length );
secstotimestr( psz_time, time );
QString title;
title.sprintf( "%s/%s", psz_time, psz_length );
ui.sliderBox->setTitle( title );
}
void MainInterface::updateOnTimer() void MainInterface::updateOnTimer()
{ {
if( p_intf->b_die ) if( p_intf->b_die )
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define _MAIN_INTERFACE_H_ #define _MAIN_INTERFACE_H_
#include <vlc/intf.h> #include <vlc/intf.h>
#include "ui/main_interface.h"
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
class InputManager; class InputManager;
...@@ -43,8 +44,15 @@ private: ...@@ -43,8 +44,15 @@ private:
InputSlider *slider; InputSlider *slider;
/// Main input associated to the playlist /// Main input associated to the playlist
input_thread_t *p_input; input_thread_t *p_input;
Ui::MainInterfaceUI ui;
private slots: private slots:
void setDisplay( float, int, int );
void updateOnTimer(); void updateOnTimer();
void play();
void stop();
void prev();
void next();
signals: signals:
void inputChanged( input_thread_t *); void inputChanged( input_thread_t *);
}; };
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>560</width> <width>450</width>
<height>300</height> <height>80</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
<string>Form</string> <string>VLC media player</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" > <property name="margin" >
...@@ -28,26 +28,40 @@ ...@@ -28,26 +28,40 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QFrame" name="sliderFrame" /> <widget class="QGroupBox" name="sliderBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>0:00:00/0:00:00</string>
</property>
</widget>
</item> </item>
<item> <item>
<spacer> <widget class="QFrame" name="frame" >
<property name="orientation" > <property name="sizePolicy" >
<enum>Qt::Horizontal</enum> <sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="sizeHint" > <property name="frameShape" >
<size> <enum>QFrame::StyledPanel</enum>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> <property name="frameShadow" >
</item> <enum>QFrame::Raised</enum>
<item> </property>
<widget class="QFrame" name="volumeFrame" /> </widget>
</item> </item>
</layout> </layout>
</item> </item>
...@@ -61,13 +75,29 @@ ...@@ -61,13 +75,29 @@
</property> </property>
<item> <item>
<widget class="QPushButton" name="prevButton" > <widget class="QPushButton" name="prevButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" > <property name="text" >
<string>Prev</string> <string>Prev</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="playButton_2" > <widget class="QPushButton" name="playButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" > <property name="text" >
<string>Play</string> <string>Play</string>
</property> </property>
...@@ -75,6 +105,14 @@ ...@@ -75,6 +105,14 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="stopButton" > <widget class="QPushButton" name="stopButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" > <property name="text" >
<string>Stop</string> <string>Stop</string>
</property> </property>
...@@ -82,6 +120,14 @@ ...@@ -82,6 +120,14 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="nextButton" > <widget class="QPushButton" name="nextButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" > <property name="text" >
<string>Next</string> <string>Next</string>
</property> </property>
......
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