mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-05 00:58:46 +00:00
Made icon for Note annotations configurable
Unlike Stamp annotations, hoverIcon and icon are different in Note annotations.
This commit is contained in:
parent
8b88b73732
commit
18981a6707
|
@ -264,12 +264,11 @@ QString NewAnnotToolDialog::toolXml() const
|
|||
if ( toolType == "note-linked" )
|
||||
{
|
||||
Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann );
|
||||
Q_UNUSED( ta );
|
||||
return QString( "<tool type=\"note-linked\">"
|
||||
"<engine type=\"PickPoint\" color=\"%1\" hoverIcon=\"tool-note\">"
|
||||
"<annotation type=\"Text\" color=\"%1\" opacity=\"%2\" />"
|
||||
"<annotation type=\"Text\" color=\"%1\" opacity=\"%2\" icon=\"%3\" />"
|
||||
"</engine>"
|
||||
"</tool>" ).arg( color ).arg( opacity );
|
||||
"</tool>" ).arg( color ).arg( opacity ).arg( ta->textIcon() );
|
||||
}
|
||||
else if ( toolType == "note-inline" )
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ Engine/Annotation Types [specific attributes]:
|
|||
<tool id="1" name="Note" type="note-linked">
|
||||
<tooltip>Text Annotation</tooltip>
|
||||
<engine type="PickPoint" color="#FFFF00" hoverIcon="tool-note">
|
||||
<annotation type="Text" color="#FFFF00" />
|
||||
<annotation type="Text" color="#FFFF00" icon="Note" />
|
||||
</engine>
|
||||
<shortcut>1</shortcut>
|
||||
</tool>
|
||||
|
|
|
@ -48,10 +48,10 @@ class PickPointEngine : public AnnotatorEngine
|
|||
xscale( 1.0 ), yscale( 1.0 )
|
||||
{
|
||||
// parse engine specific attributes
|
||||
pixmapName = engineElement.attribute( "hoverIcon" );
|
||||
const QString stampname = m_annotElement.attribute( "icon" );
|
||||
if ( m_annotElement.attribute( "type" ) == "Stamp" && !stampname.simplified().isEmpty() )
|
||||
pixmapName = stampname;
|
||||
hoverIconName = engineElement.attribute( "hoverIcon" );
|
||||
iconName = m_annotElement.attribute( "icon" );
|
||||
if ( m_annotElement.attribute( "type" ) == "Stamp" && !iconName.simplified().isEmpty() )
|
||||
hoverIconName = iconName;
|
||||
center = QVariant( engineElement.attribute( "center" ) ).toBool();
|
||||
bool ok = true;
|
||||
size = engineElement.attribute( "size", "32" ).toInt( &ok );
|
||||
|
@ -60,8 +60,8 @@ class PickPointEngine : public AnnotatorEngine
|
|||
m_block = QVariant( engineElement.attribute( "block" ) ).toBool();
|
||||
|
||||
// create engine objects
|
||||
if ( !pixmapName.simplified().isEmpty() )
|
||||
pixmap = new QPixmap( GuiUtils::loadStamp( pixmapName, QSize( size, size ) ) );
|
||||
if ( !hoverIconName.simplified().isEmpty() )
|
||||
pixmap = new QPixmap( GuiUtils::loadStamp( hoverIconName, QSize( size, size ) ) );
|
||||
}
|
||||
|
||||
~PickPointEngine()
|
||||
|
@ -187,7 +187,7 @@ class PickPointEngine : public AnnotatorEngine
|
|||
Okular::TextAnnotation * ta = new Okular::TextAnnotation();
|
||||
ann = ta;
|
||||
ta->setTextType( Okular::TextAnnotation::Linked );
|
||||
ta->setTextIcon( "Note" );
|
||||
ta->setTextIcon( iconName );
|
||||
ta->window().setText( QString() );
|
||||
//ta->window.flags &= ~(Okular::Annotation::Hidden);
|
||||
const double iconhei=0.03;
|
||||
|
@ -202,7 +202,7 @@ class PickPointEngine : public AnnotatorEngine
|
|||
{
|
||||
Okular::StampAnnotation * sa = new Okular::StampAnnotation();
|
||||
ann = sa;
|
||||
sa->setStampIconName( pixmapName );
|
||||
sa->setStampIconName( iconName );
|
||||
// set boundary
|
||||
rect.left = qMin( startpoint.x, point.x );
|
||||
rect.top = qMin( startpoint.y, point.y );
|
||||
|
@ -281,7 +281,7 @@ class PickPointEngine : public AnnotatorEngine
|
|||
Okular::NormalizedPoint startpoint;
|
||||
Okular::NormalizedPoint point;
|
||||
QPixmap * pixmap;
|
||||
QString pixmapName;
|
||||
QString hoverIconName, iconName;
|
||||
int size;
|
||||
double xscale,yscale;
|
||||
double pagewidth, pageheight;
|
||||
|
|
Loading…
Reference in New Issue
Block a user