Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Graphics
Okular
Commits
023976cc
Commit
023976cc
authored
Nov 18, 2020
by
Albert Astals Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show annotation tip when selecting the tool in continuous mode
BUGS: 426782
parent
a61977aa
Pipeline
#42092
passed with stage
in 30 minutes and 55 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
45 deletions
+48
-45
part/annotationactionhandler.cpp
part/annotationactionhandler.cpp
+1
-1
part/pageviewannotator.cpp
part/pageviewannotator.cpp
+45
-43
part/pageviewannotator.h
part/pageviewannotator.h
+2
-1
No files found.
part/annotationactionhandler.cpp
View file @
023976cc
...
...
@@ -422,7 +422,7 @@ const QIcon AnnotationActionHandlerPrivate::stampIcon(const QString &stampIconNa
void
AnnotationActionHandlerPrivate
::
selectTool
(
int
toolId
)
{
selectedTool
=
toolId
;
annotator
->
selectTool
(
toolId
);
annotator
->
selectTool
(
toolId
,
PageViewAnnotator
::
ShowTip
::
Yes
);
parseTool
(
toolId
);
}
...
...
part/pageviewannotator.cpp
View file @
023976cc
...
...
@@ -863,7 +863,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E
}
if
(
m_continuousMode
)
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
else
detachAnnotation
();
}
...
...
@@ -950,7 +950,7 @@ void PageViewAnnotator::routePaint(QPainter *painter, const QRect paintRect)
painter
->
restore
();
}
void
PageViewAnnotator
::
selectTool
(
int
toolId
)
void
PageViewAnnotator
::
selectTool
(
int
toolId
,
ShowTip
showTip
)
{
// ask for Author's name if not already set
if
(
toolId
>
0
&&
Okular
::
Settings
::
identityAuthor
().
isEmpty
())
{
...
...
@@ -1012,39 +1012,41 @@ void PageViewAnnotator::selectTool(int toolId)
else
qCWarning
(
OkularUiDebug
).
nospace
()
<<
"tools.xml: engine type:'"
<<
type
<<
"' is not defined!"
;
// display the tooltip
const
QString
annotType
=
toolElement
.
attribute
(
QStringLiteral
(
"type"
));
QString
tip
;
if
(
annotType
==
QLatin1String
(
"ellipse"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw an ellipse (drag to select a zone)"
);
else
if
(
annotType
==
QLatin1String
(
"highlight"
))
tip
=
i18nc
(
"Annotation tool"
,
"Highlight text"
);
else
if
(
annotType
==
QLatin1String
(
"ink"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a freehand line"
);
else
if
(
annotType
==
QLatin1String
(
"note-inline"
))
tip
=
i18nc
(
"Annotation tool"
,
"Inline Text Annotation (drag to select a zone)"
);
else
if
(
annotType
==
QLatin1String
(
"note-linked"
))
tip
=
i18nc
(
"Annotation tool"
,
"Put a pop-up note"
);
else
if
(
annotType
==
QLatin1String
(
"polygon"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a polygon (click on the first point to close it)"
);
else
if
(
annotType
==
QLatin1String
(
"rectangle"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a rectangle"
);
else
if
(
annotType
==
QLatin1String
(
"squiggly"
))
tip
=
i18nc
(
"Annotation tool"
,
"Squiggle text"
);
else
if
(
annotType
==
QLatin1String
(
"stamp"
))
tip
=
i18nc
(
"Annotation tool"
,
"Put a stamp symbol"
);
else
if
(
annotType
==
QLatin1String
(
"straight-line"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a straight line"
);
else
if
(
annotType
==
QLatin1String
(
"strikeout"
))
tip
=
i18nc
(
"Annotation tool"
,
"Strike out text"
);
else
if
(
annotType
==
QLatin1String
(
"underline"
))
tip
=
i18nc
(
"Annotation tool"
,
"Underline text"
);
else
if
(
annotType
==
QLatin1String
(
"typewriter"
))
tip
=
i18nc
(
"Annotation tool"
,
"Typewriter Annotation (drag to select a zone)"
);
if
(
!
tip
.
isEmpty
()
&&
!
m_continuousMode
)
m_pageView
->
displayMessage
(
tip
,
QString
(),
PageViewMessage
::
Annotation
);
if
(
showTip
==
ShowTip
::
Yes
)
{
// display the tooltip
const
QString
annotType
=
toolElement
.
attribute
(
QStringLiteral
(
"type"
));
QString
tip
;
if
(
annotType
==
QLatin1String
(
"ellipse"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw an ellipse (drag to select a zone)"
);
else
if
(
annotType
==
QLatin1String
(
"highlight"
))
tip
=
i18nc
(
"Annotation tool"
,
"Highlight text"
);
else
if
(
annotType
==
QLatin1String
(
"ink"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a freehand line"
);
else
if
(
annotType
==
QLatin1String
(
"note-inline"
))
tip
=
i18nc
(
"Annotation tool"
,
"Inline Text Annotation (drag to select a zone)"
);
else
if
(
annotType
==
QLatin1String
(
"note-linked"
))
tip
=
i18nc
(
"Annotation tool"
,
"Put a pop-up note"
);
else
if
(
annotType
==
QLatin1String
(
"polygon"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a polygon (click on the first point to close it)"
);
else
if
(
annotType
==
QLatin1String
(
"rectangle"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a rectangle"
);
else
if
(
annotType
==
QLatin1String
(
"squiggly"
))
tip
=
i18nc
(
"Annotation tool"
,
"Squiggle text"
);
else
if
(
annotType
==
QLatin1String
(
"stamp"
))
tip
=
i18nc
(
"Annotation tool"
,
"Put a stamp symbol"
);
else
if
(
annotType
==
QLatin1String
(
"straight-line"
))
tip
=
i18nc
(
"Annotation tool"
,
"Draw a straight line"
);
else
if
(
annotType
==
QLatin1String
(
"strikeout"
))
tip
=
i18nc
(
"Annotation tool"
,
"Strike out text"
);
else
if
(
annotType
==
QLatin1String
(
"underline"
))
tip
=
i18nc
(
"Annotation tool"
,
"Underline text"
);
else
if
(
annotType
==
QLatin1String
(
"typewriter"
))
tip
=
i18nc
(
"Annotation tool"
,
"Typewriter Annotation (drag to select a zone)"
);
if
(
!
tip
.
isEmpty
())
m_pageView
->
displayMessage
(
tip
,
QString
(),
PageViewMessage
::
Annotation
);
}
}
// consistency warning
...
...
@@ -1067,12 +1069,12 @@ void PageViewAnnotator::selectStampTool(const QString &stampSymbol)
engineElement
.
setAttribute
(
QStringLiteral
(
"hoverIcon"
),
stampSymbol
);
annotationElement
.
setAttribute
(
QStringLiteral
(
"icon"
),
stampSymbol
);
saveBuiltinAnnotationTools
();
selectTool
(
STAMP_TOOL_ID
);
selectTool
(
STAMP_TOOL_ID
,
ShowTip
::
Yes
);
}
void
PageViewAnnotator
::
detachAnnotation
()
{
selectTool
(
-
1
);
selectTool
(
-
1
,
ShowTip
::
No
);
if
(
m_actionHandler
)
m_actionHandler
->
deselectAllAnnotationActions
();
}
...
...
@@ -1333,7 +1335,7 @@ void PageViewAnnotator::setAnnotationWidth(double width)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"width"
),
QString
::
number
(
width
));
saveBuiltinAnnotationTools
();
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
}
void
PageViewAnnotator
::
setAnnotationColor
(
const
QColor
&
color
)
...
...
@@ -1347,7 +1349,7 @@ void PageViewAnnotator::setAnnotationColor(const QColor &color)
annotationElement
.
setAttribute
(
QStringLiteral
(
"color"
),
color
.
name
(
QColor
::
HexRgb
));
}
saveBuiltinAnnotationTools
();
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
}
void
PageViewAnnotator
::
setAnnotationInnerColor
(
const
QColor
&
color
)
...
...
@@ -1359,21 +1361,21 @@ void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
annotationElement
.
setAttribute
(
QStringLiteral
(
"innerColor"
),
color
.
name
(
QColor
::
HexRgb
));
}
saveBuiltinAnnotationTools
();
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
}
void
PageViewAnnotator
::
setAnnotationOpacity
(
double
opacity
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"opacity"
),
QString
::
number
(
opacity
));
saveBuiltinAnnotationTools
();
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
}
void
PageViewAnnotator
::
setAnnotationFont
(
const
QFont
&
font
)
{
currentAnnotationElement
().
setAttribute
(
QStringLiteral
(
"font"
),
font
.
toString
());
saveBuiltinAnnotationTools
();
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
}
void
PageViewAnnotator
::
addToQuickAnnotations
()
...
...
@@ -1409,7 +1411,7 @@ void PageViewAnnotator::slotAdvancedSettings()
int
toolId
=
toolElement
.
attribute
(
QStringLiteral
(
"id"
)).
toInt
();
m_builtinToolsDefinition
->
updateTool
(
toolElementUpdated
,
toolId
);
saveBuiltinAnnotationTools
();
selectTool
(
m_lastToolId
);
selectTool
(
m_lastToolId
,
ShowTip
::
No
);
}
#include "moc_pageviewannotator.cpp"
...
...
part/pageviewannotator.h
View file @
023976cc
...
...
@@ -102,8 +102,9 @@ public:
// enable/disable the text-selection annotation actions
void
setTextToolsEnabled
(
bool
enabled
);
enum
class
ShowTip
{
Yes
,
No
};
// selects the active tool
void
selectTool
(
int
toolId
);
void
selectTool
(
int
toolId
,
ShowTip
showTip
);
// selects a stamp tool and sets the stamp symbol
void
selectStampTool
(
const
QString
&
stampSymbol
);
// makes a quick annotation the 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