kviewshell
kprintDialogPage_DJVUconversionoptions.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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:
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
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);
00092 }
00093
00094
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 }