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 */
{
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 */
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 );
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() ) );
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 )
<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" >
<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>
</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>
</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>
</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>