X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fdialogs%2Fgototime.cpp;h=abd18ad2f36eaf54a99d0861d8e21c2ee94e0212;hb=c5172423e32537de643af4aa5eb197c84dcb4415;hp=952c63e91d41dab2093936faf82db681881ddd4b;hpb=5d9d238ceae3ac7431eefc1f2a778fb6691cbb54;p=vlc diff --git a/modules/gui/qt4/dialogs/gototime.cpp b/modules/gui/qt4/dialogs/gototime.cpp index 952c63e91d..abd18ad2f3 100644 --- a/modules/gui/qt4/dialogs/gototime.cpp +++ b/modules/gui/qt4/dialogs/gototime.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * GotoTime.cpp : GotoTime and About dialogs **************************************************************************** - * Copyright (C) 2006 the VideoLAN team + * Copyright (C) 2007 the VideoLAN team * $Id: Messages.cpp 16024 2006-07-13 13:51:05Z xtophe $ * * Authors: Jean-Baptiste Kempf @@ -24,33 +24,43 @@ #include "dialogs/gototime.hpp" #include "dialogs_provider.hpp" +#include "main_interface.hpp" #include "util/qvlcframe.hpp" #include "qt4.hpp" +#include "input_manager.hpp" #include #include #include #include #include +#include GotoTimeDialog *GotoTimeDialog::instance = NULL; GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf ) { + setWindowFlags( Qt::Tool ); setWindowTitle( qtr( "Go to Time" ) ); - resize( 250, 180 ); + resize( 260, 160 ); QGridLayout *mainLayout = new QGridLayout( this ); - QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); + QPushButton *gotoButton = new QPushButton( qtr( "&Go" ) ); + QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) ); + QDialogButtonBox *buttonBox = new QDialogButtonBox; - QGroupBox *timeGroupBox = new QGroupBox( "Time" ); + gotoButton->setDefault( true ); + buttonBox->addButton( gotoButton, QDialogButtonBox::AcceptRole ); + buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole ); + + QGroupBox *timeGroupBox = new QGroupBox( qtr("Time") ); QGridLayout *boxLayout = new QGridLayout( timeGroupBox ); QLabel *timeIntro = new QLabel( "Enter below the desired time you want to go in the media." ); timeIntro->setWordWrap( true ); - timeIntro->setAlignment( Qt::AlignHCenter, Qt::AlignVCenter ); + timeIntro->setAlignment( Qt::AlignCenter ); timeEdit = new QTimeEdit(); timeEdit->setDisplayFormat( "hh : mm : ss" ); @@ -63,7 +73,7 @@ GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf ) QSpacerItem *spacerBox = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed); - QSpacerItem *spacerItem = new QSpacerItem(20, 5, QSizePolicy::Minimum, + QSpacerItem *spacerItem = new QSpacerItem(20, 3, QSizePolicy::Minimum, QSizePolicy::Expanding); boxLayout->addWidget( timeIntro, 0, 0, 1, 2 ); @@ -73,17 +83,29 @@ GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf ) mainLayout->addWidget( timeGroupBox, 0, 0, 1, 4 ); mainLayout->addItem( spacerItem, 1, 0 ); - mainLayout->addWidget( closeButton, 2, 3 ); + mainLayout->addWidget( buttonBox, 2, 3 ); - BUTTONACT( closeButton, close() ); + BUTTONACT( gotoButton, close() ); + BUTTONACT( cancelButton, cancel() ); } GotoTimeDialog::~GotoTimeDialog() { } -void GotoTimeDialog::close() +void GotoTimeDialog::cancel() { + timeEdit->setTime( QTime( 0, 0, 0) ); + this->toggleVisible(); +} +void GotoTimeDialog::close() +{ + if ( THEMIM->getIM()->hasInput() ) + { + int64_t i_time = (int64_t) + ( QTime( 0, 0, 0 ).msecsTo( timeEdit->time() ) ) * 1000; + var_SetTime( THEMIM->getInput(), "time", i_time ); + } this->toggleVisible(); }