void FieldLineEdit::updateGUI() { enableSignals( FALSE ); bool inputEnable = ( m_value->items.count() <= 1 ) && m_enabled; m_pushButtonString->setEnabled( inputEnable && !m_isReadOnly ); bool isComplex = !inputEnable && m_value->items.count() > 1; if ( m_value->items.count() == 1 ) { BibTeX::ValueItem * item = m_value->items.first(); m_pushButtonString->setOn( dynamic_cast<BibTeX::MacroKey*>( m_value->items.first() ) != NULL ); switch ( m_inputType ) { case itSingleLine: if ( QString::compare( m_lineEdit->text(), item->text() ) != 0 ) m_lineEdit->setText( item->text() ); break; case itMultiLine: if ( QString::compare( m_textEdit->text(), item->text() ) != 0 ) m_textEdit->setText( item->text() ); break; } } else { switch ( m_inputType ) { case itSingleLine: m_lineEdit->setText( isComplex ? i18n( "Concatenated value" ) : "" ); break; case itMultiLine: m_textEdit->setText( isComplex ? i18n( "Concatenated value" ) : "" ); break; } } m_pushButtonComplex->setEnabled( m_enabled ); switch ( m_inputType ) { case itSingleLine: m_lineEdit->setEnabled( inputEnable ); m_lineEdit->setReadOnly( m_isReadOnly ); break; case itMultiLine: m_textEdit->setEnabled( inputEnable ); m_textEdit->setReadOnly( m_isReadOnly ); break; } enableSignals( TRUE ); }
void FieldLineEdit::setupGUI( const char *name ) { Settings * settings = Settings::self(); char * subname = NULL; if ( name != NULL ) subname = new char[ strlen( name ) + 20 ]; if ( subname != NULL ) { strcpy( subname, name ); strcat( subname, "_pbstring" ); } m_pushButtonString = new QPushButton( this, subname ); m_pushButtonString->setIconSet( QIconSet( SmallIcon( "flag" ) ) ); m_pushButtonString->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); m_pushButtonString->setToggleButton( TRUE ); QToolTip::add( m_pushButtonString, QString( i18n( "Set '%1' to be a string key" ) ).arg( m_caption ) ); connect( m_pushButtonString, SIGNAL( clicked() ), this, SLOT( slotStringToggled() ) ); if ( subname != NULL ) { strcpy( subname, name ); strcat( subname, "_pbcomplex" ); } m_pushButtonComplex = new QPushButton( this, subname ); m_pushButtonComplex->setIconSet( QIconSet( SmallIcon( "leftjust" ) ) ); m_pushButtonComplex->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); QToolTip::add( m_pushButtonComplex, QString( i18n( "Edit '%1' as a concatenated value" ) ).arg( m_caption ) ); connect( m_pushButtonComplex, SIGNAL( clicked() ), this, SLOT( slotComplexClicked() ) ); QGridLayout * layout = NULL; switch ( m_inputType ) { case itSingleLine: { layout = new QGridLayout( this, 2, 3, 0, KDialog::spacingHint() ); if ( subname != NULL ) { strcpy( subname, name ); strcat( subname, "_lineedit" ); } m_lineEdit = new KLineEdit( this, subname ); m_lineEdit->setReadOnly( m_isReadOnly ); if ( settings->editing_UseSpecialFont ) m_lineEdit->setFont( settings->editing_SpecialFont ); layout->addWidget( m_lineEdit, 0, 0 ); setFocusProxy( m_lineEdit ); layout->addWidget( m_pushButtonString, 0, 1 ); layout->addWidget( m_pushButtonComplex, 0, 2 ); QWidget::setTabOrder( m_lineEdit, m_pushButtonString ); } break; case itMultiLine: { layout = new QGridLayout( this, 3, 2, 0, KDialog::spacingHint() ); layout->setRowStretch( 2, 1 ); if ( subname != NULL ) { strcpy( subname, name ); strcat( subname, "_textedit" ); } m_textEdit = new QTextEdit( this, subname ); m_textEdit->setReadOnly( m_isReadOnly ); if ( settings->editing_UseSpecialFont ) m_textEdit->setFont( settings->editing_SpecialFont ); layout->addMultiCellWidget( m_textEdit, 0, 2, 0, 0 ); setFocusProxy( m_textEdit ); layout->addWidget( m_pushButtonString, 0, 1 ); layout->addWidget( m_pushButtonComplex, 1, 1 ); QWidget::setTabOrder( m_textEdit, m_pushButtonString ); } break; } QWidget::setTabOrder( m_pushButtonString, m_pushButtonComplex ); layout->setRowStretch( layout->numRows() - 1, 1 ); if ( subname != NULL ) delete subname; enableSignals( TRUE ); }
void Prefs_ItemTools::restoreDefaults(struct ApplicationPrefs *prefsData) { enableSignals(false); int docUnitIndex = prefsData->docSetupPrefs.docUnitIndex; double unitRatio = unitGetRatioFromIndex(docUnitIndex); unitChange(docUnitIndex); PrefsManager* prefsManager=PrefsManager::instance(); ColorList* colorList = (m_doc != NULL) ? (&m_doc->PageColors) : prefsManager->colorSetPtr(); //Text Tool for (int i=0; i<textFontComboBox->count(); ++i) { if (textFontComboBox->itemText(i) == prefsData->itemToolPrefs.textFont) { textFontComboBox->setCurrentIndex(i); break; } } textSizeSpinBox->setValue(prefsData->itemToolPrefs.textSize / 10); textColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.textColor); textColorShadingSpinBox->setValue(prefsData->itemToolPrefs.textShade); textStrokeColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.textStrokeColor); textStrokeShadingSpinBox->setValue(prefsData->itemToolPrefs.textStrokeShade); textFrameFillColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.textFillColor); textFrameFillShadingSpinBox->setValue(prefsData->itemToolPrefs.textFillColorShade); textFrameLineColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.textLineColor); textFrameLineShadingSpinBox->setValue(prefsData->itemToolPrefs.textLineColorShade); textTabFillCharComboBox->clear(); textTabFillCharComboBox->addItem( tr("None", "tab fill" )); textTabFillCharComboBox->addItem( tr("Dot")); textTabFillCharComboBox->addItem( tr("Hyphen")); textTabFillCharComboBox->addItem( tr("Underscore")); textTabFillCharComboBox->addItem( tr("Custom")); if (prefsData->itemToolPrefs.textTabFillChar.isEmpty()) { textTabFillCharComboBox->setCurrentIndex(0); } else if (prefsData->itemToolPrefs.textTabFillChar == ".") { textTabFillCharComboBox->setCurrentIndex(1); } else if (prefsData->itemToolPrefs.textTabFillChar == "-") { textTabFillCharComboBox->setCurrentIndex(2); } else if (prefsData->itemToolPrefs.textTabFillChar == "_") { textTabFillCharComboBox->setCurrentIndex(3); } else { textTabFillCharComboBox->setCurrentIndex(4); textTabFillCharComboBox->setEditable(true); textTabFillCharComboBox->setItemText(textTabFillCharComboBox->currentIndex(), CommonStrings::trCustomTabFill + prefsData->itemToolPrefs.textTabFillChar); } textTabWidthSpinBox->setValue(prefsData->itemToolPrefs.textTabWidth * unitRatio); textColumnsSpinBox->setValue(prefsData->itemToolPrefs.textColumns); textColumnGapSpinBox->setValue(prefsData->itemToolPrefs.textColumnGap * unitRatio); topTextDistanceSpinBox->setValue(prefsData->itemToolPrefs.textDistances.top() * unitRatio); bottomTextDistanceSpinBox->setValue(prefsData->itemToolPrefs.textDistances.bottom() * unitRatio); leftTextDistanceSpinBox->setValue(prefsData->itemToolPrefs.textDistances.left() * unitRatio); rightTextDistanceSpinBox->setValue(prefsData->itemToolPrefs.textDistances.right() * unitRatio); //Image Tool imageFreeScalingRadioButton->setChecked( prefsData->itemToolPrefs.imageScaleType ); imageFrameScalingRadioButton->setChecked( !prefsData->itemToolPrefs.imageScaleType ); imageHorizontalScalingSpinBox->setValue(qRound(prefsData->itemToolPrefs.imageScaleX * 100)); imageVerticalScalingSpinBox->setValue(qRound(prefsData->itemToolPrefs.imageScaleY * 100)); imageKeepAspectRatioCheckBox->setChecked(prefsData->itemToolPrefs.imageAspectRatio); scalingLockToolButton->setChecked(prefsData->itemToolPrefs.imageAspectRatio); imageFrameFillColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.imageFillColor); imageFrameFillShadingSpinBox->setValue(prefsData->itemToolPrefs.imageFillColorShade ); imageFrameLineColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.imageStrokeColor); imageFrameLineShadingSpinBox->setValue(prefsData->itemToolPrefs.imageStrokeColorShade ); imageUseEmbeddedClippingPathCheckBox->setChecked(prefsData->itemToolPrefs.imageUseEmbeddedPath); switch (prefsData->itemToolPrefs.imageLowResType) { case 0: onscreenResolutionFullRadioButton->setChecked(true); break; case 1: onscreenResolutionNormalRadioButton->setChecked(true); break; case 2: onscreenResolutionLowRadioButton->setChecked(true); break; } //Shape Tool shapeFrameLineColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.shapeLineColor); shapeFrameLineShadingSpinBox->setValue(prefsData->itemToolPrefs.shapeLineColorShade); shapeFrameFillColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.shapeFillColor); shapeFrameFillShadingSpinBox->setValue(prefsData->itemToolPrefs.shapeFillColorShade); shapeFrameLineStyleComboBox->setCurrentIndex(static_cast<int>(prefsData->itemToolPrefs.shapeLineStyle) - 1); shapeLineWidthSpinBox->setValue(prefsData->itemToolPrefs.shapeLineWidth); //Polygon Tool polygonWidget->restoreDefaults(&prefsData->itemToolPrefs); //Line Tool lineFillColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.lineColor); lineFillColorShadingSpinBox->setValue(prefsData->itemToolPrefs.lineColorShade); lineStyleComboBox->setCurrentIndex(static_cast<int>(prefsData->itemToolPrefs.lineStyle) - 1); if (m_doc != 0) { lineStartArrowComboBox->rebuildList(&m_doc->arrowStyles()); lineEndArrowComboBox->rebuildList(&m_doc->arrowStyles()); } else { lineStartArrowComboBox->rebuildList(&prefsData->arrowStyles); lineEndArrowComboBox->rebuildList(&prefsData->arrowStyles); } lineStartArrowComboBox->setCurrentIndex(prefsData->itemToolPrefs.lineStartArrow); lineEndArrowComboBox->setCurrentIndex(prefsData->itemToolPrefs.lineEndArrow); lineWidthSpinBox->setValue(prefsData->itemToolPrefs.lineWidth); // //Calligraphic Pen Tool calPenFillColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.calligraphicPenFillColor); calPenFillShadingSpinBox->setValue(prefsData->itemToolPrefs.calligraphicPenFillColorShade); calPenColorComboBox->initColorList(colorList, m_doc, prefsData->itemToolPrefs.calligraphicPenLineColor); calPenLineShadingSpinBox->setValue(prefsData->itemToolPrefs.calligraphicPenLineColorShade); calPenStyleComboBox->setCurrentIndex(static_cast<int>(prefsData->itemToolPrefs.calligraphicPenStyle) - 1); calPenLineWidthSpinBox->setValue(prefsData->itemToolPrefs.calligraphicPenLineWidth); calPenAngleSpinBox->setValue(prefsData->itemToolPrefs.calligraphicPenAngle); calPenWidthSpinBox->setValue(prefsData->itemToolPrefs.calligraphicPenWidth); // Arc Tool arcDisplay->restoreDefaults(&prefsData->itemToolPrefs); // Spiral Tool spiralDisplay->restoreDefaults(&prefsData->itemToolPrefs); enableSignals(true); }