KileWidgetPreviewConfig::KileWidgetPreviewConfig(KConfig *config, KileTool::QuickPreview *preview, QWidget *parent, const char *name ) : QWidget(parent,name), m_config(config), m_preview(preview) { // Layout QVBoxLayout *vbox = new QVBoxLayout(this, 5,5 ); QGroupBox *groupbox = new QGroupBox( i18n("Quick Preview in a separate window"), this, "groupbox" ); groupbox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, groupbox->sizePolicy().hasHeightForWidth() ) ); groupbox->setColumnLayout(0, Qt::Vertical ); groupbox->layout()->setSpacing( 6 ); groupbox->layout()->setMargin( 11 ); QGridLayout *groupboxLayout = new QGridLayout( groupbox->layout() ); groupboxLayout->setAlignment( Qt::AlignTop ); QLabel *label = new QLabel( i18n("Select a configuration:"), groupbox, "label"); m_combobox = new KComboBox(false,groupbox,"combobox" ); groupboxLayout->addWidget(label,0,0); groupboxLayout->addWidget(m_combobox,0,2); groupboxLayout->setColSpacing(1,8); groupboxLayout->setColStretch(3,1); QGroupBox *gbResolution = new QGroupBox( i18n("Quick Preview in bottom bar"), this, "gbresolution" ); gbResolution->setColumnLayout(0, Qt::Vertical ); gbResolution->layout()->setSpacing( 6 ); gbResolution->layout()->setMargin( 11 ); QGridLayout *resLayout = new QGridLayout( gbResolution->layout() ); resLayout->setAlignment( Qt::AlignTop ); QLabel *resLabel = new QLabel( i18n("&Resolution:"), gbResolution ); m_leDvipngResolution = new KLineEdit( gbResolution, "DvipngResolution" ); QLabel *resDpi = new QLabel( i18n("dpi"), gbResolution ); QLabel *resAllowed = new QLabel( i18n("(allowed values: 30-1000 dpi)"), gbResolution ); // set validator QValidator* validator = new QIntValidator(30,1000,this); m_leDvipngResolution->setValidator(validator); resLabel->setBuddy(m_leDvipngResolution); QString sep = " "; QString title = i18n("Kile supports three kinds of conversion to png images"); QString tool1 = i18n("dvi --> png") + sep + i18n("(uses dvipng)"); QString tool2 = i18n("dvi --> ps --> png") + sep + i18n("(uses dvips/convert)"); QString tool3 = i18n("pdf --> png") + sep + i18n("(uses convert)"); QString description = QString("%1:<ul><li>%2<li>%3<li>%4</ul>").arg(title).arg(tool1).arg(tool2).arg(tool3); QLabel *labelDescription = new QLabel(description, gbResolution); QLabel *labelDvipng = new QLabel(i18n("dvipng:"), gbResolution); QLabel *labelConvert = new QLabel(i18n("convert:"), gbResolution); m_lbDvipng = new QLabel(gbResolution); m_lbConvert = new QLabel(gbResolution); resLayout->addWidget(resLabel,0,0); resLayout->addWidget(m_leDvipngResolution,0,2); resLayout->addWidget(resDpi,0,3); resLayout->addWidget(resAllowed,0,5,Qt::AlignLeft); resLayout->addMultiCellWidget(labelDescription,1,1,0,5); resLayout->addWidget(labelDvipng,2,0); resLayout->addWidget(m_lbDvipng,2,2); resLayout->addWidget(labelConvert,3,0); resLayout->addWidget(m_lbConvert,3,2); resLayout->setColSpacing(1,8); resLayout->setColSpacing(4,24); resLayout->setColStretch(5,1); m_gbPreview = new QGroupBox( i18n("Properties"), this, "gbpreview" ); m_gbPreview->setColumnLayout(0, Qt::Vertical ); m_gbPreview->layout()->setSpacing( 6 ); m_gbPreview->layout()->setMargin( 11 ); QGridLayout *previewLayout = new QGridLayout( m_gbPreview->layout() ); previewLayout->setAlignment( Qt::AlignTop ); QLabel *labelPreviewWidget = new QLabel(i18n("Show preview in bottom bar:"), m_gbPreview); QLabel *labelPreviewType = new QLabel(i18n("Conversion to image:"), m_gbPreview); QLabel *labelSelection = new QLabel(i18n("Selection:"), m_gbPreview); QLabel *labelEnvironment = new QLabel(i18n("Environment:"), m_gbPreview); QLabel *labelMathgroup = new QLabel(i18n("Mathgroup:"), m_gbPreview); QLabel *labelSubdocument1 = new QLabel(i18n("Subdocument:"), m_gbPreview); QLabel *labelSubdocument2 = new QLabel(i18n("Not available, opens always in a separate window."), m_gbPreview); m_cbSelection = new QCheckBox(m_gbPreview); m_cbEnvironment = new QCheckBox(m_gbPreview); m_cbMathgroup = new QCheckBox(m_gbPreview); m_coSelection = new KComboBox(false,m_gbPreview); m_coEnvironment = new KComboBox(false,m_gbPreview); m_lbMathgroup = new QLabel(i18n("Preview uses always 'dvipng'."), m_gbPreview); previewLayout->addMultiCellWidget(labelPreviewWidget,0,0,0,2); previewLayout->addWidget(labelPreviewType,0,4); previewLayout->addWidget(labelSelection,1,0); previewLayout->addWidget(m_cbSelection,1,2); previewLayout->addWidget(m_coSelection,1,4); previewLayout->addWidget(labelEnvironment,2,0); previewLayout->addWidget(m_cbEnvironment,2,2); previewLayout->addWidget(m_coEnvironment,2,4); previewLayout->addWidget(labelMathgroup,3,0); previewLayout->addWidget(m_cbMathgroup,3,2); previewLayout->addMultiCellWidget(m_lbMathgroup,3,3,4,5,Qt::AlignLeft); previewLayout->addWidget(labelSubdocument1,4,0); previewLayout->addMultiCellWidget(labelSubdocument2,4,4,2,5,Qt::AlignLeft); previewLayout->setRowSpacing(0,3*labelPreviewWidget->sizeHint().height()/2); previewLayout->setRowSpacing(3,m_coEnvironment->sizeHint().height()); previewLayout->setColSpacing(1,12); previewLayout->setColSpacing(3,40); previewLayout->setColStretch(5,1); vbox->addWidget(groupbox); vbox->addWidget(gbResolution); vbox->addWidget(m_gbPreview); vbox->addStretch(); connect(m_cbEnvironment,SIGNAL(clicked()),this,SLOT(updateConversionTools())); connect(m_cbSelection,SIGNAL(clicked()),this,SLOT(updateConversionTools())); connect(m_cbMathgroup,SIGNAL(clicked()),this,SLOT(updateConversionTools())); }