From d61cef693d965ffdd930065d7c41f72e18e823d3 Mon Sep 17 00:00:00 2001 From: Dileep Sankhla Date: Tue, 4 Sep 2018 22:07:33 +0200 Subject: [PATCH] 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 --- conf/editannottooldialog.cpp | 2 +- core/annotations.cpp | 2 +- ui/data/tools.xml | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conf/editannottooldialog.cpp b/conf/editannottooldialog.cpp index 64a01ab59..77bd1ba6a 100644 --- a/conf/editannottooldialog.cpp +++ b/conf/editannottooldialog.cpp @@ -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() ); diff --git a/core/annotations.cpp b/core/annotations.cpp index 3ac567063..b480182e6 100644 --- a/core/annotations.cpp +++ b/core/annotations.cpp @@ -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() ) ); diff --git a/ui/data/tools.xml b/ui/data/tools.xml index 1fd590481..2848b2049 100644 --- a/ui/data/tools.xml +++ b/ui/data/tools.xml @@ -19,37 +19,37 @@ Engine/Annotation Types [specific attributes]: - + 1 - + 2 - + 3 - + 4 - + 5 - + 6 @@ -61,13 +61,13 @@ Engine/Annotation Types [specific attributes]: - + 8 - + 9