Commit 5c853cf5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - MainInterface, implement the feature request to show elapsed/remaining...

Qt4 - MainInterface, implement the feature request to show elapsed/remaining time in the statusBar() through a menu.

parent 118b052d
...@@ -134,6 +134,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -134,6 +134,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/** /**
* TODO: do we add a label for the current Volume ? * TODO: do we add a label for the current Volume ?
**/ **/
b_remainingTime = false;
timeLabel = new QLabel; timeLabel = new QLabel;
nameLabel = new QLabel; nameLabel = new QLabel;
speedLabel = new QLabel( "1.0x" ); speedLabel = new QLabel( "1.0x" );
...@@ -144,6 +145,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -144,6 +145,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
statusBar()->addPermanentWidget( timeLabel, 2 ); statusBar()->addPermanentWidget( timeLabel, 2 );
speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu ); speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu ); timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
CONNECT( speedLabel, customContextMenuRequested( QPoint ), CONNECT( speedLabel, customContextMenuRequested( QPoint ),
this, showSpeedMenu( QPoint ) ); this, showSpeedMenu( QPoint ) );
CONNECT( timeLabel, customContextMenuRequested( QPoint ), CONNECT( timeLabel, customContextMenuRequested( QPoint ),
...@@ -400,7 +402,8 @@ void MainInterface::showSpeedMenu( QPoint pos ) ...@@ -400,7 +402,8 @@ void MainInterface::showSpeedMenu( QPoint pos )
void MainInterface::showTimeMenu( QPoint pos ) void MainInterface::showTimeMenu( QPoint pos )
{ {
QMenu menu( this ); QMenu menu( this );
menu.addAction( "Not Implemented Yet" ); menu.addAction( qtr("Elapsed Time") , this, SLOT( setElapsedTime() ) );
menu.addAction( qtr("Remaining Time") , this, SLOT( setRemainTime() ) );
menu.exec( QCursor::pos() ); menu.exec( QCursor::pos() );
} }
...@@ -655,12 +658,20 @@ void MainInterface::setDisplay( float pos, int time, int length ) ...@@ -655,12 +658,20 @@ void MainInterface::setDisplay( float pos, int time, int length )
{ {
char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE]; char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
secstotimestr( psz_length, length ); secstotimestr( psz_length, length );
secstotimestr( psz_time, time ); secstotimestr( psz_time, b_remainingTime ? length - time : time );
QString title; QString title; title.sprintf( "%s/%s", psz_time, psz_length );
title.sprintf( "%s/%s", psz_time, psz_length ); if( b_remainingTime ) timeLabel->setText( " -"+title+" " );
timeLabel->setText( " "+title+" " ); else timeLabel->setText( " "+title+" " );
}
void MainInterface::toggleTimeDisplay( bool b_remain = false )
{
b_remainingTime = ( b_remainingTime ? false : true );
} }
void MainInterface::setElapsedTime(){ b_remainingTime = false; }
void MainInterface::setRemainTime(){ b_remainingTime = true; }
void MainInterface::setName( QString name ) void MainInterface::setName( QString name )
{ {
input_name = name; input_name = name;
......
...@@ -114,6 +114,8 @@ private: ...@@ -114,6 +114,8 @@ private:
QLabel *speedLabel; QLabel *speedLabel;
QLabel *nameLabel; QLabel *nameLabel;
bool b_remainingTime;
void customEvent( QEvent *); void customEvent( QEvent *);
public slots: public slots:
void undockPlaylist(); void undockPlaylist();
...@@ -127,6 +129,9 @@ private slots: ...@@ -127,6 +129,9 @@ private slots:
void setName( QString ); void setName( QString );
void setVLCWindowsTitle( QString title = "" ); void setVLCWindowsTitle( QString title = "" );
void setDisplay( float, int, int ); void setDisplay( float, int, int );
void toggleTimeDisplay( bool );
void setElapsedTime();
void setRemainTime();
#if 0 #if 0
void visual(); void visual();
#endif #endif
......
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