kdeprint Library API Documentation

kphpgl2page.cpp

00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 **/ 00019 00020 #include "kphpgl2page.h" 00021 00022 #include <qcheckbox.h> 00023 #include <qgroupbox.h> 00024 #include <qlayout.h> 00025 #include <klocale.h> 00026 #include <knuminput.h> 00027 00028 KPHpgl2Page::KPHpgl2Page(QWidget *parent, const char *name) 00029 : KPrintDialogPage(parent, name) 00030 { 00031 setTitle("HP-GL/2"); 00032 00033 QGroupBox *box = new QGroupBox(0, Qt::Vertical, i18n("HP-GL/2 Options"), this); 00034 00035 m_blackplot = new QCheckBox(i18n("&Use only black pen"), box); 00036 m_fitplot = new QCheckBox(i18n("&Fit plot to page"), box); 00037 m_penwidth = new KIntNumInput(1000, box); 00038 m_penwidth->setLabel(i18n("&Pen width:"), Qt::AlignLeft|Qt::AlignVCenter); 00039 m_penwidth->setSuffix(" [um]"); 00040 m_penwidth->setRange(0, 10000, 100, true); 00041 00042 QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10); 00043 l0->addWidget(box); 00044 l0->addStretch(1); 00045 QVBoxLayout *l1 = new QVBoxLayout(box->layout(), 10); 00046 l1->addWidget(m_blackplot); 00047 l1->addWidget(m_fitplot); 00048 l1->addWidget(m_penwidth); 00049 } 00050 00051 KPHpgl2Page::~KPHpgl2Page() 00052 { 00053 } 00054 00055 void KPHpgl2Page::setOptions(const QMap<QString,QString>& opts) 00056 { 00057 QString value; 00058 if (opts.contains("blackplot") && ((value=opts["blackplot"]).isEmpty() || value == "true")) 00059 m_blackplot->setChecked(true); 00060 if (opts.contains("fitplot") && ((value=opts["fitplot"]).isEmpty() || value == "true")) 00061 m_fitplot->setChecked(true); 00062 if (!(value=opts["penwidth"]).isEmpty()) 00063 m_penwidth->setValue(value.toInt()); 00064 } 00065 00066 void KPHpgl2Page::getOptions(QMap<QString,QString>& opts, bool incldef) 00067 { 00068 if (incldef || m_penwidth->value() != 1000) 00069 opts["penwidth"] = QString::number(m_penwidth->value()); 00070 if (m_blackplot->isChecked()) 00071 opts["blackplot"] = "true"; 00072 else if (incldef) 00073 opts["blackplot"] = "false"; 00074 else 00075 opts.remove("blackplot"); 00076 if (m_fitplot->isChecked()) 00077 opts["fitplot"] = "true"; 00078 else if (incldef) 00079 opts["fitplot"] = "false"; 00080 else 00081 opts.remove("fitplot"); 00082 }
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:41:51 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003