[games/chessament] src/tournament: Rename & constify variable

Manuel Alcaraz Zambrano <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit f5cdb7fa066c4e3c7f92953267fb397f423ebfbb by Manuel Alcaraz Zambrano.
Committed on 06/08/2026 at 12:39.
Pushed by manuelal into branch 'master'.

Rename & constify variable

M  +3    -3    src/tournament/timecontrol.cpp
M  +1    -1    src/tournament/timecontrol.h
M  +2    -2    src/tournament/tournament.cpp

https://invent.kde.org/games/chessament/-/commit/f5cdb7fa066c4e3c7f92953267fb397f423ebfbb

diff --git a/src/tournament/timecontrol.cpp b/src/tournament/timecontrol.cpp
index c332834..3d72dff 100644
--- a/src/tournament/timecontrol.cpp
+++ b/src/tournament/timecontrol.cpp
@@ -162,7 +162,7 @@ std::chrono::seconds TimeControl::durationPerPlayer() const
 {
     std::chrono::seconds duration{};
 
-    for (const auto period : periods()) {
+    for (const auto &period : periods()) {
         duration += std::chrono::seconds(period.time() + (period.increment() * 60));
     }
 
@@ -182,7 +182,7 @@ TimeControl::Format TimeControl::format() const
     return TimeControl::Format::Classical;
 }
 
-QJsonObject TimeControl::json()
+QJsonObject TimeControl::toJson() const
 {
     return m_json;
 }
@@ -191,7 +191,7 @@ QString TimeControl::toTrf() const
 {
     QStringList values;
 
-    for (const auto period : periods()) {
+    for (const auto &period : periods()) {
         values << period.toTrf();
     }
 
diff --git a/src/tournament/timecontrol.h b/src/tournament/timecontrol.h
index 50f476b..1a2816e 100644
--- a/src/tournament/timecontrol.h
+++ b/src/tournament/timecontrol.h
@@ -54,7 +54,7 @@ struct TimeControl {
 
     [[nodiscard]] TimeControl::Format format() const;
 
-    QJsonObject json();
+    [[nodiscard]] QJsonObject toJson() const;
 
     [[nodiscard]] QString toTrf() const;
 
diff --git a/src/tournament/tournament.cpp b/src/tournament/tournament.cpp
index a77ffaa..d8be452 100644
--- a/src/tournament/tournament.cpp
+++ b/src/tournament/tournament.cpp
@@ -118,9 +118,9 @@ TimeControl &Tournament::timeControl()
 
 void Tournament::saveTimeControl()
 {
-    const auto text = QJsonDocument{m_timeControl.json()}.toJson(QJsonDocument::JsonFormat::Compact);
+    const auto text = QJsonDocument{m_timeControl.toJson()}.toJson(QJsonDocument::JsonFormat::Compact);
 
-    qDebug() << m_timeControl.json();
+    qDebug() << m_timeControl.toJson();
 
     setOption(u"time_control"_s, text);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.