1 /*****************************************************************************
2 * GotoTime.cpp : GotoTime and About dialogs
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
5 * $Id: Messages.cpp 16024 2006-07-13 13:51:05Z xtophe $
7 * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include "dialogs/gototime.hpp"
26 #include "dialogs_provider.hpp"
27 #include "util/qvlcframe.hpp"
35 #include <QDialogButtonBox>
37 GotoTimeDialog *GotoTimeDialog::instance = NULL;
39 GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
41 setWindowTitle( qtr( "Go to Time" ) );
44 QGridLayout *mainLayout = new QGridLayout( this );
46 QPushButton *gotoButton = new QPushButton( qtr( "&Go" ) );
47 QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) );
48 QDialogButtonBox *buttonBox = new QDialogButtonBox;
50 buttonBox->addButton( gotoButton, QDialogButtonBox::AcceptRole );
51 buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
53 QGroupBox *timeGroupBox = new QGroupBox( "Time" );
54 QGridLayout *boxLayout = new QGridLayout( timeGroupBox );
56 QLabel *timeIntro = new
57 QLabel( "Enter below the desired time you want to go in the media." );
58 timeIntro->setWordWrap( true );
59 timeIntro->setAlignment( Qt::AlignCenter );
61 timeEdit = new QTimeEdit();
62 timeEdit->setDisplayFormat( "hh : mm : ss" );
63 timeEdit->setAlignment( Qt::AlignRight );
64 timeEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
66 QLabel *helpFormat = new QLabel( timeEdit->displayFormat() );
67 helpFormat->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
69 QSpacerItem *spacerBox = new QSpacerItem(20, 10, QSizePolicy::Minimum,
72 QSpacerItem *spacerItem = new QSpacerItem(20, 5, QSizePolicy::Minimum,
73 QSizePolicy::Expanding);
75 boxLayout->addWidget( timeIntro, 0, 0, 1, 2 );
76 boxLayout->addItem( spacerBox, 1, 0, 1, 2 );
77 boxLayout->addWidget( timeEdit, 2, 0, 1, 1 );
78 boxLayout->addWidget( helpFormat, 2, 1, 1, 1 );
80 mainLayout->addWidget( timeGroupBox, 0, 0, 1, 4 );
81 mainLayout->addItem( spacerItem, 1, 0 );
82 mainLayout->addWidget( buttonBox, 2, 3 );
84 BUTTONACT( gotoButton, close() );
85 BUTTONACT( cancelButton, cancel() );
88 GotoTimeDialog::~GotoTimeDialog()
92 void GotoTimeDialog::close()
95 this->toggleVisible();