Code simplification and TimeLabel in the FSC.
fsLayout->addWidget( slider, 0, 1, 1, 9 );
fsLayout->addWidget( fasterButton, 0, 10 );
+ /* Second line */
fsLayout->addWidget( playButton, 1, 0, 1, 2 );
fsLayout->addLayout( controlButLayout, 1, 2 );
fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter );
fsLayout->setColumnStretch( 7, 10 );
- fsLayout->addWidget( volMuteLabel, 1, 8 );
- fsLayout->addWidget( volumeSlider, 1, 9, 1, 2 );
+
+ TimeLabel *timeLabel = new TimeLabel( p_intf );
+
+ fsLayout->addWidget( timeLabel, 1, 8 );
+ fsLayout->addWidget( volMuteLabel, 1, 9 );
+ fsLayout->addWidget( volumeSlider, 1, 10,1, 2 );
/* hiding timer */
p_hideTimer = new QTimer( this );
fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );
vlc_mutex_init_recursive( &lock );
+ setMinimumWidth( 450 );
}
FullscreenControllerWidget::~FullscreenControllerWidget()
}
}
+TimeLabel::TimeLabel( intf_thread_t *_p_intf ) :QLabel(), p_intf( _p_intf )
+{
+ b_remainingTime = false;
+ setText( " --:--/--:-- " );
+ setAlignment( Qt::AlignRight | Qt::AlignVCenter );
+ setToolTip( qtr( "Toggle between elapsed and remaining time" ) );
+
+
+ CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
+ this, setDisplayPosition( float, int, int ) );
+}
+
+void TimeLabel::setDisplayPosition( float pos, int time, int length )
+{
+ char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
+ secstotimestr( psz_length, length );
+ secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
+ : time );
+
+ QString timestr;
+ timestr.sprintf( "%s/%s", psz_time,
+ ( !length && time ) ? "--:--" : psz_length );
+
+ /* Add a minus to remaining time*/
+ if( b_remainingTime && length ) setText( " -"+timestr+" " );
+ else setText( " "+timestr+" " );
+}
+
+void TimeLabel::toggleTimeDisplay()
+{
+ b_remainingTime = !b_remainingTime;
+}
+
+
class TimeLabel : public QLabel
{
Q_OBJECT
- void mousePressEvent( QMouseEvent *event )
+public:
+ TimeLabel( intf_thread_t *_p_intf );
+protected:
+ virtual void mousePressEvent( QMouseEvent *event )
{
- emit timeLabelClicked();
+ toggleTimeDisplay();
}
- void mouseDoubleClickEvent( QMouseEvent *event )
+ virtual void mouseDoubleClickEvent( QMouseEvent *event )
{
+ toggleTimeDisplay();
emit timeLabelDoubleClicked();
}
+private slots:
+ void setDisplayPosition( float pos, int time, int length );
+private:
+ intf_thread_t *p_intf;
+ bool b_remainingTime;
+ void toggleTimeDisplay();
signals:
- void timeLabelClicked();
void timeLabelDoubleClicked();
};
/* Connect the input manager to the GUI elements it manages */
/* It is also connected to the control->slider, see the ControlsWidget */
- CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
- this, setDisplayPosition( float, int, int ) );
/* Change the SpeedRate in the Status */
CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
* Status Bar *
****************/
/* Widgets Creation*/
- b_remainingTime = false;
- timeLabel = new TimeLabel;
- timeLabel->setText( " --:--/--:-- " );
- timeLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
- timeLabel->setToolTip( qtr( "Toggle between elapsed and remaining time" ) );
+ timeLabel = new TimeLabel( p_intf );
nameLabel = new QLabel;
nameLabel->setTextInteractionFlags( Qt::TextSelectableByMouse
| Qt::TextSelectableByKeyboard );
- double clicking opens the goto time dialog
- right-clicking and clicking just toggle between remaining and
elapsed time.*/
- CONNECT( timeLabel, timeLabelClicked(), this, toggleTimeDisplay() );
CONNECT( timeLabel, timeLabelDoubleClicked(), THEDP, gotoTimeDialog() );
- CONNECT( timeLabel, timeLabelDoubleClicked(), this, toggleTimeDisplay() );
/* Speed Label behaviour:
- right click gives the vertical speed slider */
/************************************************************************
* Other stuff
************************************************************************/
-void MainInterface::setDisplayPosition( float pos, int time, int length )
-{
- char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
- secstotimestr( psz_length, length );
- secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
- : time );
-
- QString timestr;
- timestr.sprintf( "%s/%s", psz_time,
- ( !length && time ) ? "--:--" : psz_length );
-
- /* Add a minus to remaining time*/
- if( b_remainingTime && length ) timeLabel->setText( " -"+timestr+" " );
- else timeLabel->setText( " "+timestr+" " );
-}
-
-void MainInterface::toggleTimeDisplay()
-{
- b_remainingTime = !b_remainingTime;
-}
-
void MainInterface::setName( QString name )
{
input_name = name; /* store it for the QSystray use */
bool playlistVisible; ///< Is the playlist visible ?
bool visualSelectorEnabled;
bool notificationEnabled; /// Systray Notifications
- bool b_remainingTime; /* Show elapsed or remaining time */
bool bgWasVisible;
int i_visualmode; ///< Visual Mode
pl_dock_e i_pl_dock;
void setRate( int );
void setName( QString );
void setVLCWindowsTitle( QString title = "" );
- void setDisplayPosition( float, int, int );
- void toggleTimeDisplay();
#if 0
void visual();
#endif