Changeset View
Changeset View
Standalone View
Standalone View
conf/editannottooldialog.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 30 | { | |||
---|---|---|---|---|---|
78 | m_type->addItem( i18n("Pop-up Note"), qVariantFromValue( ToolNoteLinked ) ); | 78 | m_type->addItem( i18n("Pop-up Note"), qVariantFromValue( ToolNoteLinked ) ); | ||
79 | m_type->addItem( i18n("Inline Note"), qVariantFromValue( ToolNoteInline ) ); | 79 | m_type->addItem( i18n("Inline Note"), qVariantFromValue( ToolNoteInline ) ); | ||
80 | m_type->addItem( i18n("Freehand Line"), qVariantFromValue( ToolInk ) ); | 80 | m_type->addItem( i18n("Freehand Line"), qVariantFromValue( ToolInk ) ); | ||
81 | m_type->addItem( i18n("Straight Line"), qVariantFromValue( ToolStraightLine ) ); | 81 | m_type->addItem( i18n("Straight Line"), qVariantFromValue( ToolStraightLine ) ); | ||
82 | m_type->addItem( i18n("Polygon"), qVariantFromValue( ToolPolygon ) ); | 82 | m_type->addItem( i18n("Polygon"), qVariantFromValue( ToolPolygon ) ); | ||
83 | m_type->addItem( i18n("Text markup"), qVariantFromValue( ToolTextMarkup ) ); | 83 | m_type->addItem( i18n("Text markup"), qVariantFromValue( ToolTextMarkup ) ); | ||
84 | m_type->addItem( i18n("Geometrical shape"), qVariantFromValue( ToolGeometricalShape ) ); | 84 | m_type->addItem( i18n("Geometrical shape"), qVariantFromValue( ToolGeometricalShape ) ); | ||
85 | m_type->addItem( i18n("Stamp"), qVariantFromValue( ToolStamp ) ); | 85 | m_type->addItem( i18n("Stamp"), qVariantFromValue( ToolStamp ) ); | ||
86 | m_type->addItem( i18n("Typewriter"), qVariantFromValue( ToolTypewriter ) ); | ||||
86 | 87 | | |||
87 | createStubAnnotation(); | 88 | createStubAnnotation(); | ||
88 | 89 | | |||
89 | if ( initialState.isNull() ) | 90 | if ( initialState.isNull() ) | ||
90 | { | 91 | { | ||
91 | setWindowTitle( i18n("Create annotation tool") ); | 92 | setWindowTitle( i18n("Create annotation tool") ); | ||
92 | } | 93 | } | ||
93 | else | 94 | else | ||
Show All 23 Lines | 115 | { | |||
117 | QDomDocument doc; | 118 | QDomDocument doc; | ||
118 | QDomElement toolElement = doc.createElement( QStringLiteral("tool") ); | 119 | QDomElement toolElement = doc.createElement( QStringLiteral("tool") ); | ||
119 | QDomElement engineElement = doc.createElement( QStringLiteral("engine") ); | 120 | QDomElement engineElement = doc.createElement( QStringLiteral("engine") ); | ||
120 | QDomElement annotationElement = doc.createElement( QStringLiteral("annotation") ); | 121 | QDomElement annotationElement = doc.createElement( QStringLiteral("annotation") ); | ||
121 | doc.appendChild( toolElement ); | 122 | doc.appendChild( toolElement ); | ||
122 | toolElement.appendChild( engineElement ); | 123 | toolElement.appendChild( engineElement ); | ||
123 | engineElement.appendChild( annotationElement ); | 124 | engineElement.appendChild( annotationElement ); | ||
124 | 125 | | |||
125 | const QString color = m_stubann->style().color().name(); | 126 | const QString color = m_stubann->style().color().name(QColor::HexArgb); | ||
126 | const QString opacity = QString::number( m_stubann->style().opacity() ); | 127 | const QString opacity = QString::number( m_stubann->style().opacity() ); | ||
127 | const QString width = QString::number( m_stubann->style().width() ); | 128 | const QString width = QString::number( m_stubann->style().width() ); | ||
128 | 129 | | |||
129 | if ( toolType == ToolNoteLinked ) | 130 | if ( toolType == ToolNoteLinked ) | ||
130 | { | 131 | { | ||
131 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | 132 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | ||
132 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("note-linked") ); | 133 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("note-linked") ); | ||
133 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | 134 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | ||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | 250 | { | |||
251 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("stamp") ); | 252 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("stamp") ); | ||
252 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | 253 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | ||
253 | engineElement.setAttribute( QStringLiteral("hoverIcon"), sa->stampIconName() ); | 254 | engineElement.setAttribute( QStringLiteral("hoverIcon"), sa->stampIconName() ); | ||
254 | engineElement.setAttribute( QStringLiteral("size"), QStringLiteral("64") ); | 255 | engineElement.setAttribute( QStringLiteral("size"), QStringLiteral("64") ); | ||
255 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | 256 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | ||
256 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Stamp") ); | 257 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Stamp") ); | ||
257 | annotationElement.setAttribute( QStringLiteral("icon"), sa->stampIconName() ); | 258 | annotationElement.setAttribute( QStringLiteral("icon"), sa->stampIconName() ); | ||
258 | } | 259 | } | ||
260 | else if ( toolType == ToolTypewriter ) | ||||
261 | { | ||||
262 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | ||||
263 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("typewriter") ); | ||||
264 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | ||||
265 | engineElement.setAttribute( QStringLiteral("color"), QStringLiteral("#000000") ); | ||||
tobiasdeiminger: Default the text input popup to some light yellow. | |||||
266 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | ||||
267 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Typewriter") ); | ||||
268 | annotationElement.setAttribute( QStringLiteral("color"), color ); | ||||
269 | annotationElement.setAttribute( QStringLiteral("width"), width ); | ||||
270 | if ( ta->textFont() != QApplication::font() ) | ||||
271 | annotationElement.setAttribute( QStringLiteral("font"), ta->textFont().toString() ); | ||||
272 | } | ||||
259 | 273 | | |||
260 | if ( opacity != QStringLiteral("1") ) | 274 | if ( opacity != QStringLiteral("1") ) | ||
261 | annotationElement.setAttribute( QStringLiteral("opacity"), opacity ); | 275 | annotationElement.setAttribute( QStringLiteral("opacity"), opacity ); | ||
262 | 276 | | |||
263 | return doc; | 277 | return doc; | ||
264 | } | 278 | } | ||
265 | 279 | | |||
266 | void EditAnnotToolDialog::createStubAnnotation() | 280 | void EditAnnotToolDialog::createStubAnnotation() | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 336 | { | |||
327 | m_stubann = ga; | 341 | m_stubann = ga; | ||
328 | } | 342 | } | ||
329 | else if ( toolType == ToolStamp ) | 343 | else if ( toolType == ToolStamp ) | ||
330 | { | 344 | { | ||
331 | Okular::StampAnnotation * sa = new Okular::StampAnnotation(); | 345 | Okular::StampAnnotation * sa = new Okular::StampAnnotation(); | ||
332 | sa->setStampIconName( QStringLiteral("okular") ); | 346 | sa->setStampIconName( QStringLiteral("okular") ); | ||
333 | m_stubann = sa; | 347 | m_stubann = sa; | ||
334 | } | 348 | } | ||
349 | else if ( toolType == ToolTypewriter ) | ||||
350 | { | ||||
351 | Okular::TextAnnotation * ta = new Okular::TextAnnotation(); | ||||
352 | ta->setTextType( Okular::TextAnnotation::InPlace ); | ||||
353 | ta->setInplaceIntent( Okular::TextAnnotation::TypeWriter ); | ||||
354 | ta->style().setWidth( 0.0 ); | ||||
355 | ta->style().setColor( QColor(255,255,255,0) ); | ||||
356 | m_stubann = ta; | ||||
357 | } | ||||
335 | } | 358 | } | ||
336 | 359 | | |||
337 | void EditAnnotToolDialog::rebuildAppearanceBox() | 360 | void EditAnnotToolDialog::rebuildAppearanceBox() | ||
338 | { | 361 | { | ||
339 | // Remove previous widget (if any) | 362 | // Remove previous widget (if any) | ||
340 | if ( m_annotationWidget ) | 363 | if ( m_annotationWidget ) | ||
341 | { | 364 | { | ||
342 | delete m_annotationWidget->appearanceWidget(); | 365 | delete m_annotationWidget->appearanceWidget(); | ||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 477 | { | |||
457 | ha->setHighlightType( Okular::HighlightAnnotation::StrikeOut ); | 480 | ha->setHighlightType( Okular::HighlightAnnotation::StrikeOut ); | ||
458 | } | 481 | } | ||
459 | else if ( annotType == QLatin1String("underline") ) | 482 | else if ( annotType == QLatin1String("underline") ) | ||
460 | { | 483 | { | ||
461 | setToolType( ToolTextMarkup ); | 484 | setToolType( ToolTextMarkup ); | ||
462 | Okular::HighlightAnnotation * ha = static_cast<Okular::HighlightAnnotation*>( m_stubann ); | 485 | Okular::HighlightAnnotation * ha = static_cast<Okular::HighlightAnnotation*>( m_stubann ); | ||
463 | ha->setHighlightType( Okular::HighlightAnnotation::Underline ); | 486 | ha->setHighlightType( Okular::HighlightAnnotation::Underline ); | ||
464 | } | 487 | } | ||
488 | else if ( annotType == QLatin1String("typewriter") ) | ||||
489 | { | ||||
490 | setToolType( ToolTypewriter ); | ||||
491 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | ||||
492 | if ( annotationElement.hasAttribute( QStringLiteral("font") ) ) | ||||
493 | { | ||||
494 | QFont f; | ||||
495 | f.fromString( annotationElement.attribute( QStringLiteral("font") ) ); | ||||
496 | ta->setTextFont( f ); | ||||
497 | } | ||||
498 | } | ||||
465 | 499 | | |||
466 | // Common properties | 500 | // Common properties | ||
467 | if ( annotationElement.hasAttribute( QStringLiteral("color") ) ) | 501 | if ( annotationElement.hasAttribute( QStringLiteral("color") ) ) | ||
468 | m_stubann->style().setColor( QColor( annotationElement.attribute( QStringLiteral("color") ) ) ); | 502 | m_stubann->style().setColor( QColor( annotationElement.attribute( QStringLiteral("color") ) ) ); | ||
469 | if ( annotationElement.hasAttribute( QStringLiteral("opacity") ) ) | 503 | if ( annotationElement.hasAttribute( QStringLiteral("opacity") ) ) | ||
470 | m_stubann->style().setOpacity( annotationElement.attribute( QStringLiteral("opacity") ).toDouble() ); | 504 | m_stubann->style().setOpacity( annotationElement.attribute( QStringLiteral("opacity") ).toDouble() ); | ||
471 | if ( annotationElement.hasAttribute( QStringLiteral("width") ) ) | 505 | if ( annotationElement.hasAttribute( QStringLiteral("width") ) ) | ||
472 | m_stubann->style().setWidth( annotationElement.attribute( QStringLiteral("width") ).toDouble() ); | 506 | m_stubann->style().setWidth( annotationElement.attribute( QStringLiteral("width") ).toDouble() ); | ||
Show All 19 Lines |
Default the text input popup to some light yellow.