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
580cbce8
Commit
580cbce8
authored
Oct 24, 2020
by
Simone Gaiarin
Browse files
Selectively reparse builtin and quick annotation tool configuration
parent
91dbaa1f
Changes
7
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
580cbce8
...
...
@@ -437,7 +437,7 @@ ki18n_wrap_ui(okularpart_SRCS
conf/dlgpresentationbase.ui
)
kconfig_add_kcfg_files
(
okularpart_SRCS conf/settings.kcfgc
)
kconfig_add_kcfg_files
(
okularpart_SRCS
GENERATE_MOC
conf/settings.kcfgc
)
add_library
(
okularpart SHARED
${
okularpart_SRCS
}
)
generate_export_header
(
okularpart BASE_NAME okularpart
)
...
...
conf/okular.kcfg
View file @
580cbce8
...
...
@@ -5,6 +5,8 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"
>
<include>
kuser.h
</include>
<kcfgfile
arg=
"true"
/>
<signal
name=
"builtinAnnotationToolsChanged"
/>
<signal
name=
"quickAnnotationToolsChanged"
/>
<group
name=
"Dlg Performance"
>
<entry
key=
"EnableCompositing"
type=
"Bool"
>
<default>
true
</default>
...
...
@@ -116,6 +118,7 @@
}
</code>
<default
code=
"true"
>
builtinAnnotationTools
</default>
<emit
signal=
"builtinAnnotationToolsChanged"
/>
</entry>
<entry
key=
"QuickAnnotationTools"
type=
"StringList"
>
<code>
...
...
@@ -154,6 +157,7 @@
}
</code>
<default
code=
"true"
>
quickAnnotationTools
</default>
<emit
signal=
"quickAnnotationToolsChanged"
/>
</entry>
<entry
key=
"AnnotationContinuousMode"
type=
"Bool"
>
<default>
true
</default>
...
...
mobile/components/CMakeLists.txt
View file @
580cbce8
...
...
@@ -20,7 +20,7 @@ set(okular_SRCS
okularsingleton.cpp
)
kconfig_add_kcfg_files
(
okular_SRCS
${
CMAKE_SOURCE_DIR
}
/conf/settings_mobile.kcfgc
)
kconfig_add_kcfg_files
(
okular_SRCS
GENERATE_MOC
${
CMAKE_SOURCE_DIR
}
/conf/settings_mobile.kcfgc
)
add_library
(
okularplugin SHARED
${
okular_SRCS
}
)
set_target_properties
(
okularplugin PROPERTIES COMPILE_DEFINITIONS
"okularpart_EXPORTS"
)
...
...
ui/annotationactionhandler.cpp
View file @
580cbce8
...
...
@@ -726,9 +726,13 @@ void AnnotationActionHandler::setupAnnotationToolBarVisibilityAction()
connect
(
d
->
aShowToolBar
,
&
QAction
::
toggled
,
this
,
[
this
](
bool
checked
)
{
d
->
slotToolBarVisibilityChanged
(
checked
);
});
}
void
AnnotationActionHandler
::
reparse
Tools
()
void
AnnotationActionHandler
::
reparse
BuiltinToolsConfig
()
{
d
->
parseTool
(
d
->
selectedTool
);
}
void
AnnotationActionHandler
::
reparseQuickToolsConfig
()
{
d
->
populateQuickAnnotations
();
}
...
...
ui/annotationactionhandler.h
View file @
580cbce8
...
...
@@ -39,7 +39,8 @@ public:
* selected, an annotation property (line width, colors, opacity, font) is modified.
*/
void
setupAnnotationToolBarVisibilityAction
();
void
reparseTools
();
void
reparseBuiltinToolsConfig
();
void
reparseQuickToolsConfig
();
void
setToolsEnabled
(
bool
on
);
void
setTextToolsEnabled
(
bool
on
);
void
deselectAllAnnotationActions
();
...
...
ui/pageviewannotator.cpp
View file @
580cbce8
...
...
@@ -733,26 +733,40 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage
,
m_lockedItem
(
nullptr
)
{
reparseConfig
();
reparseBuiltinToolsConfig
();
reparseQuickToolsConfig
();
connect
(
Okular
::
Settings
::
self
(),
&
Okular
::
Settings
::
builtinAnnotationToolsChanged
,
this
,
&
PageViewAnnotator
::
reparseBuiltinToolsConfig
);
connect
(
Okular
::
Settings
::
self
(),
&
Okular
::
Settings
::
quickAnnotationToolsChanged
,
this
,
&
PageViewAnnotator
::
reparseQuickToolsConfig
);
}
void
PageViewAnnotator
::
reparseConfig
()
{
m_continuousMode
=
Okular
::
Settings
::
annotationContinuousMode
();
if
(
Okular
::
Settings
::
identityAuthor
().
isEmpty
())
detachAnnotation
();
}
void
PageViewAnnotator
::
reparseBuiltinToolsConfig
()
{
// Read tool list from configuration. It's a list of XML <tool></tool> elements
if
(
!
m_builtinToolsDefinition
)
m_builtinToolsDefinition
=
new
AnnotationTools
();
m_builtinToolsDefinition
->
setTools
(
Okular
::
Settings
::
builtinAnnotationTools
());
if
(
m_actionHandler
)
m_actionHandler
->
reparseBuiltinToolsConfig
();
}
void
PageViewAnnotator
::
reparseQuickToolsConfig
()
{
// Read tool list from configuration. It's a list of XML <tool></tool> elements
if
(
!
m_quickToolsDefinition
)
m_quickToolsDefinition
=
new
AnnotationTools
();
m_quickToolsDefinition
->
setTools
(
Okular
::
Settings
::
quickAnnotationTools
());
m_continuousMode
=
Okular
::
Settings
::
annotationContinuousMode
();
if
(
Okular
::
Settings
::
identityAuthor
().
isEmpty
())
detachAnnotation
();
if
(
m_actionHandler
)
m_actionHandler
->
reparse
Tools
();
m_actionHandler
->
reparse
QuickToolsConfig
();
}
PageViewAnnotator
::~
PageViewAnnotator
()
...
...
ui/pageviewannotator.h
View file @
580cbce8
...
...
@@ -137,6 +137,8 @@ Q_SIGNALS:
void
toolSelected
();
private:
void
reparseBuiltinToolsConfig
();
void
reparseQuickToolsConfig
();
// save the annotation tools to Okular settings
void
saveAnnotationTools
();
// returns the engine QDomElement of the the currently active tool
...
...
Write
Preview
Markdown
is supported
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