From f11350e3555a64328b50089fa555c85d56315ef1 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Mon, 3 Jun 2013 19:31:17 +0200 Subject: [PATCH] const'ify --- src/smallruler.cpp | 2 +- src/smallruler.h | 2 +- src/statusbarmessagelabel.cpp | 6 +++--- src/titledocument.cpp | 2 +- src/titlewidget.cpp | 14 ++++++-------- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/smallruler.cpp b/src/smallruler.cpp index 8505e2ff..ee77912f 100644 --- a/src/smallruler.cpp +++ b/src/smallruler.cpp @@ -114,7 +114,7 @@ void SmallRuler::setMarkers(const QList &list) updatePixmap(); } -QPoint SmallRuler::zone() +QPoint SmallRuler::zone() const { return QPoint(m_zoneStart, m_zoneEnd); } diff --git a/src/smallruler.h b/src/smallruler.h index 44451607..5c18ba9d 100644 --- a/src/smallruler.h +++ b/src/smallruler.h @@ -37,7 +37,7 @@ public: void setZone(int start, int end); void setZoneStart(); void setZoneEnd(); - QPoint zone(); + QPoint zone() const; void setMarkers(const QList < CommentedTime >& list); void updatePalette(); void refreshRuler(); diff --git a/src/statusbarmessagelabel.cpp b/src/statusbarmessagelabel.cpp index acc24487..1cb0a064 100644 --- a/src/statusbarmessagelabel.cpp +++ b/src/statusbarmessagelabel.cpp @@ -112,7 +112,7 @@ bool StatusBarMessageLabel::slotMessageTimeout() bool newMessage = false; // Get the next message from the queue, unless the current one needs to be confirmed - if (m_messageQueue.size() > 0) { + if (!m_messageQueue.isEmpty()) { if (!m_currentMessage.needsConfirmation()) { @@ -124,12 +124,12 @@ bool StatusBarMessageLabel::slotMessageTimeout() } // If the queue is empty, add a default (empty) message - if (m_messageQueue.size() == 0 && m_currentMessage.type != DefaultMessage) { + if (m_messageQueue.isEmpty() && m_currentMessage.type != DefaultMessage) { m_messageQueue.push_back(StatusBarMessageItem()); } // Start a new timer, unless the current message still needs to be confirmed - if (m_messageQueue.size() > 0) { + if (!m_messageQueue.isEmpty()) { if (!m_currentMessage.needsConfirmation()) { diff --git a/src/titledocument.cpp b/src/titledocument.cpp index 5d29e1bf..16fcda43 100644 --- a/src/titledocument.cpp +++ b/src/titledocument.cpp @@ -562,7 +562,7 @@ QColor TitleDocument::stringToColor(const QString & s) QTransform TitleDocument::stringToTransform(const QString& s) { - QStringList l = s.split(','); + QStringList l = s.split(QLatin1Char(',')); if (l.size() < 9) return QTransform(); return QTransform( diff --git a/src/titlewidget.cpp b/src/titlewidget.cpp index a92d6bac..e8184fab 100644 --- a/src/titlewidget.cpp +++ b/src/titlewidget.cpp @@ -503,8 +503,9 @@ TitleWidget::TitleWidget(const KUrl &url, const Timecode &tc, const QString &pro // scale the view so that the title widget is not too big at startup graphicsView->scale(.5, .5); - if (!url.isEmpty()) loadTitle(url); - else { + if (!url.isEmpty()) { + loadTitle(url); + } else { prepareTools(NULL); slotTextTool(); QTimer::singleShot(200, this, SLOT(slotAdjustZoom())); @@ -645,7 +646,8 @@ void TitleWidget::templateIndexChanged(int index) QString item = templateBox->itemData(index).toString(); if (!item.isEmpty()) { if (lastDocumentHash != QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex()) { - if (KMessageBox::questionYesNo(this, i18n("Do you really want to load a new template? Changes in this title will be lost!")) == KMessageBox::No) return; + if (KMessageBox::questionYesNo(this, i18n("Do you really want to load a new template? Changes in this title will be lost!")) == KMessageBox::No) + return; } loadTitle(item); @@ -1081,10 +1083,7 @@ void TitleWidget::selectionChanged() zUp->setEnabled(false); zDown->setEnabled(false); } - - } - } void TitleWidget::slotValueChanged(int type) @@ -1621,8 +1620,7 @@ void TitleWidget::slotUpdateText() void TitleWidget::rectChanged() { QList l = graphicsView->scene()->selectedItems(); - int i; - for (i = 0; i < l.length(); ++i) { + for (int i = 0; i < l.length(); ++i) { if (l.at(i)->type() == RECTITEM && !settingUp) { QGraphicsRectItem *rec = static_cast(l.at(i)); QColor f = rectFColor->color(); -- 2.39.2