on xenial help sign in
Add a few const & to params of functions
5b999d9Albert Astals
plugins/LightDM/Greeter.cpp+6−6
@@ -102,21 +102,21 @@ bool Greeter::startSessionSync(const QString &session)
102 return d->m_greeter->startSessionSync(session);
102 return d->m_greeter->startSessionSync(session);
103}
103}
104
104
105−void Greeter::showPromptFilter(QString text, QLightDM::Greeter::PromptType type)
105+void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
106{
106{
107 Q_D(Greeter);
107 Q_D(Greeter);
108 d->wasPrompted = true;
108 d->wasPrompted = true;
109
109
110 // Strip prompt of any colons at the end
110 // Strip prompt of any colons at the end
111− text = text.trimmed();
111+ QString trimmedText = text.trimmed();
112− if (text.endsWith(":") || text.endsWith(":")) {
112+ if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
113− text.chop(1);
113+ trimmedText.chop(1);
114 }
114 }
115
115
116− Q_EMIT showPrompt(text, type == QLightDM::Greeter::PromptTypeSecret);
116+ Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret);
117}
117}
118
118
119−void Greeter::showMessageFilter(QString text, QLightDM::Greeter::MessageType type)
119+void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
120{
120{
121 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
121 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
122}
122}
plugins/LightDM/Greeter.h+4−4
@@ -51,8 +51,8 @@ public Q_SLOTS:
51 bool startSessionSync(const QString &session=QString());
51 bool startSessionSync(const QString &session=QString());
52
52
53Q_SIGNALS:
53Q_SIGNALS:
54− void showMessage(QString text, bool isError);
54+ void showMessage(const QString &text, bool isError);
55− void showPrompt(QString text, bool isSecret);
55+ void showPrompt(const QString &text, bool isSecret);
56 void authenticationComplete();
56 void authenticationComplete();
57 void promptlessChanged();
57 void promptlessChanged();
58
58
@@ -62,8 +62,8 @@ private:
62 Q_DECLARE_PRIVATE(Greeter)
62 Q_DECLARE_PRIVATE(Greeter)
63
63
64private Q_SLOTS:
64private Q_SLOTS:
65− void showMessageFilter(QString text, QLightDM::Greeter::MessageType type);
65+ void showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type);
66− void showPromptFilter(QString text, QLightDM::Greeter::PromptType type);
66+ void showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type);
67 void authenticationCompleteFilter();
67 void authenticationCompleteFilter();
68};
68};
69
69
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+3−3
@@ -404,7 +404,7 @@ void DirectionalDragArea::setStatus(DirectionalDragArea::Status newStatus)
404 }
404 }
405}
405}
406
406
407−void DirectionalDragArea::setPreviousPos(QPointF point)
407+void DirectionalDragArea::setPreviousPos(const QPointF &point)
408{
408{
409 Q_ASSERT(m_status != Rejected);
409 Q_ASSERT(m_status != Rejected);
410
410
@@ -426,7 +426,7 @@ void DirectionalDragArea::setPreviousPos(QPointF point)
426 }
426 }
427}
427}
428
428
429−void DirectionalDragArea::setPreviousScenePos(QPointF point)
429+void DirectionalDragArea::setPreviousScenePos(const QPointF &point)
430{
430{
431 Q_ASSERT(m_status != Rejected);
431 Q_ASSERT(m_status != Rejected);
432
432
@@ -448,7 +448,7 @@ void DirectionalDragArea::setPreviousScenePos(QPointF point)
448 }
448 }
449}
449}
450
450
451−void DirectionalDragArea::updateVelocityCalculator(QPointF point)
451+void DirectionalDragArea::updateVelocityCalculator(const QPointF &point)
452{
452{
453 if (Direction::isHorizontal(m_direction)) {
453 if (Direction::isHorizontal(m_direction)) {
454 m_velocityCalculator->setTrackedPosition(point.x());
454 m_velocityCalculator->setTrackedPosition(point.x());
plugins/Ubuntu/Gestures/DirectionalDragArea.h+3−3
@@ -219,9 +219,9 @@ private:
219 bool movedFarEnough(const QPointF &point) const;
219 bool movedFarEnough(const QPointF &point) const;
220 const QTouchEvent::TouchPoint *fetchTargetTouchPoint(QTouchEvent *event);
220 const QTouchEvent::TouchPoint *fetchTargetTouchPoint(QTouchEvent *event);
221 void setStatus(Status newStatus);
221 void setStatus(Status newStatus);
222− void setPreviousPos(QPointF point);
222+ void setPreviousPos(const QPointF &point);
223− void setPreviousScenePos(QPointF point);
223+ void setPreviousScenePos(const QPointF &point);
224− void updateVelocityCalculator(QPointF point);
224+ void updateVelocityCalculator(const QPointF &point);
225
225
226 Status m_status;
226 Status m_status;
227
227