Changeset View
Changeset View
Standalone View
Standalone View
conf/editannottooldialog.cpp
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | 124 | { | |||
---|---|---|---|---|---|
128 | QDomElement toolElement = doc.createElement( QStringLiteral("tool") ); | 128 | QDomElement toolElement = doc.createElement( QStringLiteral("tool") ); | ||
129 | QDomElement engineElement = doc.createElement( QStringLiteral("engine") ); | 129 | QDomElement engineElement = doc.createElement( QStringLiteral("engine") ); | ||
130 | QDomElement annotationElement = doc.createElement( QStringLiteral("annotation") ); | 130 | QDomElement annotationElement = doc.createElement( QStringLiteral("annotation") ); | ||
131 | doc.appendChild( toolElement ); | 131 | doc.appendChild( toolElement ); | ||
132 | toolElement.appendChild( engineElement ); | 132 | toolElement.appendChild( engineElement ); | ||
133 | engineElement.appendChild( annotationElement ); | 133 | engineElement.appendChild( annotationElement ); | ||
134 | 134 | | |||
135 | const QString color = m_stubann->style().color().name( QColor::HexArgb ); | 135 | const QString color = m_stubann->style().color().name( QColor::HexArgb ); | ||
136 | const QString textColor = static_cast< Okular::TextAnnotation * >( m_stubann )->textColor().name(); | ||||
136 | const QString opacity = QString::number( m_stubann->style().opacity() ); | 137 | const QString opacity = QString::number( m_stubann->style().opacity() ); | ||
137 | const QString width = QString::number( m_stubann->style().width() ); | 138 | const QString width = QString::number( m_stubann->style().width() ); | ||
138 | 139 | | |||
139 | if ( toolType == ToolNoteLinked ) | 140 | if ( toolType == ToolNoteLinked ) | ||
140 | { | 141 | { | ||
141 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | 142 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | ||
142 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("note-linked") ); | 143 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("note-linked") ); | ||
143 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | 144 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 260 | { | |||
265 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | 266 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | ||
266 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Stamp") ); | 267 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Stamp") ); | ||
267 | annotationElement.setAttribute( QStringLiteral("icon"), sa->stampIconName() ); | 268 | annotationElement.setAttribute( QStringLiteral("icon"), sa->stampIconName() ); | ||
268 | } | 269 | } | ||
269 | else if ( toolType == ToolTypewriter ) | 270 | else if ( toolType == ToolTypewriter ) | ||
270 | { | 271 | { | ||
271 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | 272 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | ||
272 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("typewriter") ); | 273 | toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("typewriter") ); | ||
273 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | 274 | engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") ); | ||
274 | engineElement.setAttribute( QStringLiteral("color"), color ); | | |||
275 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | 275 | engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") ); | ||
tobiasdeiminger: engine [color] seems to be too ambiguous to store font color in it. Consider near future, when… | |||||
276 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Typewriter") ); | 276 | annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Typewriter") ); | ||
277 | annotationElement.setAttribute( QStringLiteral("color"), color ); | 277 | annotationElement.setAttribute( QStringLiteral("color"), color ); | ||
278 | annotationElement.setAttribute( QStringLiteral("textColor"), textColor ); | ||||
278 | annotationElement.setAttribute( QStringLiteral("width"), width ); | 279 | annotationElement.setAttribute( QStringLiteral("width"), width ); | ||
279 | if ( ta->textFont() != QApplication::font() ) | 280 | if ( ta->textFont() != QApplication::font() ) | ||
280 | annotationElement.setAttribute( QStringLiteral("font"), ta->textFont().toString() ); | 281 | annotationElement.setAttribute( QStringLiteral("font"), ta->textFont().toString() ); | ||
281 | } | 282 | } | ||
282 | 283 | | |||
283 | if ( opacity != QStringLiteral("1") ) | 284 | if ( opacity != QStringLiteral("1") ) | ||
284 | annotationElement.setAttribute( QStringLiteral("opacity"), opacity ); | 285 | annotationElement.setAttribute( QStringLiteral("opacity"), opacity ); | ||
285 | 286 | | |||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 291 | { | |||
357 | } | 358 | } | ||
358 | else if ( toolType == ToolTypewriter ) | 359 | else if ( toolType == ToolTypewriter ) | ||
359 | { | 360 | { | ||
360 | Okular::TextAnnotation * ta = new Okular::TextAnnotation(); | 361 | Okular::TextAnnotation * ta = new Okular::TextAnnotation(); | ||
361 | ta->setTextType( Okular::TextAnnotation::InPlace ); | 362 | ta->setTextType( Okular::TextAnnotation::InPlace ); | ||
362 | ta->setInplaceIntent( Okular::TextAnnotation::TypeWriter ); | 363 | ta->setInplaceIntent( Okular::TextAnnotation::TypeWriter ); | ||
363 | ta->style().setWidth( 0.0 ); | 364 | ta->style().setWidth( 0.0 ); | ||
364 | ta->style().setColor( QColor(255,255,255,0) ); | 365 | ta->style().setColor( QColor(255,255,255,0) ); | ||
366 | ta->setTextColor( Qt::black ); | ||||
365 | m_stubann = ta; | 367 | m_stubann = ta; | ||
366 | } | 368 | } | ||
367 | } | 369 | } | ||
368 | 370 | | |||
369 | void EditAnnotToolDialog::rebuildAppearanceBox() | 371 | void EditAnnotToolDialog::rebuildAppearanceBox() | ||
370 | { | 372 | { | ||
371 | // Remove previous widget (if any) | 373 | // Remove previous widget (if any) | ||
372 | if ( m_annotationWidget ) | 374 | if ( m_annotationWidget ) | ||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | 500 | { | |||
499 | setToolType( ToolTypewriter ); | 501 | setToolType( ToolTypewriter ); | ||
500 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | 502 | Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann ); | ||
501 | if ( annotationElement.hasAttribute( QStringLiteral("font") ) ) | 503 | if ( annotationElement.hasAttribute( QStringLiteral("font") ) ) | ||
502 | { | 504 | { | ||
503 | QFont f; | 505 | QFont f; | ||
504 | f.fromString( annotationElement.attribute( QStringLiteral("font") ) ); | 506 | f.fromString( annotationElement.attribute( QStringLiteral("font") ) ); | ||
505 | ta->setTextFont( f ); | 507 | ta->setTextFont( f ); | ||
506 | } | 508 | } | ||
509 | if ( annotationElement.hasAttribute( QStringLiteral("textColor") ) ) | ||||
510 | ta->setTextColor( QColor( annotationElement.attribute( QStringLiteral("textColor") ) ) ); | ||||
507 | } | 511 | } | ||
508 | 512 | | |||
509 | // Common properties | 513 | // Common properties | ||
510 | if ( annotationElement.hasAttribute( QStringLiteral("color") ) ) | 514 | if ( annotationElement.hasAttribute( QStringLiteral("color") ) ) | ||
511 | m_stubann->style().setColor( QColor( annotationElement.attribute( QStringLiteral("color") ) ) ); | 515 | m_stubann->style().setColor( QColor( annotationElement.attribute( QStringLiteral("color") ) ) ); | ||
512 | if ( annotationElement.hasAttribute( QStringLiteral("opacity") ) ) | 516 | if ( annotationElement.hasAttribute( QStringLiteral("opacity") ) ) | ||
513 | m_stubann->style().setOpacity( annotationElement.attribute( QStringLiteral("opacity") ).toDouble() ); | 517 | m_stubann->style().setOpacity( annotationElement.attribute( QStringLiteral("opacity") ).toDouble() ); | ||
514 | if ( annotationElement.hasAttribute( QStringLiteral("width") ) ) | 518 | if ( annotationElement.hasAttribute( QStringLiteral("width") ) ) | ||
Show All 20 Lines |
engine [color] seems to be too ambiguous to store font color in it. Consider near future, when we want to implement font color support for inline notes. Then we have two different colors for one annotation, namely "background color" and "text color". One general color attribute (engine [color] / annotation [color] ) is not sufficient there. I think it's better to introduce a new annotation [textColor] attribute now.