kpresenter

KPrPresDurationDia.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2002 Toshitaka Fujioka <fujioka@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KPrPresDurationDia.h"
21#include "KPrCanvas.h"
22#include "KPrPage.h"
23#include "KPrDocument.h"
24#include <tqlabel.h>
25#include <tqheader.h>
26#include <tqvbox.h>
27#include <tqlayout.h>
28#include <tdelistview.h>
29#include <kdebug.h>
30#include <tdelocale.h>
31
32KPrPresDurationDia::KPrPresDurationDia( TQWidget *parent, const char *name,
33 KPrDocument *_doc, TQStringList _durationListString,
34 const TQString &_durationString )
35 : KDialogBase( parent, name, false, "", KDialogBase::Close ),
36 doc( _doc )
37{
38 m_durationListString = _durationListString;
39 m_durationString = _durationString;
40
41 TQWidget *page = new TQWidget( this );
42 setMainWidget( page );
43 TQVBoxLayout *topLayout = new TQVBoxLayout( page, 2 );
44
45 setupSlideList( page );
46 topLayout->addWidget( slides );
47 slides->setSelected( slides->firstChild(), true );
48
49 label = new TQLabel( i18n( "Presentation duration: " ) + _durationString, page );
50 label->setAlignment( AlignVCenter );
51 topLayout->addWidget( label );
52
53 setMinimumSize( 600, 400 );
54 connect( this, TQ_SIGNAL( closeClicked() ), this, TQ_SLOT( slotCloseDialog() ) );
55}
56
57
58void KPrPresDurationDia::setupSlideList( TQWidget *_page )
59{
60 slides = new TDEListView( _page );
61 slides->addColumn( i18n( "No." ) );
62 slides->addColumn( i18n( "Display Duration" ) );
63 slides->addColumn( i18n( "Slide Title" ) );
64 slides->header()->setMovingEnabled( false );
65 slides->setAllColumnsShowFocus( true );
66 slides->setRootIsDecorated( false );
67 slides->setSorting( -1 );
68
69 for ( int i = doc->getPageNums() - 1; i >= 0; --i ) {
70 if ( doc->pageList().at( i )->isSlideSelected() ) {
71 TDEListViewItem *item = new TDEListViewItem( slides );
72 item->setPixmap( 0, KPBarIcon( "slide" ) );
73 item->setText( 0, TQString( "%1" ).arg( i + 1 ) );
74 item->setText( 1, *m_durationListString.at( i ) );
75 item->setText( 2, doc->pageList().at( i )->pageTitle() );
76 }
77 }
78}
79
80#include "KPrPresDurationDia.moc"