kphpgl2page.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
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 }
 
This file is part of the documentation for kdeprint Library Version 3.2.0.