Commit 8be768a9 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: Go To Time dialog: set default time to current (fix #5511)

parent c40e7aaf
...@@ -62,22 +62,38 @@ GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf) ...@@ -62,22 +62,38 @@ GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf)
timeEdit->setAlignment( Qt::AlignRight ); timeEdit->setAlignment( Qt::AlignRight );
timeEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); timeEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
QPushButton *resetButton = new QPushButton( QIcon(":/update"), "" );
resetButton->setToolTip( qtr("Reset") );
mainLayout->addWidget( timeIntro, 0, 0, 1, 1 ); mainLayout->addWidget( timeIntro, 0, 0, 1, 1 );
mainLayout->addWidget( timeEdit, 0, 1, 1, 1 ); mainLayout->addWidget( timeEdit, 0, 1, 1, 1 );
mainLayout->addWidget( resetButton, 0, 2, 1, 1 );
mainLayout->addWidget( buttonBox, 1, 0, 1, 2 ); mainLayout->addWidget( buttonBox, 1, 0, 1, 3 );
BUTTONACT( gotoButton, close() ); BUTTONACT( gotoButton, close() );
BUTTONACT( cancelButton, cancel() ); BUTTONACT( cancelButton, cancel() );
BUTTONACT( resetButton, reset() );
} }
GotoTimeDialog::~GotoTimeDialog() GotoTimeDialog::~GotoTimeDialog()
{ {
} }
void GotoTimeDialog::toggleVisible()
{
reset();
if ( !isVisible() && THEMIM->getIM()->hasInput() )
{
int64_t i_time = var_GetTime( THEMIM->getInput(), "time" );
timeEdit->setTime( timeEdit->time().addSecs( i_time / 1000000 ) );
}
QVLCDialog::toggleVisible();
}
void GotoTimeDialog::cancel() void GotoTimeDialog::cancel()
{ {
timeEdit->setTime( QTime( 0, 0, 0) ); reset();
toggleVisible(); toggleVisible();
} }
...@@ -90,5 +106,9 @@ void GotoTimeDialog::close() ...@@ -90,5 +106,9 @@ void GotoTimeDialog::close()
var_SetTime( THEMIM->getInput(), "time", i_time ); var_SetTime( THEMIM->getInput(), "time", i_time );
} }
toggleVisible(); toggleVisible();
}
void GotoTimeDialog::reset()
{
timeEdit->setTime( QTime( 0, 0, 0) ); timeEdit->setTime( QTime( 0, 0, 0) );
} }
...@@ -39,8 +39,11 @@ private: ...@@ -39,8 +39,11 @@ private:
private slots: private slots:
void close(); void close();
void cancel(); void cancel();
void reset();
friend class Singleton<GotoTimeDialog>; friend class Singleton<GotoTimeDialog>;
public:
void toggleVisible();
}; };
#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