Commit 4e0c1690 authored by Simone Gaiarin's avatar Simone Gaiarin

Uniform the case of the 'Id' suffix in variable names

parent 5d947905
Pipeline #33426 passed with stage
in 28 minutes and 34 seconds
...@@ -83,7 +83,7 @@ public: ...@@ -83,7 +83,7 @@ public:
* matches a default stamp, any existing stamp annotation action is removed. * matches a default stamp, any existing stamp annotation action is removed.
*/ */
void maybeUpdateCustomStampAction(const QString &stampIconName); void maybeUpdateCustomStampAction(const QString &stampIconName);
void parseTool(int toolID); void parseTool(int toolId);
void updateConfigActions(const QString &annotType = QLatin1String("")); void updateConfigActions(const QString &annotType = QLatin1String(""));
void populateQuickAnnotations(); void populateQuickAnnotations();
...@@ -92,9 +92,9 @@ public: ...@@ -92,9 +92,9 @@ public:
const QIcon widthIcon(double width); const QIcon widthIcon(double width);
const QIcon stampIcon(const QString &stampIconName); const QIcon stampIcon(const QString &stampIconName);
void selectTool(int toolID); void selectTool(int toolId);
void slotStampToolSelected(const QString &stamp); void slotStampToolSelected(const QString &stamp);
void slotQuickToolSelected(int favToolID); void slotQuickToolSelected(int favToolId);
void slotSetColor(AnnotationColor colorType, const QColor &color = QColor()); void slotSetColor(AnnotationColor colorType, const QColor &color = QColor());
void slotSelectAnnotationFont(); void slotSelectAnnotationFont();
void slotToolBarVisibilityChanged(bool checked); void slotToolBarVisibilityChanged(bool checked);
...@@ -196,14 +196,14 @@ void AnnotationActionHandlerPrivate::maybeUpdateCustomStampAction(const QString ...@@ -196,14 +196,14 @@ void AnnotationActionHandlerPrivate::maybeUpdateCustomStampAction(const QString
} }
} }
void AnnotationActionHandlerPrivate::parseTool(int toolID) void AnnotationActionHandlerPrivate::parseTool(int toolId)
{ {
if (toolID == -1) { if (toolId == -1) {
updateConfigActions(); updateConfigActions();
return; return;
} }
QDomElement toolElement = annotator->builtinTool(toolID); QDomElement toolElement = annotator->builtinTool(toolId);
const QString annotType = toolElement.attribute(QStringLiteral("type")); const QString annotType = toolElement.attribute(QStringLiteral("type"));
QDomElement engineElement = toolElement.firstChildElement(QStringLiteral("engine")); QDomElement engineElement = toolElement.firstChildElement(QStringLiteral("engine"));
QDomElement annElement = engineElement.firstChildElement(QStringLiteral("annotation")); QDomElement annElement = engineElement.firstChildElement(QStringLiteral("annotation"));
...@@ -421,11 +421,11 @@ const QIcon AnnotationActionHandlerPrivate::stampIcon(const QString &stampIconNa ...@@ -421,11 +421,11 @@ const QIcon AnnotationActionHandlerPrivate::stampIcon(const QString &stampIconNa
return QIcon::fromTheme(QStringLiteral("tag")); return QIcon::fromTheme(QStringLiteral("tag"));
} }
void AnnotationActionHandlerPrivate::selectTool(int toolID) void AnnotationActionHandlerPrivate::selectTool(int toolId)
{ {
selectedTool = toolID; selectedTool = toolId;
annotator->selectTool(toolID); annotator->selectTool(toolId);
parseTool(toolID); parseTool(toolId);
} }
void AnnotationActionHandlerPrivate::slotStampToolSelected(const QString &stamp) void AnnotationActionHandlerPrivate::slotStampToolSelected(const QString &stamp)
...@@ -435,17 +435,17 @@ 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 annotator->selectStampTool(stamp); // triggers a reparsing thus calling parseTool
} }
void AnnotationActionHandlerPrivate::slotQuickToolSelected(int favToolID) void AnnotationActionHandlerPrivate::slotQuickToolSelected(int favToolId)
{ {
int toolID = annotator->setQuickTool(favToolID); // always triggers an unuseful reparsing int toolId = annotator->setQuickTool(favToolId); // always triggers an unuseful reparsing
if (toolID == -1) { if (toolId == -1) {
qWarning("Corrupted configuration for quick annotation tool with id: %d", favToolID); qWarning("Corrupted configuration for quick annotation tool with id: %d", favToolId);
return; return;
} }
int indexOfActionInGroup = toolID - 1; int indexOfActionInGroup = toolId - 1;
if (toolID == PageViewAnnotator::STAMP_TOOL_ID) { if (toolId == PageViewAnnotator::STAMP_TOOL_ID) {
// if the quick tool is a stamp we need to find its corresponding built-in tool action and select it // if the quick tool is a stamp we need to find its corresponding built-in tool action and select it
QDomElement favToolElement = annotator->quickTool(favToolID); QDomElement favToolElement = annotator->quickTool(favToolId);
QDomElement engineElement = favToolElement.firstChildElement(QStringLiteral("engine")); QDomElement engineElement = favToolElement.firstChildElement(QStringLiteral("engine"));
QDomElement annotationElement = engineElement.firstChildElement(QStringLiteral("annotation")); QDomElement annotationElement = engineElement.firstChildElement(QStringLiteral("annotation"));
QString stampIconName = annotationElement.attribute(QStringLiteral("icon")); QString stampIconName = annotationElement.attribute(QStringLiteral("icon"));
...@@ -465,7 +465,7 @@ void AnnotationActionHandlerPrivate::slotQuickToolSelected(int favToolID) ...@@ -465,7 +465,7 @@ void AnnotationActionHandlerPrivate::slotQuickToolSelected(int favToolID)
// when new tool if different from the selected one // when new tool if different from the selected one
favToolAction->trigger(); favToolAction->trigger();
} else { } else {
selectTool(toolID); selectTool(toolId);
} }
aShowToolBar->setChecked(true); aShowToolBar->setChecked(true);
} }
......
...@@ -663,10 +663,10 @@ public: ...@@ -663,10 +663,10 @@ public:
return tools; return tools;
} }
QDomElement tool(int toolID) QDomElement tool(int toolId)
{ {
QDomElement toolElement = m_toolsDefinition.documentElement().firstChildElement(); QDomElement toolElement = m_toolsDefinition.documentElement().firstChildElement();
while (!toolElement.isNull() && toolElement.attribute(QStringLiteral("id")).toInt() != toolID) { while (!toolElement.isNull() && toolElement.attribute(QStringLiteral("id")).toInt() != toolId) {
toolElement = toolElement.nextSiblingElement(); toolElement = toolElement.nextSiblingElement();
} }
return toolElement; // can return a null element return toolElement; // can return a null element
...@@ -679,20 +679,20 @@ public: ...@@ -679,20 +679,20 @@ public:
m_toolsDefinition.documentElement().appendChild(toolElement); m_toolsDefinition.documentElement().appendChild(toolElement);
} }
bool updateTool(QDomElement newToolElement, int toolID) bool updateTool(QDomElement newToolElement, int toolId)
{ {
QDomElement toolElement = tool(toolID); QDomElement toolElement = tool(toolId);
if (toolElement.isNull()) if (toolElement.isNull())
return false; return false;
newToolElement = newToolElement.cloneNode().toElement(); newToolElement = newToolElement.cloneNode().toElement();
newToolElement.setAttribute(QStringLiteral("id"), toolID); newToolElement.setAttribute(QStringLiteral("id"), toolId);
QDomNode oldTool = m_toolsDefinition.documentElement().replaceChild(newToolElement, toolElement); QDomNode oldTool = m_toolsDefinition.documentElement().replaceChild(newToolElement, toolElement);
return !oldTool.isNull(); return !oldTool.isNull();
} }
int findToolId(const QString &type) int findToolId(const QString &type)
{ {
int toolID = -1; int toolId = -1;
if (type.isEmpty()) { if (type.isEmpty()) {
return -1; return -1;
} }
...@@ -704,12 +704,12 @@ public: ...@@ -704,12 +704,12 @@ public:
} }
if (!toolElement.isNull() && toolElement.hasAttribute(QStringLiteral("id"))) { if (!toolElement.isNull() && toolElement.hasAttribute(QStringLiteral("id"))) {
bool ok; bool ok;
toolID = toolElement.attribute(QStringLiteral("id")).toInt(&ok); toolId = toolElement.attribute(QStringLiteral("id")).toInt(&ok);
if (!ok) { if (!ok) {
return -1; return -1;
} }
} }
return toolID; return toolId;
} }
private: private:
...@@ -730,7 +730,7 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage ...@@ -730,7 +730,7 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage
, m_quickToolsDefinition(nullptr) , m_quickToolsDefinition(nullptr)
, m_continuousMode(true) , m_continuousMode(true)
, m_constrainRatioAndAngle(false) , m_constrainRatioAndAngle(false)
, m_lastToolID(-1) , m_lastToolId(-1)
, m_lockedItem(nullptr) , m_lockedItem(nullptr)
{ {
reparseConfig(); reparseConfig();
...@@ -848,7 +848,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E ...@@ -848,7 +848,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E
} }
if (m_continuousMode) if (m_continuousMode)
selectTool(m_lastToolID); selectTool(m_lastToolId);
else else
detachAnnotation(); detachAnnotation();
} }
...@@ -935,10 +935,10 @@ void PageViewAnnotator::routePaint(QPainter *painter, const QRect paintRect) ...@@ -935,10 +935,10 @@ void PageViewAnnotator::routePaint(QPainter *painter, const QRect paintRect)
painter->restore(); painter->restore();
} }
void PageViewAnnotator::selectTool(int toolID) void PageViewAnnotator::selectTool(int toolId)
{ {
// ask for Author's name if not already set // ask for Author's name if not already set
if (toolID > 0 && Okular::Settings::identityAuthor().isEmpty()) { if (toolId > 0 && Okular::Settings::identityAuthor().isEmpty()) {
// get default username from the kdelibs/kdecore/KUser // get default username from the kdelibs/kdecore/KUser
KUser currentUser; KUser currentUser;
QString userName = currentUser.property(KUser::FullName).toString(); QString userName = currentUser.property(KUser::FullName).toString();
...@@ -969,17 +969,17 @@ void PageViewAnnotator::selectTool(int toolID) ...@@ -969,17 +969,17 @@ void PageViewAnnotator::selectTool(int toolID)
} }
// store current tool for later usage // store current tool for later usage
m_lastToolID = toolID; m_lastToolId = toolId;
// handle tool deselection // handle tool deselection
if (toolID == -1) { if (toolId == -1) {
m_pageView->displayMessage(QString()); m_pageView->displayMessage(QString());
m_pageView->updateCursor(); m_pageView->updateCursor();
return; return;
} }
// for the selected tool create the Engine // for the selected tool create the Engine
QDomElement toolElement = m_builtinToolsDefinition->tool(toolID); QDomElement toolElement = m_builtinToolsDefinition->tool(toolId);
if (!toolElement.isNull()) { if (!toolElement.isNull()) {
// parse tool properties // parse tool properties
QDomElement engineElement = toolElement.firstChildElement(QStringLiteral("engine")); QDomElement engineElement = toolElement.firstChildElement(QStringLiteral("engine"));
...@@ -1040,7 +1040,7 @@ void PageViewAnnotator::selectTool(int toolID) ...@@ -1040,7 +1040,7 @@ void PageViewAnnotator::selectTool(int toolID)
m_pageView->updateCursor(); m_pageView->updateCursor();
} }
if (toolID > 0) if (toolId > 0)
emit toolSelected(); emit toolSelected();
} }
...@@ -1280,10 +1280,10 @@ void PageViewAnnotator::saveAnnotationTools() ...@@ -1280,10 +1280,10 @@ void PageViewAnnotator::saveAnnotationTools()
Okular::Settings::self()->save(); Okular::Settings::self()->save();
} }
int PageViewAnnotator::setQuickTool(int favToolID) int PageViewAnnotator::setQuickTool(int favToolId)
{ {
int toolId = -1; int toolId = -1;
QDomElement favToolElement = m_quickToolsDefinition->tool(favToolID); QDomElement favToolElement = m_quickToolsDefinition->tool(favToolId);
if (!favToolElement.isNull()) { if (!favToolElement.isNull()) {
toolId = m_builtinToolsDefinition->findToolId(favToolElement.attribute(QStringLiteral("type"))); toolId = m_builtinToolsDefinition->findToolId(favToolElement.attribute(QStringLiteral("type")));
if (toolId == -1) { if (toolId == -1) {
...@@ -1295,19 +1295,19 @@ int PageViewAnnotator::setQuickTool(int favToolID) ...@@ -1295,19 +1295,19 @@ int PageViewAnnotator::setQuickTool(int favToolID)
return toolId; return toolId;
} }
QDomElement PageViewAnnotator::builtinTool(int toolID) QDomElement PageViewAnnotator::builtinTool(int toolId)
{ {
return m_builtinToolsDefinition->tool(toolID); return m_builtinToolsDefinition->tool(toolId);
} }
QDomElement PageViewAnnotator::quickTool(int toolID) QDomElement PageViewAnnotator::quickTool(int toolId)
{ {
return m_quickToolsDefinition->tool(toolID); return m_quickToolsDefinition->tool(toolId);
} }
QDomElement PageViewAnnotator::currentEngineElement() QDomElement PageViewAnnotator::currentEngineElement()
{ {
return m_builtinToolsDefinition->tool(m_lastToolID).firstChildElement(QStringLiteral("engine")); return m_builtinToolsDefinition->tool(m_lastToolId).firstChildElement(QStringLiteral("engine"));
} }
QDomElement PageViewAnnotator::currentAnnotationElement() QDomElement PageViewAnnotator::currentAnnotationElement()
...@@ -1319,7 +1319,7 @@ void PageViewAnnotator::setAnnotationWidth(double width) ...@@ -1319,7 +1319,7 @@ void PageViewAnnotator::setAnnotationWidth(double width)
{ {
currentAnnotationElement().setAttribute(QStringLiteral("width"), QString::number(width)); currentAnnotationElement().setAttribute(QStringLiteral("width"), QString::number(width));
saveAnnotationTools(); saveAnnotationTools();
selectTool(m_lastToolID); selectTool(m_lastToolId);
} }
void PageViewAnnotator::setAnnotationColor(const QColor &color) void PageViewAnnotator::setAnnotationColor(const QColor &color)
...@@ -1333,7 +1333,7 @@ void PageViewAnnotator::setAnnotationColor(const QColor &color) ...@@ -1333,7 +1333,7 @@ void PageViewAnnotator::setAnnotationColor(const QColor &color)
annotationElement.setAttribute(QStringLiteral("color"), color.name(QColor::HexRgb)); annotationElement.setAttribute(QStringLiteral("color"), color.name(QColor::HexRgb));
} }
saveAnnotationTools(); saveAnnotationTools();
selectTool(m_lastToolID); selectTool(m_lastToolId);
} }
void PageViewAnnotator::setAnnotationInnerColor(const QColor &color) void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
...@@ -1345,26 +1345,26 @@ void PageViewAnnotator::setAnnotationInnerColor(const QColor &color) ...@@ -1345,26 +1345,26 @@ void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
annotationElement.setAttribute(QStringLiteral("innerColor"), color.name(QColor::HexRgb)); annotationElement.setAttribute(QStringLiteral("innerColor"), color.name(QColor::HexRgb));
} }
saveAnnotationTools(); saveAnnotationTools();
selectTool(m_lastToolID); selectTool(m_lastToolId);
} }
void PageViewAnnotator::setAnnotationOpacity(double opacity) void PageViewAnnotator::setAnnotationOpacity(double opacity)
{ {
currentAnnotationElement().setAttribute(QStringLiteral("opacity"), QString::number(opacity)); currentAnnotationElement().setAttribute(QStringLiteral("opacity"), QString::number(opacity));
saveAnnotationTools(); saveAnnotationTools();
selectTool(m_lastToolID); selectTool(m_lastToolId);
} }
void PageViewAnnotator::setAnnotationFont(const QFont &font) void PageViewAnnotator::setAnnotationFont(const QFont &font)
{ {
currentAnnotationElement().setAttribute(QStringLiteral("font"), font.toString()); currentAnnotationElement().setAttribute(QStringLiteral("font"), font.toString());
saveAnnotationTools(); saveAnnotationTools();
selectTool(m_lastToolID); selectTool(m_lastToolId);
} }
void PageViewAnnotator::addToQuickAnnotations() void PageViewAnnotator::addToQuickAnnotations()
{ {
QDomElement sourceToolElement = m_builtinToolsDefinition->tool(m_lastToolID); QDomElement sourceToolElement = m_builtinToolsDefinition->tool(m_lastToolId);
if (sourceToolElement.isNull()) if (sourceToolElement.isNull())
return; return;
...@@ -1384,17 +1384,17 @@ void PageViewAnnotator::addToQuickAnnotations() ...@@ -1384,17 +1384,17 @@ void PageViewAnnotator::addToQuickAnnotations()
void PageViewAnnotator::slotAdvancedSettings() void PageViewAnnotator::slotAdvancedSettings()
{ {
QDomElement toolElement = m_builtinToolsDefinition->tool(m_lastToolID); QDomElement toolElement = m_builtinToolsDefinition->tool(m_lastToolId);
EditAnnotToolDialog t(nullptr, toolElement, true); EditAnnotToolDialog t(nullptr, toolElement, true);
if (t.exec() != QDialog::Accepted) if (t.exec() != QDialog::Accepted)
return; return;
QDomElement toolElementUpdated = t.toolXml().documentElement(); QDomElement toolElementUpdated = t.toolXml().documentElement();
int toolID = toolElement.attribute(QStringLiteral("id")).toInt(); int toolId = toolElement.attribute(QStringLiteral("id")).toInt();
m_builtinToolsDefinition->updateTool(toolElementUpdated, toolID); m_builtinToolsDefinition->updateTool(toolElementUpdated, toolId);
saveAnnotationTools(); saveAnnotationTools();
selectTool(m_lastToolID); selectTool(m_lastToolId);
} }
#include "moc_pageviewannotator.cpp" #include "moc_pageviewannotator.cpp"
......
...@@ -103,18 +103,18 @@ public: ...@@ -103,18 +103,18 @@ public:
void setTextToolsEnabled(bool enabled); void setTextToolsEnabled(bool enabled);
// selects the active tool // selects the active tool
void selectTool(int toolID); void selectTool(int toolId);
// selects a stamp tool and sets the stamp symbol // selects a stamp tool and sets the stamp symbol
void selectStampTool(const QString &stampSymbol); void selectStampTool(const QString &stampSymbol);
// makes a quick annotation the active tool // makes a quick annotation the active tool
int setQuickTool(int toolID); int setQuickTool(int toolId);
// deselects the tool and uncheck all the annotation actions // deselects the tool and uncheck all the annotation actions
void detachAnnotation(); void detachAnnotation();
// returns the builtin annotation tool with the given Id // returns the builtin annotation tool with the given Id
QDomElement builtinTool(int toolID); QDomElement builtinTool(int toolId);
// returns the quick annotation tool with the given Id // returns the quick annotation tool with the given Id
QDomElement quickTool(int toolID); QDomElement quickTool(int toolId);
// methods that write the properties // methods that write the properties
void setAnnotationWidth(double width); void setAnnotationWidth(double width);
...@@ -155,7 +155,7 @@ private: ...@@ -155,7 +155,7 @@ private:
bool m_constrainRatioAndAngle; bool m_constrainRatioAndAngle;
// creation related variables // creation related variables
int m_lastToolID; int m_lastToolId;
QRect m_lastDrawnRect; QRect m_lastDrawnRect;
PageViewItem *m_lockedItem; PageViewItem *m_lockedItem;
// selected annotation name // selected annotation name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment