Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
5c3b67ca
Commit
5c3b67ca
authored
Oct 24, 2020
by
Simone Gaiarin
Browse files
Save builtin and quick annotation tools separately
This should reduce the number of configuration reparses
parent
580cbce8
Pipeline
#38893
passed with stage
in 10 minutes and 49 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
ui/pageviewannotator.cpp
View file @
5c3b67ca
...
...
@@ -1064,7 +1064,7 @@ void PageViewAnnotator::selectStampTool(const QString &stampSymbol)
QDomElement
annotationElement
=
engineElement
.
firstChildElement
(
QStringLiteral
(
"annotation"
));
engineElement
.
setAttribute
(
QStringLiteral
(
"hoverIcon"
),
stampSymbol
);
annotationElement
.
setAttribute
(
QStringLiteral
(
"icon"
),
stampSymbol
);
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
STAMP_TOOL_ID
);
}
...
...
@@ -1286,10 +1286,9 @@ void PageViewAnnotator::setTextToolsEnabled(bool enabled)
m_actionHandler
->
setTextToolsEnabled
(
enabled
);
}
void
PageViewAnnotator
::
saveAnnotationTools
()
void
PageViewAnnotator
::
save
Builtin
AnnotationTools
()
{
Okular
::
Settings
::
setBuiltinAnnotationTools
(
m_builtinToolsDefinition
->
toStringList
());
Okular
::
Settings
::
setQuickAnnotationTools
(
m_quickToolsDefinition
->
toStringList
());
Okular
::
Settings
::
self
()
->
save
();
}
...
...
@@ -1303,7 +1302,7 @@ int PageViewAnnotator::setQuickTool(int favToolId)
return
-
1
;
}
if
(
m_builtinToolsDefinition
->
updateTool
(
favToolElement
,
toolId
))
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
}
return
toolId
;
}
...
...
@@ -1331,7 +1330,7 @@ QDomElement PageViewAnnotator::currentAnnotationElement()
void
PageViewAnnotator
::
setAnnotationWidth
(
double
width
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"width"
),
QString
::
number
(
width
));
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
m_lastToolId
);
}
...
...
@@ -1345,7 +1344,7 @@ void PageViewAnnotator::setAnnotationColor(const QColor &color)
}
else
{
annotationElement
.
setAttribute
(
QStringLiteral
(
"color"
),
color
.
name
(
QColor
::
HexRgb
));
}
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
m_lastToolId
);
}
...
...
@@ -1357,21 +1356,21 @@ void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
}
else
{
annotationElement
.
setAttribute
(
QStringLiteral
(
"innerColor"
),
color
.
name
(
QColor
::
HexRgb
));
}
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
m_lastToolId
);
}
void
PageViewAnnotator
::
setAnnotationOpacity
(
double
opacity
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"opacity"
),
QString
::
number
(
opacity
));
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
m_lastToolId
);
}
void
PageViewAnnotator
::
setAnnotationFont
(
const
QFont
&
font
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"font"
),
font
.
toString
());
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
m_lastToolId
);
}
...
...
@@ -1392,7 +1391,8 @@ void PageViewAnnotator::addToQuickAnnotations()
if
(
!
itemText
.
isEmpty
())
toolElement
.
setAttribute
(
QStringLiteral
(
"name"
),
itemText
);
m_quickToolsDefinition
->
appendTool
(
toolElement
);
saveAnnotationTools
();
Okular
::
Settings
::
setQuickAnnotationTools
(
m_quickToolsDefinition
->
toStringList
());
Okular
::
Settings
::
self
()
->
save
();
}
void
PageViewAnnotator
::
slotAdvancedSettings
()
...
...
@@ -1406,7 +1406,7 @@ void PageViewAnnotator::slotAdvancedSettings()
QDomElement
toolElementUpdated
=
t
.
toolXml
().
documentElement
();
int
toolId
=
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
();
m_builtinToolsDefinition
->
updateTool
(
toolElementUpdated
,
toolId
);
saveAnnotationTools
();
save
Builtin
AnnotationTools
();
selectTool
(
m_lastToolId
);
}
...
...
ui/pageviewannotator.h
View file @
5c3b67ca
...
...
@@ -139,8 +139,8 @@ Q_SIGNALS:
private:
void
reparseBuiltinToolsConfig
();
void
reparseQuickToolsConfig
();
// save the annotation tools to Okular settings
void
saveAnnotationTools
();
// save the
builtin
annotation tools to Okular settings
void
save
Builtin
AnnotationTools
();
// returns the engine QDomElement of the the currently active tool
QDomElement
currentEngineElement
();
// returns the annotation QDomElement of the the currently active tool
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment