00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "KPrPgConfDia.h"
00023 #include "KPrDocument.h"
00024 #include "KPrPage.h"
00025
00026 #include <qbuttongroup.h>
00027 #include <qhbuttongroup.h>
00028 #include <qcheckbox.h>
00029 #include <qcombobox.h>
00030 #include <qhbox.h>
00031 #include <qvbox.h>
00032 #include <qgroupbox.h>
00033 #include <qheader.h>
00034 #include <qlabel.h>
00035 #include <qlayout.h>
00036 #include <qlistview.h>
00037 #include <qpen.h>
00038 #include <qpushbutton.h>
00039 #include <qradiobutton.h>
00040 #include <qvaluelist.h>
00041 #include <qvbuttongroup.h>
00042 #include <qwhatsthis.h>
00043
00044 #include <kcolorbutton.h>
00045 #include <kglobal.h>
00046 #include <klocale.h>
00047 #include <knuminput.h>
00048 #include <qslider.h>
00049
00050 KPrPgConfDia::KPrPgConfDia( QWidget* parent, KPrDocument* doc )
00051 : KDialogBase( KDialogBase::Tabbed, i18n("Configure Slide Show"),
00052 Ok|Cancel, Ok, parent, "pgConfDia", true ),
00053 m_doc( doc )
00054 {
00055 setupPageGeneral();
00056 setupPageSlides();
00057
00058 connect( this, SIGNAL( okClicked() ), this, SLOT( confDiaOk() ) );
00059 connect( this, SIGNAL( okClicked() ), this, SLOT( accept() ) );
00060 }
00061
00062 void KPrPgConfDia::setupPageGeneral()
00063 {
00064 QFrame* generalPage = addPage( i18n("&General") );
00065 QWhatsThis::add( generalPage, i18n("<p>This dialog allows you to configure how the slideshow "
00066 "will be displayed, including whether the slides are "
00067 "automatically sequenced or manually controlled, and also "
00068 "allows you to configure a <em>drawing pen</em> that can "
00069 "be used during the display of the presentation to add "
00070 "additional information or to emphasise particular points.</p>") );
00071 QVBoxLayout *generalLayout = new QVBoxLayout( generalPage, 0, KDialog::spacingHint() );
00072 generalLayout->setAutoAdd( true );
00073
00074 QVButtonGroup *switchGroup = new QVButtonGroup( i18n("&Transition Type"), generalPage );
00075 QWhatsThis::add( switchGroup, i18n("<li><p>If you select <b>Manual transition to next step or slide</b> "
00076 "then each transition and effect on a slide, or transition from "
00077 "one slide to the next, will require an action. Typically this "
00078 "action will be a mouse click, or the space bar.</p></li>"
00079 "<li><p>If you select <b>Automatic transition to next step or slide</b> "
00080 "then the presentation will automatically sequence each transition "
00081 "and effect on a slide, and will automatically transition to the "
00082 "next slide when the current slide is fully displayed. The speed "
00083 "of sequencing is controlled using the slider below. This also "
00084 "enables the option to automatically loop back to the first "
00085 "slide after the last slide has been shown.</p></li>") );
00086 m_manualButton = new QRadioButton( i18n("&Manual transition to next step or slide"), switchGroup );
00087 m_manualButton->setChecked( m_doc->spManualSwitch() );
00088 m_autoButton = new QRadioButton( i18n("&Automatic transition to next step or slide"), switchGroup );
00089 m_autoButton->setChecked( !m_doc->spManualSwitch() );
00090
00091 infiniteLoop = new QCheckBox( i18n( "&Infinite loop" ), generalPage );
00092 QWhatsThis::add( infiniteLoop, i18n("<p>If this checkbox is selected, then the slideshow "
00093 "will restart at the first slide after the last slide "
00094 "has been displayed. It is only available if the "
00095 "<b>Automatic transition to next step or slide</b> "
00096 "button is selected above.</p> <p>This option may be "
00097 "useful if you are running a promotional display.</p>") );
00098 infiniteLoop->setChecked( m_doc->spInfiniteLoop() );
00099 infiniteLoop->setEnabled( !m_doc->spManualSwitch() );
00100 connect( m_autoButton, SIGNAL( toggled(bool) ), infiniteLoop, SLOT( setEnabled(bool) ) );
00101
00102 presentationDuration = new QCheckBox( i18n( "Measure presentation &duration" ), generalPage );
00103 QWhatsThis::add( presentationDuration, i18n("<p>If this checkbox is selected, the time that "
00104 "each slide was displayed for, and the total time "
00105 "for the presentation will be measured.</p> "
00106 "<p>The times will be displayed at the end of the "
00107 "presentation.</p> "
00108 "<p>This can be used during rehearsal to check "
00109 "coverage for each issue in the presentation, "
00110 "and to verify that the presentation duration "
00111 "is correct.</p>" ) );
00112 presentationDuration->setChecked( m_doc->presentationDuration() );
00113
00114
00115
00116 QGroupBox* penGroup = new QGroupBox( i18n("Presentation Pen") , generalPage );
00117 QWhatsThis::add( penGroup, i18n("<p>This part of the dialog allows you to configure the "
00118 "<em>drawing mode</em>, which allows you to add additional "
00119 "information, emphasise particular content, or to correct "
00120 "errors during the presentation by drawing on the slides "
00121 "using the mouse.</p>"
00122 "<p>You can configure the color of the drawing pen and the "
00123 "width of the pen.</p>" ) );
00124 QGridLayout *grid = new QGridLayout(penGroup, 2, 2, KDialog::marginHint(), KDialog::spacingHint());
00125
00126 grid->addWidget( new QLabel( i18n( "Color:" ), penGroup ), 0, 0 );
00127 penColor = new KColorButton( m_doc->presPen().color(), m_doc->presPen().color(), penGroup );
00128 grid->addWidget( penColor, 0, 1 );
00129
00130 grid->addWidget( new QLabel( i18n( "Width:" ), penGroup ), 1, 0 );
00131 penWidth = new QSpinBox( 1, 10, 1, penGroup );
00132 penWidth->setSuffix( i18n(" pt") );
00133 penWidth->setValue( m_doc->presPen().width() );
00134 grid->addWidget( penWidth, 1, 1 );
00135
00136 QWidget* spacer = new QWidget( generalPage );
00137 spacer->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
00138 }
00139
00140 void KPrPgConfDia::setupPageSlides()
00141 {
00142 QFrame* slidesPage = addPage( i18n("&Slides") );
00143 QWhatsThis::add( slidesPage, i18n("<p>This dialog allows you to configure which slides "
00144 "are used in the presentation. Slides that are not "
00145 "selected will not be displayed during the slide "
00146 "show.</p>") );
00147 QGridLayout *slidesLayout = new QGridLayout( slidesPage,7 , 2, 0, KDialog::spacingHint());
00148
00149
00150 QButtonGroup *group=new QVButtonGroup( slidesPage );
00151 group->setRadioButtonExclusive( true );
00152
00153 m_customSlide = new QRadioButton( i18n( "Custom slide show" ), group, "customslide" );
00154
00155 connect( m_customSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) );
00156
00157 QHBox *box = new QHBox( group );
00158
00159 m_labelCustomSlide = new QLabel( i18n( "Custom slide:" ),box );
00160
00161 m_customSlideCombobox = new QComboBox( box );
00162 m_customSlideCombobox->insertStringList( m_doc->presentationList() );
00163
00164 m_selectedSlide = new QRadioButton( i18n( "Selected pages:" ), group, "selectedslide" );
00165 slidesLayout->addMultiCellWidget( group, 0,2,0,1 );
00166 connect( m_selectedSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) );
00167
00168 slides = new QListView( slidesPage );
00169 slidesLayout->addMultiCellWidget( slides, 3, 6, 0, 1 );
00170 slides->addColumn( i18n("Slide") );
00171 slides->setSorting( -1 );
00172 slides->header()->hide();
00173
00174 for ( int i = m_doc->getPageNums() - 1; i >= 0; --i )
00175 {
00176 KPrPage *page=m_doc->pageList().at( i );
00177 QCheckListItem* item = new QCheckListItem( slides,
00178 page->pageTitle(),
00179 QCheckListItem::CheckBox );
00180 item->setOn( page->isSlideSelected() );
00181 }
00182
00183 QHBox* buttonGroup = new QHBox( slidesPage );
00184 buttonGroup->setSpacing( KDialog::spacingHint() );
00185
00186 QPushButton* selectAllButton = new QPushButton( i18n( "Select &All" ), buttonGroup );
00187 connect( selectAllButton, SIGNAL( clicked() ), this, SLOT( selectAllSlides() ) );
00188
00189 QPushButton* deselectAllButton = new QPushButton( i18n( "&Deselect All" ), buttonGroup );
00190 connect( deselectAllButton, SIGNAL( clicked() ), this, SLOT( deselectAllSlides() ) );
00191
00192 QWidget* spacer = new QWidget( buttonGroup );
00193
00194 spacer->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
00195 slidesLayout->addMultiCellWidget( buttonGroup, 6, 6, 0, 1 );
00196
00197 if ( !m_doc->presentationName().isEmpty() )
00198 {
00199 m_customSlide->setChecked( true );
00200 m_customSlideCombobox->setCurrentText( m_doc->presentationName() );
00201 }
00202 else
00203 m_selectedSlide->setChecked( true );
00204
00205 if ( m_customSlideCombobox->count()==0 )
00206 {
00207 m_customSlide->setEnabled( false );
00208 m_labelCustomSlide->setEnabled( false );
00209 m_customSlideCombobox->setEnabled( false );
00210 }
00211 radioButtonClicked();
00212 }
00213
00214 KPrPgConfDia::~KPrPgConfDia()
00215 {
00216 }
00217
00218 void KPrPgConfDia::radioButtonClicked()
00219 {
00220 if ( m_customSlide->isChecked() )
00221 {
00222 m_labelCustomSlide->setEnabled( true );
00223 m_customSlideCombobox->setEnabled( true );
00224 slides->setEnabled( false );
00225 }
00226 else
00227 {
00228 m_labelCustomSlide->setEnabled( false );
00229 m_customSlideCombobox->setEnabled( false );
00230 slides->setEnabled( true );
00231 }
00232 }
00233
00234 bool KPrPgConfDia::getInfiniteLoop() const
00235 {
00236 return infiniteLoop->isChecked();
00237 }
00238
00239 bool KPrPgConfDia::getManualSwitch() const
00240 {
00241 return m_manualButton->isChecked();
00242 }
00243
00244 bool KPrPgConfDia::getPresentationDuration() const
00245 {
00246 return presentationDuration->isChecked();
00247 }
00248
00249 QPen KPrPgConfDia::getPen() const
00250 {
00251 return QPen( penColor->color(), penWidth->value() );
00252 }
00253
00254 QValueList<bool> KPrPgConfDia::getSelectedSlides() const
00255 {
00256 QValueList<bool> selectedSlides;
00257
00258 QListViewItem *item = slides->firstChild();
00259 while( item )
00260 {
00261 QCheckListItem *checkItem = dynamic_cast<QCheckListItem*>( item );
00262 bool selected = false;
00263 if( checkItem ) selected = checkItem->isOn();
00264 item = item->nextSibling();
00265 selectedSlides.append( selected );
00266 }
00267 return selectedSlides;
00268 }
00269
00270 void KPrPgConfDia::selectAllSlides()
00271 {
00272 QListViewItem *item = slides->firstChild();
00273 while( item )
00274 {
00275 QCheckListItem *checkItem = dynamic_cast<QCheckListItem*>( item );
00276 if( checkItem ) checkItem->setOn( true );
00277 item = item->nextSibling();
00278 }
00279 }
00280
00281 void KPrPgConfDia::deselectAllSlides()
00282 {
00283 QListViewItem *item = slides->firstChild();
00284 while( item )
00285 {
00286 QCheckListItem *checkItem = dynamic_cast<QCheckListItem*>( item );
00287 if( checkItem ) checkItem->setOn( false );
00288 item = item->nextSibling();
00289 }
00290 }
00291
00292 QString KPrPgConfDia::presentationName() const
00293 {
00294 if ( m_customSlide->isChecked() )
00295 return m_customSlideCombobox->currentText();
00296 else
00297 return QString::null;
00298 }
00299
00300 #include "KPrGradient.h"
00301 #include "KPrPgConfDia.moc"