// ------------------------------------------------------------------------------------------------- ParameterBox::ParameterBox(QWidget* parent, const char* name) throw () : QFrame(parent, name), m_leftValue(-1.0), m_rightValue(-1.0) { QGridLayout* layout = new QGridLayout(this, 5 /* row */, 9 /* col */, 0 /* margin */, 5); // - create ------------------------------------------------------------------------------------ // settings Settings& set = Settings::set(); // widgets QLabel* timeLabel = new QLabel(tr("&Measuring Time:"), this); QLabel* sampleLabel = new QLabel(tr("&Sampling Rate:"), this); QLabel* triggerLabel = new QLabel(tr("&Triggering:"), this); QTimeEdit* timeedit = new QTimeEdit(this); timeedit->setRange(QTime(0, 0), QTime(0, 1)); QSlider* sampleSlider = new QSlider(0, MAX_SLIDER_VALUE, 1, 0, Qt::Horizontal, this); TriggerWidget* triggering = new TriggerWidget(this); // labels for the markers QLabel* leftMarkerLabel = new QLabel(tr("Left Button Marker:"), this); QLabel* rightMarkerLabel = new QLabel(tr("Right Button Marker:"), this); QLabel* diffLabel = new QLabel(tr("Difference:"), this); m_leftMarker = new QLabel(this); m_rightMarker = new QLabel(this); m_diff = new QLabel("zdddd", this); // set the font for the labels QFont font = qApp->font(this); font.setPixelSize(15); font.setBold(true); m_leftMarker->setFont(font); m_rightMarker->setFont(font); m_diff->setFont(font); // buddys timeLabel->setBuddy(timeedit); triggerLabel->setBuddy(triggering); sampleLabel->setBuddy(sampleSlider); // load value triggering->setValue(set.readNumEntry("Measuring/Triggering/Value"), set.readNumEntry("Measuring/Triggering/Mask")); timeedit->setTime(QTime(0, set.readNumEntry("Measuring/Triggering/Minutes"), set.readNumEntry("Measuring/Triggering/Seconds"))); sampleSlider->setValue(MAX_SLIDER_VALUE - set.readNumEntry("Measuring/Number_Of_Skips")); // - layout the stuff -------------------------------------------------------------------------- // row, col layout->addWidget(timeLabel, 0, 1); layout->addWidget(sampleLabel, 1, 1); layout->addWidget(triggerLabel, 2, 1, Qt::AlignTop); layout->addWidget(timeedit, 0, 3); layout->addWidget(sampleSlider, 1, 3); layout->addMultiCellWidget(triggering, 2, 3, 3, 3); layout->addWidget(leftMarkerLabel, 0, 5); layout->addWidget(rightMarkerLabel, 1, 5); layout->addWidget(diffLabel, 2, 5); layout->addWidget(m_leftMarker, 0, 7, Qt::AlignRight); layout->addWidget(m_rightMarker, 1, 7, Qt::AlignRight); layout->addWidget(m_diff, 2, 7, Qt::AlignRight); layout->setColStretch(0, 2); layout->setColSpacing(2, 20); layout->setColStretch(4, 4); layout->setColSpacing(6, 20); layout->setColSpacing(7, 150); layout->setColStretch(8, 2); connect(timeedit, SIGNAL(valueChanged(const QTime&)), this, SLOT(timeValueChanged(const QTime&))); connect(triggering, SIGNAL(valueChanged(byte, byte)), this, SLOT(triggerValueChanged(byte, byte))); connect(sampleSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int))); // - initial values ---------------------------------------------------------------------------- updateValues(); }
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())); }