Skip to content

Commit 6470888

Browse files
committed

File tree

10 files changed

+30
-30
lines changed

10 files changed

+30
-30
lines changed

src/batch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void Batch::openPathBackground(int row) {
335335
* @arg[in] pathBackground Path to the background image.
336336
* @arg[in] pathParameter Path to the parameter file.
337337
*/
338-
void Batch::addPath(QString pathMovie, QString pathBackground, QString pathParameter) {
338+
void Batch::addPath(const QString &pathMovie, const QString &pathBackground, const QString &pathParameter) {
339339
int row = ui->tablePath->rowCount();
340340
ui->tablePath->insertRow(row);
341341
ui->tablePath->setItem(row, 0, new QTableWidgetItem(pathMovie));
@@ -542,7 +542,7 @@ void Batch::openParameterFile(int row) {
542542
/**
543543
* @brief Reads a parameter file, updates parameters.
544544
*/
545-
bool Batch::loadParameterFile(QString path) {
545+
bool Batch::loadParameterFile(const QString &path) {
546546
QFile parameterFile(path);
547547
if (parameterFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
548548
QTextStream in(&parameterFile);

src/batch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ class Batch : public QWidget {
8888
void startTracking();
8989
void openPathFolder();
9090
void openPathBackground(int);
91-
void addPath(QString, QString, QString);
91+
void addPath(const QString &, const QString &, const QString &);
9292
void removePath();
9393
void removePath(int index);
9494
void updateParameterTable();
95-
bool loadParameterFile(QString path);
95+
bool loadParameterFile(const QString &path);
9696
void openParameterFile(int);
9797

9898
void errors(int code);

src/fasttrack-cli.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is part of Fast Track.
2828

2929
using namespace std;
3030

31-
void loadConfig(QString path, QMap<QString, QString> &parameters) {
31+
void loadConfig(const QString &path, QMap<QString, QString> &parameters) {
3232
QFile parameterFile(path);
3333
if (parameterFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
3434
QTextStream in(&parameterFile);
@@ -246,7 +246,7 @@ int main(int argc, char **argv) {
246246
QObject::connect(tracking, &Tracking::finished, []() {
247247
cout << "Tracking ended normally" << endl;
248248
});
249-
QObject::connect(tracking, &Tracking::forceFinished, [](QString message) {
249+
QObject::connect(tracking, &Tracking::forceFinished, [](const QString &message) {
250250
cout << message.toStdString() << endl;
251251
});
252252

src/interactive.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Interactive::Interactive(QWidget *parent) : QMainWindow(parent),
108108
});
109109
ui->menuView->addAction(replayAction);
110110

111-
connect(ui->slider, &Timeline::valueChanged, this, [this](const int &newValue) {
111+
connect(ui->slider, &Timeline::valueChanged, this, [this](int newValue) {
112112
int index = ui->interactiveTab->currentIndex();
113113
if (index == 0) {
114114
display(newValue);
@@ -371,7 +371,7 @@ Interactive::Interactive(QWidget *parent) : QMainWindow(parent),
371371
});
372372
connect(ui->actionAboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
373373

374-
connect(this, &Interactive::message, this, [this](QString msg) {
374+
connect(this, &Interactive::message, this, [this](const QString &msg) {
375375
QMessageBox msgBox;
376376
msgBox.setIcon(QMessageBox::Critical);
377377
msgBox.setText(QStringLiteral("Error"));
@@ -912,7 +912,7 @@ void Interactive::previewTracking() {
912912
replay->loadReplay(dir);
913913
replayAction->setChecked(true);
914914
});
915-
connect(tracking, &Tracking::forceFinished, this, [this](QString errorMessage) {
915+
connect(tracking, &Tracking::forceFinished, this, [this](const QString &errorMessage) {
916916
ui->slider->setDisabled(false);
917917
ui->previewButton->setDisabled(false);
918918
ui->trackButton->setDisabled(false);
@@ -1193,14 +1193,14 @@ void Interactive::level() {
11931193
autolevel->moveToThread(thread);
11941194

11951195
connect(thread, &QThread::started, autolevel, &AutoLevel::level);
1196-
connect(autolevel, &AutoLevel::forceFinished, this, [this](QString errorMessage) {
1196+
connect(autolevel, &AutoLevel::forceFinished, this, [this](const QString &errorMessage) {
11971197
this->setEnabled(true);
11981198
emit message(errorMessage);
11991199
});
12001200
connect(autolevel, &AutoLevel::finished, this, [this]() {
12011201
this->setEnabled(true);
12021202
});
1203-
connect(autolevel, &AutoLevel::levelParametersChanged, this, [this](QMap<QString, double> levelParameters) {
1203+
connect(autolevel, &AutoLevel::levelParametersChanged, this, [this](const QMap<QString, double> &levelParameters) {
12041204
ui->maxT->setValue(levelParameters.value(QStringLiteral("normAngle")));
12051205
ui->maxL->setValue(levelParameters.value(QStringLiteral("normDist")));
12061206
ui->normArea->setValue(levelParameters.value(QStringLiteral("normArea")));
@@ -1227,7 +1227,7 @@ void Interactive::level() {
12271227
/**
12281228
* @brief Reads a parameter file, updates parameters.
12291229
*/
1230-
void Interactive::loadParameters(QString path) {
1230+
void Interactive::loadParameters(const QString &path) {
12311231
QFile parameterFile(path);
12321232
if (parameterFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
12331233
QTextStream in(&parameterFile);

src/interactive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Interactive : public QMainWindow {
9999
void reset();
100100

101101
void saveSettings();
102-
void loadParameters(QString path);
102+
void loadParameters(const QString &path);
103103
void level();
104104

105105
private:

src/mainwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
116116

117117
interactive = new Interactive(this);
118118
ui->tabWidget->addTab(interactive, tr("Interactive tracking"));
119-
connect(interactive, &Interactive::status, this, [this](QString message) {
119+
connect(interactive, &Interactive::status, this, [this](const QString &message) {
120120
trayIcon->showMessage(QStringLiteral("FastTrack"), message, QSystemTrayIcon::Information, 3000);
121121
});
122122
connect(interactive, &Interactive::modeChanged, this, &MainWindow::setMode);
123123

124124
batch = new Batch(this);
125125
ui->tabWidget->addTab(batch, tr("Batch tracking"));
126-
connect(batch, &Batch::status, this, [this](QString message) {
126+
connect(batch, &Batch::status, this, [this](const QString &message) {
127127
trayIcon->showMessage(QStringLiteral("FastTrack"), message, QSystemTrayIcon::Information, 3000);
128128
});
129129

src/tracking.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ void Tracking::imageProcessing() {
818818
* @param[in] startImage Index of the beginning image.
819819
* @param[in] stopImage Index of the ending image.
820820
*/
821-
Tracking::Tracking(string path, string backgroundPath, int startImage, int stopImage) : m_path{path}, m_backgroundPath{backgroundPath}, video{new VideoReader(m_path)}, m_startImage{startImage}, m_stopImage{stopImage}, connectionName{QString("tracking_%1").arg(QRandomGenerator::global()->generate())} {
821+
Tracking::Tracking(const string &path, const string &backgroundPath, int startImage, int stopImage) : m_path{path}, m_backgroundPath{backgroundPath}, video{new VideoReader(m_path)}, m_startImage{startImage}, m_stopImage{stopImage}, connectionName{QString("tracking_%1").arg(QRandomGenerator::global()->generate())} {
822822
}
823823

824824
/**
@@ -828,7 +828,7 @@ Tracking::Tracking(string path, string backgroundPath, int startImage, int stopI
828828
* @param[in] startImage Index of the beginning image.
829829
* @param[in] stopImage Index of the ending image.
830830
*/
831-
Tracking::Tracking(string path, UMat background, int startImage, int stopImage) : m_path{path}, m_background{background}, video{new VideoReader(m_path)}, m_startImage{startImage}, m_stopImage{stopImage}, connectionName{QString("tracking_%1").arg(QRandomGenerator::global()->generate())} {
831+
Tracking::Tracking(const string &path, const UMat &background, int startImage, int stopImage) : m_path{path}, m_background{background}, video{new VideoReader(m_path)}, m_startImage{startImage}, m_stopImage{stopImage}, connectionName{QString("tracking_%1").arg(QRandomGenerator::global()->generate())} {
832832
}
833833

834834
/**
@@ -946,7 +946,7 @@ void Tracking::startProcess() {
946946
throw std::runtime_error("Can't write log to the disk!");
947947
}
948948
else {
949-
connect(this, &Tracking::forceFinished, [this](QString message) {
949+
connect(this, &Tracking::forceFinished, [this](const QString &message) {
950950
QTextStream out(&m_logFile);
951951
out << QDate::currentDate().toString(QStringLiteral("dd-MMM-yyyy-")) + QTime::currentTime().toString(QStringLiteral("hh-mm-ss")) + '\t' + message.toLower() + '\n';
952952
});
@@ -1028,7 +1028,7 @@ Tracking::~Tracking() {
10281028
* @param[in] path The path to a folder where to write the text file.
10291029
* @param[in] db The database where tracking results are stored already opened.
10301030
*/
1031-
bool Tracking::exportTrackingResult(const QString path, QSqlDatabase db) {
1031+
bool Tracking::exportTrackingResult(const QString &path, const QSqlDatabase &db) {
10321032
QFile outputFile(path + "/tracking.txt");
10331033
if (!outputFile.open(QFile::WriteOnly | QFile::Text)) {
10341034
return false;
@@ -1061,7 +1061,7 @@ bool Tracking::exportTrackingResult(const QString path, QSqlDatabase db) {
10611061
* @param[in] path The path to a folder where to write the text file.
10621062
* @param[in] db The database where tracking results are stored already opened.
10631063
*/
1064-
bool Tracking::importTrackingResult(const QString path, QSqlDatabase db) {
1064+
bool Tracking::importTrackingResult(const QString &path, QSqlDatabase db) {
10651065
QFile file(path + "/tracking.txt");
10661066
if (!file.open(QFile::ReadOnly | QFile::Text)) {
10671067
return false;

src/tracking.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ class Tracking : public QObject {
110110

111111
public:
112112
Tracking() = default;
113-
Tracking(string path, string background, int startImage = 0, int stopImage = -1);
114-
Tracking(string path, UMat background, int startImage = 0, int stopImage = -1);
113+
Tracking(const string &path, const string &background, int startImage = 0, int stopImage = -1);
114+
Tracking(const string &path, const UMat &background, int startImage = 0, int stopImage = -1);
115115
Tracking(const Tracking &) = delete;
116116
Tracking &operator=(const Tracking &) = delete;
117117
~Tracking();
@@ -133,8 +133,8 @@ class Tracking : public QObject {
133133
static UMat backgroundExtraction(VideoReader &video, int n, const int method, const int registrationMethod);
134134
static void registration(UMat imageReference, UMat &frame, int method);
135135
static void binarisation(UMat &frame, char backgroundColor, int value);
136-
static bool exportTrackingResult(const QString path, QSqlDatabase db);
137-
static bool importTrackingResult(const QString path, QSqlDatabase db);
136+
static bool exportTrackingResult(const QString &path, const QSqlDatabase &db);
137+
static bool importTrackingResult(const QString &path, QSqlDatabase db);
138138

139139
UMat m_binaryFrame; /*!< Binary image CV_8U */
140140
UMat m_visuFrame; /*!< Image 8 bit CV_8U */

src/trackingmanager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void TrackingManager::addLogEntry(QMap<QString, QString> log) {
8888
* @param[in] path QString that contains the path to the output file.
8989
* @param[in] line QMap that contains the log entry.
9090
*/
91-
void TrackingManager::appendToFile(QString path, QMap<QString, QString> line) {
91+
void TrackingManager::appendToFile(const QString &path, const QMap<QString, QString> &line) {
9292
QFile file(path);
9393
if (file.open(QIODevice::Append)) {
9494
QDataStream out(&file);
@@ -101,7 +101,7 @@ void TrackingManager::appendToFile(QString path, QMap<QString, QString> line) {
101101
* @param[in] path QString that contains the path to the output file.
102102
* @param[in] lines QList ofQMap that contains log entries.
103103
*/
104-
void TrackingManager::writeToFile(QString path, QList<QMap<QString, QString>> lines) {
104+
void TrackingManager::writeToFile(const QString &path, const QList<QMap<QString, QString>> &lines) {
105105
QFile file(path);
106106
if (file.open(QIODevice::WriteOnly)) {
107107
QDataStream out(&file);
@@ -115,7 +115,7 @@ void TrackingManager::writeToFile(QString path, QList<QMap<QString, QString>> li
115115
* @brief Reads a log file.
116116
* @param[in] path QString that contains the path to the input file.
117117
*/
118-
void TrackingManager::readFromFile(QString path) {
118+
void TrackingManager::readFromFile(const QString &path) {
119119
QFile file(path);
120120
if (file.open(QIODevice::ReadOnly)) {
121121
QDataStream in(&file);

src/trackingmanager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class TrackingManager : public QWidget {
4545

4646
public slots:
4747
void addLogEntry(QMap<QString, QString> log);
48-
void appendToFile(QString path, QMap<QString, QString> line);
49-
void writeToFile(QString path, QList<QMap<QString, QString>> lines);
50-
void readFromFile(QString path);
48+
void appendToFile(const QString &path, const QMap<QString, QString> &line);
49+
void writeToFile(const QString &path, const QList<QMap<QString, QString>> &lines);
50+
void readFromFile(const QString &path);
5151
};
5252

5353
#endif // TRACKINGMANAGER_H

0 commit comments

Comments
 (0)