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

Don't laugh

parent 3c9aa734
......@@ -52,8 +52,8 @@ void InputManager::update()
if( p_input->b_dead )
{
emit positionUpdated( 0.0, 0, 0 );
emit navigationChanged( 0 );
emit statusChanged( 0 ); // 0 = STOPPED, 1 = PAUSE, 2 = PLAY
emit navigationChanged( 0 );
emit statusChanged( 0 ); // 0 = STOPPED, 1 = PAUSE, 2 = PLAY
}
/* Update position */
......@@ -71,14 +71,14 @@ void InputManager::update()
{
vlc_value_t val;
var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int > 0 )
emit navigationChanged( 1 ); // 1 = chapter, 2 = title, 3 = NO
else
emit navigationChanged( 2 );
if( val.i_int > 0 )
emit navigationChanged( 1 ); // 1 = chapter, 2 = title, 3 = NO
else
emit navigationChanged( 2 );
}
else
{
emit navigationChanged( 0 );
emit navigationChanged( 0 );
}
/* Update text */
......@@ -87,13 +87,13 @@ void InputManager::update()
p_input->input.p_item->p_meta->psz_nowplaying &&
*p_input->input.p_item->p_meta->psz_nowplaying )
{
text.sprintf( "%s - %s",
p_input->input.p_item->p_meta->psz_nowplaying,
p_input->input.p_item->psz_name );
text.sprintf( "%s - %s",
p_input->input.p_item->p_meta->psz_nowplaying,
p_input->input.p_item->psz_name );
}
else
{
text.sprintf( "%s", p_input->input.p_item->psz_name );
text.sprintf( "%s", p_input->input.p_item->psz_name );
}
emit nameChanged( text );
......
......@@ -31,16 +31,17 @@
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
/* 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 */
p_input = NULL;
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 */
connect( DialogsProvider::getInstance(NULL)->fixed_timer,
SIGNAL( timeout() ), this, SLOT(updateOnTimer() ) );
......@@ -48,19 +49,77 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
connect( this, SIGNAL( inputChanged( 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 ) ),
slider, SLOT( setPosition( float,int, int ) ) );
connect( slider, SIGNAL( sliderDragged( 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()
{
}
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()
{
if( p_intf->b_die )
......
......@@ -24,6 +24,7 @@
#define _MAIN_INTERFACE_H_
#include <vlc/intf.h>
#include "ui/main_interface.h"
#include "util/qvlcframe.hpp"
class InputManager;
......@@ -43,8 +44,15 @@ private:
InputSlider *slider;
/// Main input associated to the playlist
input_thread_t *p_input;
Ui::MainInterfaceUI ui;
private slots:
void setDisplay( float, int, int );
void updateOnTimer();
void play();
void stop();
void prev();
void next();
signals:
void inputChanged( input_thread_t *);
};
......
......@@ -8,12 +8,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>300</height>
<width>450</width>
<height>80</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
<string>VLC media player</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
......@@ -28,26 +28,40 @@
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
<number>0</number>
</property>
<item>
<widget class="QFrame" name="sliderFrame" />
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<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="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
<property name="title" >
<string>0:00:00/0:00:00</string>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QFrame" name="volumeFrame" />
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</item>
......@@ -61,13 +75,29 @@
</property>
<item>
<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" >
<string>Prev</string>
</property>
</widget>
</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" >
<string>Play</string>
</property>
......@@ -75,6 +105,14 @@
</item>
<item>
<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" >
<string>Stop</string>
</property>
......@@ -82,6 +120,14 @@
</item>
<item>
<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" >
<string>Next</string>
</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