Store all annotation color attributes as ARGB string

Summary:
This is mainly preparation for D15204 (typewriter), where storing RGB won't be sufficient any longer.
Typewriter will need transparent background (alpha=0x00), which can only be expressed as ARGB string.

Current code handles name format identical for all annotations. It doesn't hurt to store all annotations in ARGB format, so instead of introducing special handling for typewriter, let's store all annotation color attributes as ARGB string.

Note: In case of previously existing okularpartrc, configuration will be reused without conversion. New color format will be written when new settings are saved. This has no bad effect.

Test Plan:
- when [Reviews] section in okularpartrc is initially generated, all annotation color attributes are in #AARRGGBB format
- saving into archive stores color with alpha channel (#AARRGGBB), for all kind of annotations

Reviewers: sander

Reviewed By: sander

Subscribers: dileepsankhla, sander, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D15279
remotes/origin/Applications/18.12
Dileep Sankhla 8 years ago committed by Tobias Deiminger
parent 736f801dac
commit d61cef693d
  1. 2
      conf/editannottooldialog.cpp
  2. 2
      core/annotations.cpp
  3. 16
      ui/data/tools.xml

@ -131,7 +131,7 @@ QDomDocument EditAnnotToolDialog::toolXml() const
toolElement.appendChild( engineElement );
engineElement.appendChild( annotationElement );
const QString color = m_stubann->style().color().name();
const QString color = m_stubann->style().color().name( QColor::HexArgb );
const QString opacity = QString::number( m_stubann->style().opacity() );
const QString width = QString::number( m_stubann->style().width() );

@ -750,7 +750,7 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const
if ( d->m_flags ) // Strip internal flags
e.setAttribute( QStringLiteral("flags"), d->m_flags & ~(External | ExternallyDrawn | BeingMoved | BeingResized ) );
if ( d->m_style.color().isValid() )
e.setAttribute( QStringLiteral("color"), d->m_style.color().name() );
e.setAttribute( QStringLiteral("color"), d->m_style.color().name( QColor::HexArgb ) );
if ( d->m_style.opacity() != 1.0 )
e.setAttribute( QStringLiteral("opacity"), QString::number( d->m_style.opacity() ) );

@ -19,37 +19,37 @@ Engine/Annotation Types [specific attributes]:
<annotatingTools>
<tool id="1" type="note-linked">
<engine type="PickPoint" color="#ffff00" hoverIcon="tool-note">
<annotation type="Text" color="#ffff00" icon="Note" />
<annotation type="Text" color="#ffffff00" icon="Note" />
</engine>
<shortcut>1</shortcut>
</tool>
<tool id="2" type="note-inline">
<engine type="PickPoint" color="#ffff00" hoverIcon="tool-note-inline" block="true">
<annotation type="FreeText" color="#ffff00" />
<annotation type="FreeText" color="#ffffff00" />
</engine>
<shortcut>2</shortcut>
</tool>
<tool id="3" type="ink">
<engine type="SmoothLine" color="#00ff00">
<annotation type="Ink" color="#00ff00" width="2" />
<annotation type="Ink" color="#ff00ff00" width="2" />
</engine>
<shortcut>3</shortcut>
</tool>
<tool id="4" type="highlight">
<engine type="TextSelector" color="#ffff00">
<annotation type="Highlight" color="#ffff00" />
<annotation type="Highlight" color="#ffffff00" />
</engine>
<shortcut>4</shortcut>
</tool>
<tool id="5" type="straight-line">
<engine type="PolyLine" color="#ffe000" points="2">
<annotation type="Line" width="1" color="#ffe000" />
<annotation type="Line" width="1" color="#ffffe000" />
</engine>
<shortcut>5</shortcut>
</tool>
<tool id="6" type="polygon">
<engine type="PolyLine" color="#007eee" points="-1">
<annotation type="Line" width="1" color="#007eee" />
<annotation type="Line" width="1" color="#ff007eee" />
</engine>
<shortcut>6</shortcut>
</tool>
@ -61,13 +61,13 @@ Engine/Annotation Types [specific attributes]:
</tool>
<tool id="8" type="underline">
<engine type="TextSelector" color="#000000">
<annotation type="Underline" color="#000000" />
<annotation type="Underline" color="#ff000000" />
</engine>
<shortcut>8</shortcut>
</tool>
<tool id="9" type="ellipse">
<engine type="PickPoint" color="#00ffff" block="true">
<annotation type="GeomCircle" width="5" color="#00ffff" />
<annotation type="GeomCircle" width="5" color="#ff00ffff" />
</engine>
<shortcut>9</shortcut>
</tool>

Loading…
Cancel
Save