on xenial help sign in
Add a few const & to params of functions
commit5b999d932d01a5518bbaf08e07b9bca496102e06 authorAlbert Astals <albert.astals@canonical.com> dateMon 1 Jul 2013, 13:12 (13 years ago) parent99d28f4
4 files changed+16−16
plugins/LightDM/Greeter.cpp+6−6 plugins/LightDM/Greeter.h+4−4 plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+3−3 plugins/Ubuntu/Gestures/DirectionalDragArea.h+3−3
plugins/LightDM/Greeter.cpp+6−6
@@ -102,21 +102,21 @@ bool Greeter::startSessionSync(const QString &session)
102102 return d->m_greeter->startSessionSync(session);
103103}
104104
105−void Greeter::showPromptFilter(QString text, QLightDM::Greeter::PromptType type)
105+void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
106106{
107107 Q_D(Greeter);
108108 d->wasPrompted = true;
109109
110110 // Strip prompt of any colons at the end
111− text = text.trimmed();
112− if (text.endsWith(":") || text.endsWith(":")) {
113− text.chop(1);
111+ QString trimmedText = text.trimmed();
112+ if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
113+ trimmedText.chop(1);
114114 }
115115
116− Q_EMIT showPrompt(text, type == QLightDM::Greeter::PromptTypeSecret);
116+ Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret);
117117}
118118
119−void Greeter::showMessageFilter(QString text, QLightDM::Greeter::MessageType type)
119+void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
120120{
121121 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
122122}
plugins/LightDM/Greeter.h+4−4
@@ -51,8 +51,8 @@ public Q_SLOTS:
5151 bool startSessionSync(const QString &session=QString());
5252
5353Q_SIGNALS:
54− void showMessage(QString text, bool isError);
55− void showPrompt(QString text, bool isSecret);
54+ void showMessage(const QString &text, bool isError);
55+ void showPrompt(const QString &text, bool isSecret);
5656 void authenticationComplete();
5757 void promptlessChanged();
5858
@@ -62,8 +62,8 @@ private:
6262 Q_DECLARE_PRIVATE(Greeter)
6363
6464private Q_SLOTS:
65− void showMessageFilter(QString text, QLightDM::Greeter::MessageType type);
66− void showPromptFilter(QString text, QLightDM::Greeter::PromptType type);
65+ void showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type);
66+ void showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type);
6767 void authenticationCompleteFilter();
6868};
6969
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+3−3
@@ -404,7 +404,7 @@ void DirectionalDragArea::setStatus(DirectionalDragArea::Status newStatus)
404404 }
405405}
406406
407−void DirectionalDragArea::setPreviousPos(QPointF point)
407+void DirectionalDragArea::setPreviousPos(const QPointF &point)
408408{
409409 Q_ASSERT(m_status != Rejected);
410410
@@ -426,7 +426,7 @@ void DirectionalDragArea::setPreviousPos(QPointF point)
426426 }
427427}
428428
429−void DirectionalDragArea::setPreviousScenePos(QPointF point)
429+void DirectionalDragArea::setPreviousScenePos(const QPointF &point)
430430{
431431 Q_ASSERT(m_status != Rejected);
432432
@@ -448,7 +448,7 @@ void DirectionalDragArea::setPreviousScenePos(QPointF point)
448448 }
449449}
450450
451−void DirectionalDragArea::updateVelocityCalculator(QPointF point)
451+void DirectionalDragArea::updateVelocityCalculator(const QPointF &point)
452452{
453453 if (Direction::isHorizontal(m_direction)) {
454454 m_velocityCalculator->setTrackedPosition(point.x());
plugins/Ubuntu/Gestures/DirectionalDragArea.h+3−3
@@ -219,9 +219,9 @@ private:
219219 bool movedFarEnough(const QPointF &point) const;
220220 const QTouchEvent::TouchPoint *fetchTargetTouchPoint(QTouchEvent *event);
221221 void setStatus(Status newStatus);
222− void setPreviousPos(QPointF point);
223− void setPreviousScenePos(QPointF point);
224− void updateVelocityCalculator(QPointF point);
222+ void setPreviousPos(const QPointF &point);
223+ void setPreviousScenePos(const QPointF &point);
224+ void updateVelocityCalculator(const QPointF &point);
225225
226226 Status m_status;
227227