Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Graphics
Okular
Commits
4e0c1690
Commit
4e0c1690
authored
Aug 30, 2020
by
Simone Gaiarin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uniform the case of the 'Id' suffix in variable names
parent
5d947905
Pipeline
#33426
passed with stage
in 28 minutes and 34 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
56 deletions
+56
-56
ui/annotationactionhandler.cpp
ui/annotationactionhandler.cpp
+18
-18
ui/pageviewannotator.cpp
ui/pageviewannotator.cpp
+33
-33
ui/pageviewannotator.h
ui/pageviewannotator.h
+5
-5
No files found.
ui/annotationactionhandler.cpp
View file @
4e0c1690
...
...
@@ -83,7 +83,7 @@ public:
* matches a default stamp, any existing stamp annotation action is removed.
*/
void
maybeUpdateCustomStampAction
(
const
QString
&
stampIconName
);
void
parseTool
(
int
toolI
D
);
void
parseTool
(
int
toolI
d
);
void
updateConfigActions
(
const
QString
&
annotType
=
QLatin1String
(
""
));
void
populateQuickAnnotations
();
...
...
@@ -92,9 +92,9 @@ public:
const
QIcon
widthIcon
(
double
width
);
const
QIcon
stampIcon
(
const
QString
&
stampIconName
);
void
selectTool
(
int
toolI
D
);
void
selectTool
(
int
toolI
d
);
void
slotStampToolSelected
(
const
QString
&
stamp
);
void
slotQuickToolSelected
(
int
favToolI
D
);
void
slotQuickToolSelected
(
int
favToolI
d
);
void
slotSetColor
(
AnnotationColor
colorType
,
const
QColor
&
color
=
QColor
());
void
slotSelectAnnotationFont
();
void
slotToolBarVisibilityChanged
(
bool
checked
);
...
...
@@ -196,14 +196,14 @@ void AnnotationActionHandlerPrivate::maybeUpdateCustomStampAction(const QString
}
}
void
AnnotationActionHandlerPrivate
::
parseTool
(
int
toolI
D
)
void
AnnotationActionHandlerPrivate
::
parseTool
(
int
toolI
d
)
{
if
(
toolI
D
==
-
1
)
{
if
(
toolI
d
==
-
1
)
{
updateConfigActions
();
return
;
}
QDomElement
toolElement
=
annotator
->
builtinTool
(
toolI
D
);
QDomElement
toolElement
=
annotator
->
builtinTool
(
toolI
d
);
const
QString
annotType
=
toolElement
.
attribute
(
QStringLiteral
(
"type"
));
QDomElement
engineElement
=
toolElement
.
firstChildElement
(
QStringLiteral
(
"engine"
));
QDomElement
annElement
=
engineElement
.
firstChildElement
(
QStringLiteral
(
"annotation"
));
...
...
@@ -421,11 +421,11 @@ const QIcon AnnotationActionHandlerPrivate::stampIcon(const QString &stampIconNa
return
QIcon
::
fromTheme
(
QStringLiteral
(
"tag"
));
}
void
AnnotationActionHandlerPrivate
::
selectTool
(
int
toolI
D
)
void
AnnotationActionHandlerPrivate
::
selectTool
(
int
toolI
d
)
{
selectedTool
=
toolI
D
;
annotator
->
selectTool
(
toolI
D
);
parseTool
(
toolI
D
);
selectedTool
=
toolI
d
;
annotator
->
selectTool
(
toolI
d
);
parseTool
(
toolI
d
);
}
void
AnnotationActionHandlerPrivate
::
slotStampToolSelected
(
const
QString
&
stamp
)
...
...
@@ -435,17 +435,17 @@ void AnnotationActionHandlerPrivate::slotStampToolSelected(const QString &stamp)
annotator
->
selectStampTool
(
stamp
);
// triggers a reparsing thus calling parseTool
}
void
AnnotationActionHandlerPrivate
::
slotQuickToolSelected
(
int
favToolI
D
)
void
AnnotationActionHandlerPrivate
::
slotQuickToolSelected
(
int
favToolI
d
)
{
int
toolI
D
=
annotator
->
setQuickTool
(
favToolI
D
);
// always triggers an unuseful reparsing
if
(
toolI
D
==
-
1
)
{
qWarning
(
"Corrupted configuration for quick annotation tool with id: %d"
,
favToolI
D
);
int
toolI
d
=
annotator
->
setQuickTool
(
favToolI
d
);
// always triggers an unuseful reparsing
if
(
toolI
d
==
-
1
)
{
qWarning
(
"Corrupted configuration for quick annotation tool with id: %d"
,
favToolI
d
);
return
;
}
int
indexOfActionInGroup
=
toolI
D
-
1
;
if
(
toolI
D
==
PageViewAnnotator
::
STAMP_TOOL_ID
)
{
int
indexOfActionInGroup
=
toolI
d
-
1
;
if
(
toolI
d
==
PageViewAnnotator
::
STAMP_TOOL_ID
)
{
// if the quick tool is a stamp we need to find its corresponding built-in tool action and select it
QDomElement
favToolElement
=
annotator
->
quickTool
(
favToolI
D
);
QDomElement
favToolElement
=
annotator
->
quickTool
(
favToolI
d
);
QDomElement
engineElement
=
favToolElement
.
firstChildElement
(
QStringLiteral
(
"engine"
));
QDomElement
annotationElement
=
engineElement
.
firstChildElement
(
QStringLiteral
(
"annotation"
));
QString
stampIconName
=
annotationElement
.
attribute
(
QStringLiteral
(
"icon"
));
...
...
@@ -465,7 +465,7 @@ void AnnotationActionHandlerPrivate::slotQuickToolSelected(int favToolID)
// when new tool if different from the selected one
favToolAction
->
trigger
();
}
else
{
selectTool
(
toolI
D
);
selectTool
(
toolI
d
);
}
aShowToolBar
->
setChecked
(
true
);
}
...
...
ui/pageviewannotator.cpp
View file @
4e0c1690
...
...
@@ -663,10 +663,10 @@ public:
return
tools
;
}
QDomElement
tool
(
int
toolI
D
)
QDomElement
tool
(
int
toolI
d
)
{
QDomElement
toolElement
=
m_toolsDefinition
.
documentElement
().
firstChildElement
();
while
(
!
toolElement
.
isNull
()
&&
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
()
!=
toolI
D
)
{
while
(
!
toolElement
.
isNull
()
&&
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
()
!=
toolI
d
)
{
toolElement
=
toolElement
.
nextSiblingElement
();
}
return
toolElement
;
// can return a null element
...
...
@@ -679,20 +679,20 @@ public:
m_toolsDefinition
.
documentElement
().
appendChild
(
toolElement
);
}
bool
updateTool
(
QDomElement
newToolElement
,
int
toolI
D
)
bool
updateTool
(
QDomElement
newToolElement
,
int
toolI
d
)
{
QDomElement
toolElement
=
tool
(
toolI
D
);
QDomElement
toolElement
=
tool
(
toolI
d
);
if
(
toolElement
.
isNull
())
return
false
;
newToolElement
=
newToolElement
.
cloneNode
().
toElement
();
newToolElement
.
setAttribute
(
QStringLiteral
(
"id"
),
toolI
D
);
newToolElement
.
setAttribute
(
QStringLiteral
(
"id"
),
toolI
d
);
QDomNode
oldTool
=
m_toolsDefinition
.
documentElement
().
replaceChild
(
newToolElement
,
toolElement
);
return
!
oldTool
.
isNull
();
}
int
findToolId
(
const
QString
&
type
)
{
int
toolI
D
=
-
1
;
int
toolI
d
=
-
1
;
if
(
type
.
isEmpty
())
{
return
-
1
;
}
...
...
@@ -704,12 +704,12 @@ public:
}
if
(
!
toolElement
.
isNull
()
&&
toolElement
.
hasAttribute
(
QStringLiteral
(
"id"
)))
{
bool
ok
;
toolI
D
=
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
(
&
ok
);
toolI
d
=
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
(
&
ok
);
if
(
!
ok
)
{
return
-
1
;
}
}
return
toolI
D
;
return
toolI
d
;
}
private:
...
...
@@ -730,7 +730,7 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage
,
m_quickToolsDefinition
(
nullptr
)
,
m_continuousMode
(
true
)
,
m_constrainRatioAndAngle
(
false
)
,
m_lastToolI
D
(
-
1
)
,
m_lastToolI
d
(
-
1
)
,
m_lockedItem
(
nullptr
)
{
reparseConfig
();
...
...
@@ -848,7 +848,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E
}
if
(
m_continuousMode
)
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
else
detachAnnotation
();
}
...
...
@@ -935,10 +935,10 @@ void PageViewAnnotator::routePaint(QPainter *painter, const QRect paintRect)
painter
->
restore
();
}
void
PageViewAnnotator
::
selectTool
(
int
toolI
D
)
void
PageViewAnnotator
::
selectTool
(
int
toolI
d
)
{
// ask for Author's name if not already set
if
(
toolI
D
>
0
&&
Okular
::
Settings
::
identityAuthor
().
isEmpty
())
{
if
(
toolI
d
>
0
&&
Okular
::
Settings
::
identityAuthor
().
isEmpty
())
{
// get default username from the kdelibs/kdecore/KUser
KUser
currentUser
;
QString
userName
=
currentUser
.
property
(
KUser
::
FullName
).
toString
();
...
...
@@ -969,17 +969,17 @@ void PageViewAnnotator::selectTool(int toolID)
}
// store current tool for later usage
m_lastToolI
D
=
toolI
D
;
m_lastToolI
d
=
toolI
d
;
// handle tool deselection
if
(
toolI
D
==
-
1
)
{
if
(
toolI
d
==
-
1
)
{
m_pageView
->
displayMessage
(
QString
());
m_pageView
->
updateCursor
();
return
;
}
// for the selected tool create the Engine
QDomElement
toolElement
=
m_builtinToolsDefinition
->
tool
(
toolI
D
);
QDomElement
toolElement
=
m_builtinToolsDefinition
->
tool
(
toolI
d
);
if
(
!
toolElement
.
isNull
())
{
// parse tool properties
QDomElement
engineElement
=
toolElement
.
firstChildElement
(
QStringLiteral
(
"engine"
));
...
...
@@ -1040,7 +1040,7 @@ void PageViewAnnotator::selectTool(int toolID)
m_pageView
->
updateCursor
();
}
if
(
toolI
D
>
0
)
if
(
toolI
d
>
0
)
emit
toolSelected
();
}
...
...
@@ -1280,10 +1280,10 @@ void PageViewAnnotator::saveAnnotationTools()
Okular
::
Settings
::
self
()
->
save
();
}
int
PageViewAnnotator
::
setQuickTool
(
int
favToolI
D
)
int
PageViewAnnotator
::
setQuickTool
(
int
favToolI
d
)
{
int
toolId
=
-
1
;
QDomElement
favToolElement
=
m_quickToolsDefinition
->
tool
(
favToolI
D
);
QDomElement
favToolElement
=
m_quickToolsDefinition
->
tool
(
favToolI
d
);
if
(
!
favToolElement
.
isNull
())
{
toolId
=
m_builtinToolsDefinition
->
findToolId
(
favToolElement
.
attribute
(
QStringLiteral
(
"type"
)));
if
(
toolId
==
-
1
)
{
...
...
@@ -1295,19 +1295,19 @@ int PageViewAnnotator::setQuickTool(int favToolID)
return
toolId
;
}
QDomElement
PageViewAnnotator
::
builtinTool
(
int
toolI
D
)
QDomElement
PageViewAnnotator
::
builtinTool
(
int
toolI
d
)
{
return
m_builtinToolsDefinition
->
tool
(
toolI
D
);
return
m_builtinToolsDefinition
->
tool
(
toolI
d
);
}
QDomElement
PageViewAnnotator
::
quickTool
(
int
toolI
D
)
QDomElement
PageViewAnnotator
::
quickTool
(
int
toolI
d
)
{
return
m_quickToolsDefinition
->
tool
(
toolI
D
);
return
m_quickToolsDefinition
->
tool
(
toolI
d
);
}
QDomElement
PageViewAnnotator
::
currentEngineElement
()
{
return
m_builtinToolsDefinition
->
tool
(
m_lastToolI
D
).
firstChildElement
(
QStringLiteral
(
"engine"
));
return
m_builtinToolsDefinition
->
tool
(
m_lastToolI
d
).
firstChildElement
(
QStringLiteral
(
"engine"
));
}
QDomElement
PageViewAnnotator
::
currentAnnotationElement
()
...
...
@@ -1319,7 +1319,7 @@ void PageViewAnnotator::setAnnotationWidth(double width)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"width"
),
QString
::
number
(
width
));
saveAnnotationTools
();
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
}
void
PageViewAnnotator
::
setAnnotationColor
(
const
QColor
&
color
)
...
...
@@ -1333,7 +1333,7 @@ void PageViewAnnotator::setAnnotationColor(const QColor &color)
annotationElement
.
setAttribute
(
QStringLiteral
(
"color"
),
color
.
name
(
QColor
::
HexRgb
));
}
saveAnnotationTools
();
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
}
void
PageViewAnnotator
::
setAnnotationInnerColor
(
const
QColor
&
color
)
...
...
@@ -1345,26 +1345,26 @@ void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
annotationElement
.
setAttribute
(
QStringLiteral
(
"innerColor"
),
color
.
name
(
QColor
::
HexRgb
));
}
saveAnnotationTools
();
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
}
void
PageViewAnnotator
::
setAnnotationOpacity
(
double
opacity
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"opacity"
),
QString
::
number
(
opacity
));
saveAnnotationTools
();
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
}
void
PageViewAnnotator
::
setAnnotationFont
(
const
QFont
&
font
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"font"
),
font
.
toString
());
saveAnnotationTools
();
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
}
void
PageViewAnnotator
::
addToQuickAnnotations
()
{
QDomElement
sourceToolElement
=
m_builtinToolsDefinition
->
tool
(
m_lastToolI
D
);
QDomElement
sourceToolElement
=
m_builtinToolsDefinition
->
tool
(
m_lastToolI
d
);
if
(
sourceToolElement
.
isNull
())
return
;
...
...
@@ -1384,17 +1384,17 @@ void PageViewAnnotator::addToQuickAnnotations()
void
PageViewAnnotator
::
slotAdvancedSettings
()
{
QDomElement
toolElement
=
m_builtinToolsDefinition
->
tool
(
m_lastToolI
D
);
QDomElement
toolElement
=
m_builtinToolsDefinition
->
tool
(
m_lastToolI
d
);
EditAnnotToolDialog
t
(
nullptr
,
toolElement
,
true
);
if
(
t
.
exec
()
!=
QDialog
::
Accepted
)
return
;
QDomElement
toolElementUpdated
=
t
.
toolXml
().
documentElement
();
int
toolI
D
=
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
();
m_builtinToolsDefinition
->
updateTool
(
toolElementUpdated
,
toolI
D
);
int
toolI
d
=
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
();
m_builtinToolsDefinition
->
updateTool
(
toolElementUpdated
,
toolI
d
);
saveAnnotationTools
();
selectTool
(
m_lastToolI
D
);
selectTool
(
m_lastToolI
d
);
}
#include "moc_pageviewannotator.cpp"
...
...
ui/pageviewannotator.h
View file @
4e0c1690
...
...
@@ -103,18 +103,18 @@ public:
void
setTextToolsEnabled
(
bool
enabled
);
// selects the active tool
void
selectTool
(
int
toolI
D
);
void
selectTool
(
int
toolI
d
);
// selects a stamp tool and sets the stamp symbol
void
selectStampTool
(
const
QString
&
stampSymbol
);
// makes a quick annotation the active tool
int
setQuickTool
(
int
toolI
D
);
int
setQuickTool
(
int
toolI
d
);
// deselects the tool and uncheck all the annotation actions
void
detachAnnotation
();
// returns the builtin annotation tool with the given Id
QDomElement
builtinTool
(
int
toolI
D
);
QDomElement
builtinTool
(
int
toolI
d
);
// returns the quick annotation tool with the given Id
QDomElement
quickTool
(
int
toolI
D
);
QDomElement
quickTool
(
int
toolI
d
);
// methods that write the properties
void
setAnnotationWidth
(
double
width
);
...
...
@@ -155,7 +155,7 @@ private:
bool
m_constrainRatioAndAngle
;
// creation related variables
int
m_lastToolI
D
;
int
m_lastToolI
d
;
QRect
m_lastDrawnRect
;
PageViewItem
*
m_lockedItem
;
// selected annotation name
...
...
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