diff --git a/conf/editannottooldialog.cpp b/conf/editannottooldialog.cpp --- a/conf/editannottooldialog.cpp +++ b/conf/editannottooldialog.cpp @@ -189,7 +189,8 @@ annotationElement.setAttribute( QStringLiteral("leadFwd"), QString::number( la->lineLeadingForwardPoint() ) ); annotationElement.setAttribute( QStringLiteral("leadBack"), QString::number( la->lineLeadingBackwardPoint() ) ); } - annotationElement.setAttribute( QStringLiteral("endStyle"), QString::number( la->lineEndStyle() )); + annotationElement.setAttribute( QStringLiteral("startStyle"), QString::number( la->lineStartStyle() ) ); + annotationElement.setAttribute( QStringLiteral("endStyle"), QString::number( la->lineEndStyle() ) ); } else if ( toolType == ToolPolygon ) { @@ -485,6 +486,8 @@ la->setLineLeadingForwardPoint( annotationElement.attribute( QStringLiteral("leadFwd") ).toDouble() ); if ( annotationElement.hasAttribute( QStringLiteral("leadBack") ) ) la->setLineLeadingBackwardPoint( annotationElement.attribute( QStringLiteral("leadBack") ).toDouble() ); + if ( annotationElement.hasAttribute( QStringLiteral("startStyle") ) ) + la->setLineStartStyle( (Okular::LineAnnotation::TermStyle)annotationElement.attribute( QStringLiteral("startStyle") ).toInt() ); if ( annotationElement.hasAttribute( QStringLiteral("endStyle") ) ) la->setLineEndStyle( (Okular::LineAnnotation::TermStyle)annotationElement.attribute( QStringLiteral("endStyle") ).toInt() ); } diff --git a/ui/annotationwidgets.h b/ui/annotationwidgets.h --- a/ui/annotationwidgets.h +++ b/ui/annotationwidgets.h @@ -180,7 +180,8 @@ QCheckBox * m_useColor; KColorButton * m_innerColor; QDoubleSpinBox * m_spinSize; - QComboBox * m_termStyleCombo; + QComboBox * m_startStyleCombo; + QComboBox * m_endStyleCombo; }; class HighlightAnnotationWidget diff --git a/ui/annotationwidgets.cpp b/ui/annotationwidgets.cpp --- a/ui/annotationwidgets.cpp +++ b/ui/annotationwidgets.cpp @@ -538,27 +538,32 @@ connect( m_spinSize, QOverload::of(&QDoubleSpinBox::valueChanged), this, &LineAnnotationWidget::dataChanged ); //Line Term Styles - QLabel * tmplabel3 = new QLabel( i18n( "Line End:" ), widget ); + QLabel * tmplabel3 = new QLabel( i18n( "Line Start:" ), widget ); + QLabel * tmplabel4 = new QLabel( i18n( "Line End:" ), widget ); gridlay2->addWidget( tmplabel3, 1, 0, Qt::AlignRight ); - m_termStyleCombo = new KComboBox( widget ); - tmplabel3->setBuddy( m_termStyleCombo ); - gridlay2->addWidget( m_termStyleCombo ); - tmplabel3->setToolTip( i18n("Only for PDF documents")); - m_termStyleCombo->setToolTip( i18n("Only for PDF documents")); - - m_termStyleCombo->addItem( i18n( "Square" ) ); - m_termStyleCombo->addItem( i18n( "Circle" ) ); - m_termStyleCombo->addItem( i18n( "Diamond" ) ); - m_termStyleCombo->addItem( i18n( "Open Arrow" ) ); - m_termStyleCombo->addItem( i18n( "Closed Arrow" ) ); - m_termStyleCombo->addItem( i18n( "None" ) ); - m_termStyleCombo->addItem( i18n( "Butt" ) ); - m_termStyleCombo->addItem( i18n( "Right Open Arrow" ) ); - m_termStyleCombo->addItem( i18n( "Right Closed Arrow" ) ); - m_termStyleCombo->addItem( i18n( "Slash" ) ); - m_termStyleCombo->setCurrentIndex( m_lineAnn->lineEndStyle() ); - - connect( m_termStyleCombo, QOverload::of(&QComboBox::currentIndexChanged), this, &LineAnnotationWidget::dataChanged ); + gridlay2->addWidget( tmplabel4, 2, 0, Qt::AlignRight ); + m_startStyleCombo = new QComboBox( widget ); + m_endStyleCombo = new QComboBox( widget ); + tmplabel3->setBuddy( m_startStyleCombo ); + tmplabel4->setBuddy( m_endStyleCombo ); + gridlay2->addWidget( m_startStyleCombo, 1, 1, Qt::AlignLeft ); + gridlay2->addWidget( m_endStyleCombo, 2, 1, Qt::AlignLeft ); + tmplabel3->setToolTip( i18n("Only for PDF documents") ); + tmplabel4->setToolTip( i18n("Only for PDF documents") ); + m_startStyleCombo->setToolTip( i18n("Only for PDF documents")); + m_endStyleCombo->setToolTip( i18n("Only for PDF documents")); + + for ( const QString &i: { i18n( " Square" ), i18n( " Circle" ), i18n( " Diamond" ), i18n( " Open Arrow" ), i18n( " Closed Arrow" ), + i18n( " None" ), i18n( " Butt" ), i18n( " Right Open Arrow" ), i18n( " Right Closed Arrow" ), i18n( "Slash" ) } ) + { + m_startStyleCombo->addItem(i); + m_endStyleCombo->addItem(i); + } + + m_startStyleCombo->setCurrentIndex( m_lineAnn->lineStartStyle() ); + m_endStyleCombo->setCurrentIndex( m_lineAnn->lineEndStyle() ); + connect( m_startStyleCombo, QOverload::of(&QComboBox::currentIndexChanged), this, &LineAnnotationWidget::dataChanged ); + connect( m_endStyleCombo, QOverload::of(&QComboBox::currentIndexChanged), this, &LineAnnotationWidget::dataChanged ); return widget; } @@ -583,7 +588,8 @@ } } m_lineAnn->style().setWidth( m_spinSize->value() ); - m_lineAnn->setLineEndStyle( (Okular::LineAnnotation::TermStyle)m_termStyleCombo->currentIndex()); + m_lineAnn->setLineStartStyle( (Okular::LineAnnotation::TermStyle)m_startStyleCombo->currentIndex() ); + m_lineAnn->setLineEndStyle( (Okular::LineAnnotation::TermStyle)m_endStyleCombo->currentIndex() ); } diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -463,6 +463,8 @@ if ( m_annotElement.hasAttribute( QStringLiteral("leadBack") ) ) la->setLineLeadingBackwardPoint( m_annotElement.attribute( QStringLiteral("leadBack") ).toDouble() ); } + if ( m_annotElement.hasAttribute( QStringLiteral("startStyle") ) ) + la->setLineStartStyle( (Okular::LineAnnotation::TermStyle)m_annotElement.attribute( QStringLiteral("startStyle") ).toInt() ); if ( m_annotElement.hasAttribute( QStringLiteral("endStyle") ) ) la->setLineEndStyle( (Okular::LineAnnotation::TermStyle)m_annotElement.attribute( QStringLiteral("endStyle") ).toInt() );