22#include "KPrPgConfDia.h"
23#include "KPrDocument.h"
26#include <tqbuttongroup.h>
27#include <tqhbuttongroup.h>
28#include <tqcheckbox.h>
29#include <tqcombobox.h>
32#include <tqvgroupbox.h>
36#include <tqlistview.h>
38#include <tqpushbutton.h>
39#include <tqradiobutton.h>
40#include <tqvaluelist.h>
41#include <tqvbuttongroup.h>
42#include <tqwhatsthis.h>
44#include <kcolorbutton.h>
50KPrPgConfDia::KPrPgConfDia( TQWidget* parent, KPrDocument* doc )
51 : KDialogBase( KDialogBase::Tabbed, i18n(
"Configure Slide Show"),
52 Ok|Cancel, Ok, parent,
"pgConfDia", true ),
58 connect(
this, TQ_SIGNAL( okClicked() ),
this, TQ_SLOT( confDiaOk() ) );
59 connect(
this, TQ_SIGNAL( okClicked() ),
this, TQ_SLOT( accept() ) );
62void KPrPgConfDia::setupPageGeneral()
64 TQFrame* generalPage = addPage( i18n(
"&General") );
65 TQWhatsThis::add( generalPage, i18n(
"<p>This dialog allows you to configure how the slideshow "
66 "will be displayed, including whether the slides are "
67 "automatically sequenced or manually controlled, and also "
68 "allows you to configure a <em>drawing pen</em> that can "
69 "be used during the display of the presentation to add "
70 "additional information or to emphasise particular points.</p>") );
71 TQVBoxLayout *generalLayout =
new TQVBoxLayout( generalPage, 0, KDialog::spacingHint() );
73 TQVButtonGroup *switchGroup =
new TQVButtonGroup( i18n(
"&Transition Type"), generalPage );
74 generalLayout->addWidget( switchGroup );
75 TQWhatsThis::add( switchGroup, i18n(
"<li><p>If you select <b>Manual transition to next step or slide</b> "
76 "then each transition and effect on a slide, or transition from "
77 "one slide to the next, will require an action. Typically this "
78 "action will be a mouse click, or the space bar.</p></li>"
79 "<li><p>If you select <b>Automatic transition to next step or slide</b> "
80 "then the presentation will automatically sequence each transition "
81 "and effect on a slide, and will automatically transition to the "
82 "next slide when the current slide is fully displayed. The speed "
83 "of sequencing is controlled using the slider below. This also "
84 "enables the option to automatically loop back to the first "
85 "slide after the last slide has been shown.</p></li>") );
86 m_manualButton =
new TQRadioButton( i18n(
"&Manual transition to next step or slide"), switchGroup );
87 m_manualButton->setChecked( m_doc->spManualSwitch() );
88 m_autoButton =
new TQRadioButton( i18n(
"&Automatic transition to next step or slide"), switchGroup );
89 m_autoButton->setChecked( !m_doc->spManualSwitch() );
91 infiniteLoop =
new TQCheckBox( i18n(
"&Infinite loop" ), generalPage );
92 generalLayout->addWidget( infiniteLoop );
93 TQWhatsThis::add( infiniteLoop, i18n(
"<p>If this checkbox is selected, then the slideshow "
94 "will restart at the first slide after the last slide "
95 "has been displayed. It is only available if the "
96 "<b>Automatic transition to next step or slide</b> "
97 "button is selected above.</p> <p>This option may be "
98 "useful if you are running a promotional display.</p>") );
100 infiniteLoop->setEnabled( !m_doc->spManualSwitch() );
101 connect( m_autoButton, TQ_SIGNAL( toggled(
bool) ), infiniteLoop, TQ_SLOT( setEnabled(
bool) ) );
102 connect( m_autoButton, TQ_SIGNAL( toggled(
bool) ), infiniteLoop, TQ_SLOT( setChecked(
bool) ) );
104 endOfPresentationSlide =
new TQCheckBox( i18n(
"&Show 'End of presentation' slide" ), generalPage );
105 generalLayout->addWidget( endOfPresentationSlide );
106 TQWhatsThis::add( endOfPresentationSlide, i18n(
"<p>If this checkbox is selected, when the slideshow "
107 "has finished a black slideshow containing the "
108 "message 'End of presentation. Click to exit' will "
110 endOfPresentationSlide->setChecked( m_doc->spShowEndOfPresentationSlide() );
111 endOfPresentationSlide->setDisabled( infiniteLoop->isEnabled() && getInfiniteLoop() );
112 connect( infiniteLoop, TQ_SIGNAL( toggled(
bool) ), endOfPresentationSlide, TQ_SLOT( setDisabled(
bool) ) );
114 presentationDuration =
new TQCheckBox( i18n(
"Measure presentation &duration" ), generalPage );
115 generalLayout->addWidget( presentationDuration );
116 TQWhatsThis::add( presentationDuration, i18n(
"<p>If this checkbox is selected, the time that "
117 "each slide was displayed for, and the total time "
118 "for the presentation will be measured.</p> "
119 "<p>The times will be displayed at the end of the "
121 "<p>This can be used during rehearsal to check "
122 "coverage for each issue in the presentation, "
123 "and to verify that the presentation duration "
124 "is correct.</p>" ) );
125 presentationDuration->setChecked( m_doc->presentationDuration() );
129 TQGroupBox* penGroup =
new TQGroupBox( 2, TQt::Horizontal, i18n(
"Presentation Pen") , generalPage );
130 generalLayout->addWidget( penGroup );
131 TQWhatsThis::add( penGroup, i18n(
"<p>This part of the dialog allows you to configure the "
132 "<em>drawing mode</em>, which allows you to add additional "
133 "information, emphasise particular content, or to correct "
134 "errors during the presentation by drawing on the slides "
135 "using the mouse.</p>"
136 "<p>You can configure the color of the drawing pen and the "
137 "width of the pen.</p>" ) );
138 penGroup->layout()->setSpacing(KDialog::marginHint());
139 penGroup->layout()->setMargin(KDialog::spacingHint());
142 TQLabel* label =
new TQLabel( i18n(
"Color:" ), penGroup );
144 penColor =
new KColorButton( m_doc->presPen().color(), m_doc->presPen().color(), penGroup );
147 label =
new TQLabel( i18n(
"Width:" ), penGroup );
149 penWidth =
new TQSpinBox( 1, 10, 1, penGroup );
150 penWidth->setSuffix( i18n(
" pt") );
151 penWidth->setValue( m_doc->presPen().width() );
154 generalLayout->addStretch();
157void KPrPgConfDia::setupPageSlides()
159 TQFrame* slidesPage = addPage( i18n(
"&Slides") );
160 TQWhatsThis::add( slidesPage, i18n(
"<p>This dialog allows you to configure which slides "
161 "are used in the presentation. Slides that are not "
162 "selected will not be displayed during the slide "
164 TQGridLayout *slidesLayout =
new TQGridLayout( slidesPage,7 , 2, 0, KDialog::spacingHint());
167 TQButtonGroup *group=
new TQVButtonGroup( slidesPage );
168 group->setRadioButtonExclusive(
true );
170 m_customSlide =
new TQRadioButton( i18n(
"Custom slide show" ), group,
"customslide" );
172 connect( m_customSlide, TQ_SIGNAL( clicked () ),
this, TQ_SLOT( radioButtonClicked() ) );
174 TQHBox *box =
new TQHBox( group );
176 m_labelCustomSlide =
new TQLabel( i18n(
"Custom slide:" ),box );
178 m_customSlideCombobox =
new TQComboBox( box );
179 m_customSlideCombobox->insertStringList( m_doc->presentationList() );
181 m_selectedSlide =
new TQRadioButton( i18n(
"Selected pages:" ), group,
"selectedslide" );
182 slidesLayout->addMultiCellWidget( group, 0,2,0,1 );
183 connect( m_selectedSlide, TQ_SIGNAL( clicked () ),
this, TQ_SLOT( radioButtonClicked() ) );
185 slides =
new TQListView( slidesPage );
186 slidesLayout->addMultiCellWidget( slides, 3, 3, 0, 1 );
187 slidesLayout->setRowStretch( 3, 10 );
188 slides->addColumn( i18n(
"Slide") );
189 slides->setSorting( -1 );
190 slides->header()->hide();
192 for (
int i = m_doc->getPageNums() - 1; i >= 0; --i )
194 KPrPage *page=m_doc->pageList().at( i );
195 TQCheckListItem* item =
new TQCheckListItem( slides,
197 TQCheckListItem::CheckBox );
198 item->setOn( page->isSlideSelected() );
201 TQHBox* buttonGroup =
new TQHBox( slidesPage );
202 buttonGroup->setSpacing( KDialog::spacingHint() );
204 TQPushButton* selectAllButton =
new TQPushButton( i18n(
"Select &All" ), buttonGroup );
205 connect( selectAllButton, TQ_SIGNAL( clicked() ),
this, TQ_SLOT( selectAllSlides() ) );
207 TQPushButton* deselectAllButton =
new TQPushButton( i18n(
"&Deselect All" ), buttonGroup );
208 connect( deselectAllButton, TQ_SIGNAL( clicked() ),
this, TQ_SLOT( deselectAllSlides() ) );
210 TQWidget* spacer =
new TQWidget( buttonGroup );
212 spacer->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) );
213 slidesLayout->addMultiCellWidget( buttonGroup, 4, 4, 0, 1 );
215 if ( !m_doc->presentationName().isEmpty() )
217 m_customSlide->setChecked(
true );
218 m_customSlideCombobox->setCurrentText( m_doc->presentationName() );
221 m_selectedSlide->setChecked(
true );
223 if ( m_customSlideCombobox->count()==0 )
225 m_customSlide->setEnabled(
false );
226 m_labelCustomSlide->setEnabled(
false );
227 m_customSlideCombobox->setEnabled(
false );
229 radioButtonClicked();
232KPrPgConfDia::~KPrPgConfDia()
236void KPrPgConfDia::radioButtonClicked()
238 if ( m_customSlide->isChecked() )
240 m_labelCustomSlide->setEnabled(
true );
241 m_customSlideCombobox->setEnabled(
true );
242 slides->setEnabled(
false );
246 m_labelCustomSlide->setEnabled(
false );
247 m_customSlideCombobox->setEnabled(
false );
248 slides->setEnabled(
true );
252bool KPrPgConfDia::getInfiniteLoop()
const
254 return infiniteLoop->isChecked();
257bool KPrPgConfDia::getShowEndOfPresentationSlide()
const
259 return endOfPresentationSlide->isChecked();
262bool KPrPgConfDia::getManualSwitch()
const
264 return m_manualButton->isChecked();
267bool KPrPgConfDia::getPresentationDuration()
const
269 return presentationDuration->isChecked();
272TQPen KPrPgConfDia::getPen()
const
274 return TQPen( penColor->color(), penWidth->value() );
277TQValueList<bool> KPrPgConfDia::getSelectedSlides()
const
279 TQValueList<bool> selectedSlides;
281 TQListViewItem *item = slides->firstChild();
284 TQCheckListItem *checkItem =
dynamic_cast<TQCheckListItem*
>( item );
285 bool selected =
false;
286 if( checkItem ) selected = checkItem->isOn();
287 item = item->nextSibling();
288 selectedSlides.append( selected );
290 return selectedSlides;
293void KPrPgConfDia::selectAllSlides()
295 TQListViewItem *item = slides->firstChild();
298 TQCheckListItem *checkItem =
dynamic_cast<TQCheckListItem*
>( item );
299 if( checkItem ) checkItem->setOn(
true );
300 item = item->nextSibling();
304void KPrPgConfDia::deselectAllSlides()
306 TQListViewItem *item = slides->firstChild();
309 TQCheckListItem *checkItem =
dynamic_cast<TQCheckListItem*
>( item );
310 if( checkItem ) checkItem->setOn(
false );
311 item = item->nextSibling();
315TQString KPrPgConfDia::presentationName()
const
317 if ( m_customSlide->isChecked() )
318 return m_customSlideCombobox->currentText();
323#include "KPrGradient.h"
324#include "KPrPgConfDia.moc"