• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

kprintDialogPage_DJVUconversionoptions.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Stefan Kebekus                                  *
00003  *   kebekus@kde.org                                                       *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <klocale.h>
00022 #include <qlayout.h>
00023 #include <qcheckbox.h>
00024 #include <qcombobox.h>
00025 #include <qtooltip.h>
00026 #include <qwhatsthis.h>
00027 #include <kdebug.h>
00028 
00029 #include "kprintDialogPage_DJVUconversionoptions.h"
00030 #include "kprintDialogPage_DJVUconversionoptions_basewidget.h"
00031 
00032 KPrintDialogPage_DJVUConversionOptions::KPrintDialogPage_DJVUConversionOptions( QWidget *parent, const char *name )
00033   : KPrintDialogPage( parent, name )
00034 {
00035   setTitle( i18n("DJVU to PS Conversion") );
00036 
00037   kprintDialogPage_pageoptions_baseLayout = new QVBoxLayout( this, 11, 6, "kprintDialogPage_pageoptions_baseLayout"); 
00038   if (kprintDialogPage_pageoptions_baseLayout == 0) {
00039     kdError(1223) << "KPrintDialogPage_DJVUPageOptions::KPrintDialogPage_DJVUPageOptions() cannot create layout" << endl;
00040     return;
00041   }
00042   
00043   wdg = new kprintDialogPage_DJVUconversionoptions_basewidget(this, "basewdg" );
00044   if (wdg != 0) {
00045     kprintDialogPage_pageoptions_baseLayout->addWidget( wdg );
00046   }
00047 }
00048 
00049 
00050 
00051 void KPrintDialogPage_DJVUConversionOptions::getOptions( QMap<QString,QString>& opts, bool )
00052 {
00053   if (wdg == 0) 
00054     return;
00055 
00056   opts["kde-kdjvu-pslevel"] = QString::number(wdg->psLevel->currentItem() + 1);
00057 
00058   kdDebug() << "getOptions: renderMode = " << wdg->renderMode->currentItem() << endl;
00059   switch (wdg->renderMode->currentItem())
00060   {
00061     case 1:
00062       opts["kde-kdjvu-rendermode"] = "black-and-white";
00063       break;
00064     case 2:
00065       opts["kde-kdjvu-rendermode"] = "foreground";
00066       break;
00067     case 3:
00068       opts["kde-kdjvu-rendermode"] = "background";
00069       break;
00070     default: // 0
00071       opts["kde-kdjvu-rendermode"] = "color";
00072   }
00073 }
00074 
00075 
00076 void KPrintDialogPage_DJVUConversionOptions::setOptions( const QMap<QString,QString>& opts )
00077 {
00078   if (wdg == 0)
00079     return;
00080 
00081   bool ok;
00082   // Set PostScript Language Level, taking 2 as the default
00083   int psLevel = opts["kde-kdjvu-pslevel"].toInt(&ok);
00084 
00085   if (ok && psLevel >= 1 && psLevel <= 3)
00086   {
00087     wdg->psLevel->setCurrentItem(psLevel - 1);
00088   }
00089   else
00090   {
00091     wdg->psLevel->setCurrentItem(1); // PostScript Level 2
00092   }
00093 
00094   // Set render mode, taking "color" as default
00095   QString op = opts["kde-kdjvu-rendermode"];
00096   if (op == "black-and-white")
00097   {
00098     wdg->renderMode->setCurrentItem(1);
00099   }
00100   else
00101   {
00102     if (op == "foreground")
00103       wdg->renderMode->setCurrentItem(2);
00104     else
00105     {
00106       if (op == "background")
00107         wdg->renderMode->setCurrentItem(3);
00108       else
00109         wdg->renderMode->setCurrentItem(0);
00110     }
00111   }
00112 }
00113 
00114 
00115 bool KPrintDialogPage_DJVUConversionOptions::isValid( QString& )
00116 {
00117   return true;
00118 }

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal