kpresenter

KPrPrinterDlg.cpp

00001 /*
00002 *
00003 * Copyright (C) 2005  Fredrik Edemar
00004 *                     f_edemar@linux.se
00005 *
00006 * This program is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 * 
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 * 
00016 * You should have received a copy of the GNU General Public License
00017 * along with this program; if not, write to the Free Software
00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 *
00021 */
00022 
00023 // Qt includes
00024 #include <qlayout.h>
00025 
00026 // KDE includes
00027 #include <kdebug.h>
00028 #include <kdialog.h>
00029 #include <klocale.h>
00030 #include <qtooltip.h>
00031 
00032 // local includes
00033 #include "KPrPrinterDlg.h"
00034 
00035  KPrPrinterDlg::KPrPrinterDlg( QWidget *parent, const char *name )
00036   : KPrintDialogPage( parent, name )
00037 {
00038   setTitle( i18n( "KPresenter Options" ) );
00039   QGridLayout *layout = new QGridLayout( this, 2, 1, 11, 6 );
00040   txtRows = new KIntNumInput(this );
00041   txtRows->setMinValue(1);
00042   txtRows->setMaxValue(5);
00043   txtRows->setValue(1);
00044   txtColumns = new KIntNumInput(this );
00045   txtColumns->setMinValue(1);
00046   txtColumns->setMaxValue(5);
00047   txtColumns->setValue(1);
00048   connect( txtRows, SIGNAL( valueChanged( int ) ), this, SLOT( txtRows_valueChanged( int ) ) );
00049   connect( txtColumns, SIGNAL( valueChanged( int ) ), this, SLOT( txtColumns_valueChanged( int ) ) );
00050 
00051   QLabel *caption = new QLabel(i18n("Slides in the pages:"), this );
00052   QToolTip::add( caption, i18n("Choose how many rows and columns with slides you want to have on all pages") );
00053   layout->addMultiCellWidget( caption, 0, 0, 0, 1 );
00054   QVBoxLayout *l2 = new QVBoxLayout( 0, 0, 6 );
00055   l2->addWidget( new QLabel(i18n("Rows: "), this) );
00056   l2->addWidget( new QLabel(i18n("Columns: "), this) );
00057   layout->addLayout( l2, 1, 0 );
00058 
00059   QVBoxLayout *l3 = new QVBoxLayout( 0, 0, 6 );
00060   l3->addWidget( txtRows );
00061   l3->addWidget( txtColumns );
00062   layout->addLayout( l3, 1, 1 );
00063 
00064   drawBorder = new QCheckBox(i18n("Draw border around the slides"), this );
00065   drawBorder->setChecked( true );
00066   drawBorder->setEnabled( false );
00067   layout->addMultiCellWidget( drawBorder, 2, 2, 0, 1 );
00068 }
00069 
00070 void KPrPrinterDlg::getOptions( QMap<QString, QString>& opts, bool )
00071 {
00072   opts["kde-kpresenter-printrows"] = QString::number(txtRows->value());
00073   opts["kde-kpresenter-printcolumns"] = QString::number(txtColumns->value());
00074   opts["kde-kpresenter-printslideborders"] = QString::number(drawBorder->isEnabled() && drawBorder->isChecked());
00075 }
00076 
00077 void KPrPrinterDlg::setOptions( const QMap<QString, QString>& opts )
00078 {
00079   if ( opts["kde-kpresenter-printrows"].isEmpty() )
00080     txtRows->setValue(1);
00081   else
00082     txtRows->setValue((opts["kde-kpresenter-printrows"]).toInt());
00083   if ( opts["kde-kpresenter-printcolumns"].isEmpty() )
00084     txtColumns->setValue(1);
00085   else
00086     txtColumns->setValue((opts["kde-kpresenter-printcolumns"]).toInt());
00087 
00088   if ( opts["kde-kpresenter-printslideborders"].isEmpty() )
00089     drawBorder->setChecked(true);
00090   else
00091     drawBorder->setChecked((opts["kde-kpresenter-printslideborders"]).toInt());
00092 }
00093 
00094 bool KPrPrinterDlg::isValid( const QString& )
00095 {
00096   return true;
00097 }
00098 
00099 void KPrPrinterDlg::txtRows_valueChanged( int new_value)
00100 {
00101   if ( new_value == 1 && txtColumns->value() == 1 )
00102     drawBorder->setEnabled( false );
00103   else
00104     drawBorder->setEnabled( true );
00105 }
00106 void KPrPrinterDlg::txtColumns_valueChanged( int new_value )
00107 {
00108   if ( new_value == 1 && txtRows->value() == 1 )
00109     drawBorder->setEnabled( false );
00110   else
00111     drawBorder->setEnabled( true );
00112 }
00113 
00114 #include "KPrPrinterDlg.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys