Commit d61cef69 authored by Dileep Sankhla's avatar Dileep Sankhla Committed by Tobias Deiminger

Store all annotation color attributes as ARGB string

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:
parent 736f801d
......@@ -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]:
<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" />
<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" />
<tool id="3" type="ink">
<engine type="SmoothLine" color="#00ff00">
<annotation type="Ink" color="#00ff00" width="2" />
<annotation type="Ink" color="#ff00ff00" width="2" />
<tool id="4" type="highlight">
<engine type="TextSelector" color="#ffff00">
<annotation type="Highlight" color="#ffff00" />
<annotation type="Highlight" color="#ffffff00" />
<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" />
<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" />
......@@ -61,13 +61,13 @@ Engine/Annotation Types [specific attributes]:
<tool id="8" type="underline">
<engine type="TextSelector" color="#000000">
<annotation type="Underline" color="#000000" />
<annotation type="Underline" color="#ff000000" />
<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" />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment