Changeset View
Changeset View
Standalone View
Standalone View
ui/annotationwidgets.cpp
Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Line(s) | 161 | default: | |||
---|---|---|---|---|---|
162 | ; | 162 | ; | ||
163 | } | 163 | } | ||
164 | // cases not covered yet: return a generic widget | 164 | // cases not covered yet: return a generic widget | ||
165 | return new AnnotationWidget( ann ); | 165 | return new AnnotationWidget( ann ); | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | 168 | | |||
169 | AnnotationWidget::AnnotationWidget( Okular::Annotation * ann ) | 169 | AnnotationWidget::AnnotationWidget( Okular::Annotation * ann ) | ||
170 | : m_ann( ann ) | 170 | : m_typeEditable( true ), m_ann( ann ) | ||
171 | { | 171 | { | ||
172 | } | 172 | } | ||
173 | 173 | | |||
174 | AnnotationWidget::~AnnotationWidget() | 174 | AnnotationWidget::~AnnotationWidget() | ||
175 | { | 175 | { | ||
176 | } | 176 | } | ||
177 | 177 | | |||
178 | Okular::Annotation::SubType AnnotationWidget::annotationType() const | 178 | Okular::Annotation::SubType AnnotationWidget::annotationType() const | ||
Show All 39 Lines | 210 | { | |||
218 | return widget; | 218 | return widget; | ||
219 | } | 219 | } | ||
220 | 220 | | |||
221 | void AnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | 221 | void AnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | ||
222 | { | 222 | { | ||
223 | Q_UNUSED( formlayout ); | 223 | Q_UNUSED( formlayout ); | ||
224 | } | 224 | } | ||
225 | 225 | | |||
226 | void AnnotationWidget::setAnnotTypeEditable( bool editable ) | ||||
227 | { | ||||
228 | m_typeEditable = editable; | ||||
229 | } | ||||
230 | | ||||
226 | void AnnotationWidget::addColorButton( QWidget * widget, QFormLayout * formlayout ) | 231 | void AnnotationWidget::addColorButton( QWidget * widget, QFormLayout * formlayout ) | ||
227 | { | 232 | { | ||
228 | m_colorBn = new KColorButton( widget ); | 233 | m_colorBn = new KColorButton( widget ); | ||
229 | m_colorBn->setColor( m_ann->style().color() ); | 234 | m_colorBn->setColor( m_ann->style().color() ); | ||
230 | formlayout->addRow( i18n( "&Color:" ), m_colorBn ); | 235 | formlayout->addRow( i18n( "&Color:" ), m_colorBn ); | ||
231 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | 236 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||
232 | } | 237 | } | ||
233 | 238 | | |||
▲ Show 20 Lines • Show All 381 Lines • ▼ Show 20 Line(s) | |||||
615 | { | 620 | { | ||
616 | m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann ); | 621 | m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann ); | ||
617 | } | 622 | } | ||
618 | 623 | | |||
619 | void HighlightAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | 624 | void HighlightAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | ||
620 | { | 625 | { | ||
621 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | 626 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | ||
622 | 627 | | |||
628 | | ||||
623 | m_typeCombo = new KComboBox( widget ); | 629 | m_typeCombo = new KComboBox( widget ); | ||
630 | m_typeCombo->setVisible( m_typeEditable ); | ||||
631 | if( m_typeEditable ) | ||||
632 | { | ||||
624 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | 633 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | ||
634 | } | ||||
625 | m_typeCombo->addItem( i18n( "Highlight" ) ); | 635 | m_typeCombo->addItem( i18n( "Highlight" ) ); | ||
626 | m_typeCombo->addItem( i18n( "Squiggle" ) ); | 636 | m_typeCombo->addItem( i18n( "Squiggle" ) ); | ||
627 | m_typeCombo->addItem( i18n( "Underline" ) ); | 637 | m_typeCombo->addItem( i18n( "Underline" ) ); | ||
628 | m_typeCombo->addItem( i18n( "Strike out" ) ); | 638 | m_typeCombo->addItem( i18n( "Strike out" ) ); | ||
629 | m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() ); | 639 | m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() ); | ||
630 | 640 | | |||
631 | addVerticalSpacer( formlayout ); | 641 | addVerticalSpacer( formlayout ); | ||
632 | addColorButton( widget, formlayout ); | 642 | addColorButton( widget, formlayout ); | ||
Show All 15 Lines | |||||
648 | { | 658 | { | ||
649 | m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann ); | 659 | m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann ); | ||
650 | } | 660 | } | ||
651 | 661 | | |||
652 | void GeomAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | 662 | void GeomAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | ||
653 | { | 663 | { | ||
654 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | 664 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | ||
655 | 665 | | |||
666 | | ||||
656 | m_typeCombo = new KComboBox( widget ); | 667 | m_typeCombo = new KComboBox( widget ); | ||
668 | m_typeCombo->setVisible( m_typeEditable ); | ||||
669 | if( m_typeEditable ) | ||||
670 | { | ||||
657 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | 671 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | ||
672 | } | ||||
658 | addVerticalSpacer( formlayout ); | 673 | addVerticalSpacer( formlayout ); | ||
659 | addColorButton( widget, formlayout ); | 674 | addColorButton( widget, formlayout ); | ||
660 | addOpacitySpinBox( widget, formlayout ); | 675 | addOpacitySpinBox( widget, formlayout ); | ||
661 | QHBoxLayout * colorlay = new QHBoxLayout(); | 676 | QHBoxLayout * colorlay = new QHBoxLayout(); | ||
662 | m_useColor = new QCheckBox( i18n( "Enabled" ), widget ); | 677 | m_useColor = new QCheckBox( i18n( "Enabled" ), widget ); | ||
663 | colorlay->addWidget(m_useColor); | 678 | colorlay->addWidget(m_useColor); | ||
664 | m_innerColor = new KColorButton( widget ); | 679 | m_innerColor = new KColorButton( widget ); | ||
665 | colorlay->addWidget( m_innerColor); | 680 | colorlay->addWidget( m_innerColor); | ||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |