mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
cleanup: more Coverity silencing
Mostly irrelevant std::move() stuff of copy-on-write Qt objects, a few real bugs, a timestamp_t downconversion and some codingsyle adaptation. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
35ff6eea35
commit
91e4fb4769
27 changed files with 47 additions and 47 deletions
|
@ -350,8 +350,8 @@ std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFuture<int> exportUsingStyleSheet(QString filename, bool doExport, int units,
|
QFuture<int> exportUsingStyleSheet(const QString &filename, bool doExport, int units,
|
||||||
QString stylesheet, bool anonymize)
|
const QString &stylesheet, bool anonymize)
|
||||||
{
|
{
|
||||||
return QtConcurrent::run(export_dives_xslt, filename.toUtf8(), doExport, units, stylesheet.toUtf8(), anonymize);
|
return QtConcurrent::run(export_dives_xslt, filename.toUtf8(), doExport, units, stylesheet.toUtf8(), anonymize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ void exportProfile(QString filename, bool selected_only, ExportCallback &cb);
|
||||||
void export_TeX(const char *filename, bool selected_only, bool plain, ExportCallback &cb);
|
void export_TeX(const char *filename, bool selected_only, bool plain, ExportCallback &cb);
|
||||||
void export_depths(const char *filename, bool selected_only);
|
void export_depths(const char *filename, bool selected_only);
|
||||||
std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly);
|
std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly);
|
||||||
QFuture<int> exportUsingStyleSheet(QString filename, bool doExport, int units, QString stylesheet, bool anonymize);
|
QFuture<int> exportUsingStyleSheet(const QString &filename, bool doExport, int units, const QString &stylesheet, bool anonymize);
|
||||||
|
|
||||||
// prepareDivesForUploadDiveLog
|
// prepareDivesForUploadDiveLog
|
||||||
// prepareDivesForUploadDiveShare
|
// prepareDivesForUploadDiveShare
|
||||||
|
|
|
@ -113,7 +113,7 @@ static std::vector<PictureListForDeletion> addPictures(std::vector<PictureListFo
|
||||||
if (!toRemove.filenames.empty())
|
if (!toRemove.filenames.empty())
|
||||||
res.push_back(toRemove);
|
res.push_back(toRemove);
|
||||||
invalidate_dive_cache(list.d);
|
invalidate_dive_cache(list.d);
|
||||||
emit diveListNotifier.picturesAdded(list.d, picsForSignal);
|
emit diveListNotifier.picturesAdded(list.d, std::move(picsForSignal));
|
||||||
}
|
}
|
||||||
picturesToAdd.clear();
|
picturesToAdd.clear();
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -530,7 +530,7 @@ void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
|
||||||
void ConfigureDiveComputer::setError(QString err)
|
void ConfigureDiveComputer::setError(QString err)
|
||||||
{
|
{
|
||||||
lastError = err;
|
lastError = err;
|
||||||
emit error(err);
|
emit error(std::move(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDiveComputer::readThreadFinished()
|
void ConfigureDiveComputer::readThreadFinished()
|
||||||
|
|
|
@ -81,7 +81,7 @@ static int addDC(std::vector<device> &dcs, const std::string &m, const std::stri
|
||||||
return it - dcs.begin();
|
return it - dcs.begin();
|
||||||
} else {
|
} else {
|
||||||
dev.deviceId = calculate_string_hash(s.c_str());
|
dev.deviceId = calculate_string_hash(s.c_str());
|
||||||
dcs.insert(it, dev);
|
it = dcs.insert(it, dev);
|
||||||
return it - dcs.begin();
|
return it - dcs.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ FullTextResult FullText::find(const FullTextQuery &q, StringFilterMode mode) con
|
||||||
[&res2] (dive *d) { return std::find(res2.begin(), res2.end(), d) == res2.end(); }), res.end());
|
[&res2] (dive *d) { return std::find(res2.begin(), res2.end(), d) == res2.end(); }), res.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
return { res };
|
return { std::move(res) };
|
||||||
}
|
}
|
||||||
|
|
||||||
FullTextQuery &FullTextQuery::operator=(const QString &s)
|
FullTextQuery &FullTextQuery::operator=(const QString &s)
|
||||||
|
|
|
@ -42,11 +42,11 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
|
||||||
QString filename = reply->request().attribute(QNetworkRequest::User).toString();
|
QString filename = reply->request().attribute(QNetworkRequest::User).toString();
|
||||||
|
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
emit failed(filename);
|
emit failed(std::move(filename));
|
||||||
} else {
|
} else {
|
||||||
QByteArray imageData = reply->readAll();
|
QByteArray imageData = reply->readAll();
|
||||||
if (imageData.isEmpty()) {
|
if (imageData.isEmpty()) {
|
||||||
emit failed(filename);
|
emit failed(std::move(filename));
|
||||||
} else {
|
} else {
|
||||||
QString path = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first();
|
QString path = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first();
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
|
@ -63,7 +63,7 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
|
||||||
imageFile.close();
|
imageFile.close();
|
||||||
learnPictureFilename(filename, imageFile.fileName());
|
learnPictureFilename(filename, imageFile.fileName());
|
||||||
}
|
}
|
||||||
emit loaded(filename);
|
emit loaded(std::move(filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ Thumbnailer::Thumbnail Thumbnailer::addUnknownThumbnailToCache(const QString &pi
|
||||||
void Thumbnailer::frameExtracted(QString filename, QImage thumbnail, duration_t duration, duration_t offset)
|
void Thumbnailer::frameExtracted(QString filename, QImage thumbnail, duration_t duration, duration_t offset)
|
||||||
{
|
{
|
||||||
if (thumbnail.isNull()) {
|
if (thumbnail.isNull()) {
|
||||||
frameExtractionFailed(filename, duration);
|
frameExtractionFailed(std::move(filename), duration);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
int size = maxThumbnailSize();
|
int size = maxThumbnailSize();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// Find the coordinates at the time specified in coords.start_dive
|
// Find the coordinates at the time specified in coords.start_dive
|
||||||
// by searching the gpx file "fileName". Here is a typical trkpt element in GPX:
|
// by searching the gpx file "fileName". Here is a typical trkpt element in GPX:
|
||||||
// <trkpt lat="-26.84" lon="32.88"><ele>-53.7</ele><time>2017-08-06T04:56:42Z</time></trkpt>
|
// <trkpt lat="-26.84" lon="32.88"><ele>-53.7</ele><time>2017-08-06T04:56:42Z</time></trkpt>
|
||||||
int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName)
|
int getCoordsFromGPXFile(struct dive_coords *coords, const QString &fileName)
|
||||||
{
|
{
|
||||||
struct tm tm1;
|
struct tm tm1;
|
||||||
time_t trkpt_time = 0;
|
time_t trkpt_time = 0;
|
||||||
|
|
|
@ -15,6 +15,6 @@ struct dive_coords { // This structure holds important information after
|
||||||
int64_t timeZone_offset; // UTC international time zone offset of dive site
|
int64_t timeZone_offset; // UTC international time zone offset of dive site
|
||||||
};
|
};
|
||||||
|
|
||||||
int getCoordsFromGPXFile(dive_coords *coords, QString fileName);
|
int getCoordsFromGPXFile(dive_coords *coords, const QString &fileName);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -777,8 +777,8 @@ int parseDurationToSeconds(const QString &text)
|
||||||
seconds = numOnly.right(numOnly.length() - minutes.length() - 1);
|
seconds = numOnly.right(numOnly.length() - minutes.length() - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hours = "0";
|
hours = QStringLiteral("0");
|
||||||
minutes = numOnly;
|
minutes = std::move(numOnly);
|
||||||
}
|
}
|
||||||
secs = lrint(hours.toDouble() * 3600 + minutes.toDouble() * 60 + seconds.toDouble());
|
secs = lrint(hours.toDouble() * 3600 + minutes.toDouble() * 60 + seconds.toDouble());
|
||||||
return secs;
|
return secs;
|
||||||
|
|
|
@ -112,7 +112,7 @@ void VideoFrameExtractor::processItem(QString originalFilename, QString filename
|
||||||
return fail(originalFilename, duration, true);
|
return fail(originalFilename, duration, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit extracted(originalFilename, img, duration, position);
|
emit extracted(originalFilename, std::move(img), duration, position);
|
||||||
QMutexLocker l(&lock);
|
QMutexLocker l(&lock);
|
||||||
workingOn.remove(originalFilename);
|
workingOn.remove(originalFilename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -938,11 +938,12 @@ int DiveListView::lastImageTimeOffset()
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListView::updateLastImageTimeOffset(const int offset)
|
void DiveListView::updateLastImageTimeOffset(timestamp_t offset)
|
||||||
{
|
{
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup("MainWindow");
|
s.beginGroup("MainWindow");
|
||||||
s.setValue("LastImageTimeOffset", offset);
|
// Can't create a QVariant from int64_t, for whatever reason.
|
||||||
|
s.setValue("LastImageTimeOffset", static_cast<long long>(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListView::mouseDoubleClickEvent(QMouseEvent*)
|
void DiveListView::mouseDoubleClickEvent(QMouseEvent*)
|
||||||
|
|
|
@ -73,7 +73,7 @@ private:
|
||||||
void restoreExpandedRows(const std::vector<int> &);
|
void restoreExpandedRows(const std::vector<int> &);
|
||||||
int lastVisibleColumn();
|
int lastVisibleColumn();
|
||||||
void selectTrip(dive_trip *trip);
|
void selectTrip(dive_trip *trip);
|
||||||
void updateLastImageTimeOffset(int offset);
|
void updateLastImageTimeOffset(timestamp_t offset);
|
||||||
int lastImageTimeOffset();
|
int lastImageTimeOffset();
|
||||||
void addToTrip(int delta);
|
void addToTrip(int delta);
|
||||||
void matchImagesToDives(const QStringList &fileNames);
|
void matchImagesToDives(const QStringList &fileNames);
|
||||||
|
|
|
@ -326,7 +326,7 @@ void ColumnNameResult::setColumnValues(QList<QStringList> columns)
|
||||||
endInsertColumns();
|
endInsertColumns();
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), 0, columns.count()-1);
|
beginInsertRows(QModelIndex(), 0, columns.count()-1);
|
||||||
columnValues = columns;
|
columnValues = std::move(columns);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,11 +799,12 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows > 0)
|
if (rows > 0)
|
||||||
resultModel->setColumnValues(fileColumns);
|
resultModel->setColumnValues(std::move(fileColumns));
|
||||||
for (int i = 0; i < headers.count(); i++)
|
for (int i = 0; i < headers.count(); i++) {
|
||||||
if (!headers.at(i).isEmpty())
|
if (!headers.at(i).isEmpty())
|
||||||
resultModel->setData(resultModel->index(0, i),headers.at(i),Qt::EditRole);
|
resultModel->setData(resultModel->index(0, i),headers.at(i),Qt::EditRole);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DiveLogImportDialog::setup_csv_params(QStringList r, xml_params ¶ms)
|
void DiveLogImportDialog::setup_csv_params(QStringList r, xml_params ¶ms)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// Caller keeps ownership of "imported". The contents of "imported" will be consumed on execution of the dialog.
|
// Caller keeps ownership of "imported". The contents of "imported" will be consumed on execution of the dialog.
|
||||||
// On return, it will be empty.
|
// On return, it will be empty.
|
||||||
DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent),
|
DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent),
|
||||||
importedSource(source)
|
importedSource(std::move(source))
|
||||||
{
|
{
|
||||||
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
|
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
|
||||||
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
||||||
|
|
|
@ -1354,9 +1354,8 @@ void MainWindow::on_actionImportDiveLog_triggered()
|
||||||
logFiles.append(fn);
|
logFiles.append(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logFiles.size()) {
|
if (logFiles.size())
|
||||||
importFiles(logFiles);
|
importFiles(logFiles);
|
||||||
}
|
|
||||||
|
|
||||||
if (csvFiles.size()) {
|
if (csvFiles.size()) {
|
||||||
DiveLogImportDialog diveLogImport(std::move(csvFiles), this);
|
DiveLogImportDialog diveLogImport(std::move(csvFiles), this);
|
||||||
|
@ -1553,9 +1552,8 @@ void MainWindow::hideProgressBar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::divesChanged(const QVector<dive *> &dives, DiveField field)
|
void MainWindow::divesChanged(const QVector<dive *> &dives, DiveField)
|
||||||
{
|
{
|
||||||
Q_UNUSED(field)
|
|
||||||
for (struct dive *d: dives) {
|
for (struct dive *d: dives) {
|
||||||
qDebug() << "dive #" << d->number << "changed, cache is" << (dive_cache_is_valid(d) ? "valid" : "invalidated");
|
qDebug() << "dive #" << d->number << "changed, cache is" << (dive_cache_is_valid(d) ? "valid" : "invalidated");
|
||||||
// a brute force way to deal with that would of course be to call
|
// a brute force way to deal with that would of course be to call
|
||||||
|
|
|
@ -155,7 +155,7 @@ void TabDiveInformation::updateProfile()
|
||||||
ui->diveTimeText->setText(get_dive_duration_string(currentDive->duration.seconds, tr("h"), tr("min"), tr("sec"),
|
ui->diveTimeText->setText(get_dive_duration_string(currentDive->duration.seconds, tr("h"), tr("min"), tr("sec"),
|
||||||
" ", currentDive->dc.divemode == FREEDIVE));
|
" ", currentDive->dc.divemode == FREEDIVE));
|
||||||
|
|
||||||
ui->sacText->setText(currentDive->cylinders.nr > 0 && mean[0] && currentDive->dc.divemode != CCR ? SACs : QString());
|
ui->sacText->setText(currentDive->cylinders.nr > 0 && mean[0] && currentDive->dc.divemode != CCR ? std::move(SACs) : QString());
|
||||||
|
|
||||||
if (currentDive->surface_pressure.mbar == 0) {
|
if (currentDive->surface_pressure.mbar == 0) {
|
||||||
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box
|
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box
|
||||||
|
|
|
@ -404,7 +404,7 @@ void TabDiveNotes::on_notes_editingFinished()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString html = ui.notes->toHtml();
|
QString html = ui.notes->toHtml();
|
||||||
QString notes = isHtml(html) ? html : ui.notes->toPlainText();
|
QString notes = isHtml(html) ? std::move(html) : ui.notes->toPlainText();
|
||||||
|
|
||||||
if (currentTrip)
|
if (currentTrip)
|
||||||
Command::editTripNotes(currentTrip, notes);
|
Command::editTripNotes(currentTrip, notes);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
CylindersModel::CylindersModel(bool planner, QObject *parent) : CleanerTableModel(parent),
|
CylindersModel::CylindersModel(bool planner, QObject *parent) : CleanerTableModel(parent),
|
||||||
d(nullptr),
|
d(nullptr),
|
||||||
|
dcNr(-1),
|
||||||
inPlanner(planner),
|
inPlanner(planner),
|
||||||
numRows(0),
|
numRows(0),
|
||||||
tempRow(-1),
|
tempRow(-1),
|
||||||
|
|
|
@ -281,7 +281,7 @@ void DivePictureModel::updateThumbnail(QString filename, QImage thumbnail, durat
|
||||||
addDurationToThumbnail(thumbnail, duration); // If we know the duration paint it on top of the thumbnail
|
addDurationToThumbnail(thumbnail, duration); // If we know the duration paint it on top of the thumbnail
|
||||||
pictures[i].length = duration;
|
pictures[i].length = duration;
|
||||||
}
|
}
|
||||||
pictures[i].image = thumbnail;
|
pictures[i].image = std::move(thumbnail);
|
||||||
emit dataChanged(createIndex(i, 0), createIndex(i, 1));
|
emit dataChanged(createIndex(i, 0), createIndex(i, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ void DivePictureModel::pictureOffsetChanged(dive *d, const QString filenameIn, o
|
||||||
auto to = std::find_if(from, pictures.end(), [d](const PictureEntry &e) { return e.d != d; });
|
auto to = std::find_if(from, pictures.end(), [d](const PictureEntry &e) { return e.d != d; });
|
||||||
|
|
||||||
// Find picture with the given filename
|
// Find picture with the given filename
|
||||||
auto oldPos = std::find_if(from, to, [filename](const PictureEntry &e) { return e.filename == filename; });
|
auto oldPos = std::find_if(from, to, [&filename](const PictureEntry &e) { return e.filename == filename; });
|
||||||
if (oldPos == to)
|
if (oldPos == to)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1312,7 +1312,7 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
||||||
disclaimerBegin = disclaimer.left(disclaimerMid);
|
disclaimerBegin = disclaimer.left(disclaimerMid);
|
||||||
disclaimerEnd = disclaimer.mid(disclaimerMid + 2);
|
disclaimerEnd = disclaimer.mid(disclaimerMid + 2);
|
||||||
} else {
|
} else {
|
||||||
disclaimerBegin = disclaimer;
|
disclaimerBegin = std::move(disclaimer);
|
||||||
}
|
}
|
||||||
int disclaimerPositionStart = oldnotes.indexOf(disclaimerBegin);
|
int disclaimerPositionStart = oldnotes.indexOf(disclaimerBegin);
|
||||||
if (disclaimerPositionStart >= 0) {
|
if (disclaimerPositionStart >= 0) {
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ void DiveTripModelTree::divesSelectedSlot(const QVector<dive *> &divesIn, dive *
|
||||||
QVector<QModelIndex> indices;
|
QVector<QModelIndex> indices;
|
||||||
indices.reserve(dives.count());
|
indices.reserve(dives.count());
|
||||||
|
|
||||||
processByTrip(dives, [this, &indices] (dive_trip *trip, const QVector<dive *> &divesInTrip)
|
processByTrip(std::move(dives), [this, &indices] (dive_trip *trip, const QVector<dive *> &divesInTrip)
|
||||||
{ divesSelectedTrip(trip, divesInTrip, indices); });
|
{ divesSelectedTrip(trip, divesInTrip, indices); });
|
||||||
|
|
||||||
emit divesSelected(indices, diveToIdx(currentDive), currentDC);
|
emit divesSelected(indices, diveToIdx(currentDive), currentDC);
|
||||||
|
|
|
@ -22,14 +22,12 @@ static QString siteMapDisplayName(const char *sitename)
|
||||||
const char Separator = '/';
|
const char Separator = '/';
|
||||||
QString fullname(sitename);
|
QString fullname(sitename);
|
||||||
|
|
||||||
if (!qPrefDisplay::map_short_names() ) {
|
if (!qPrefDisplay::map_short_names() )
|
||||||
return fullname;
|
return fullname;
|
||||||
}
|
|
||||||
|
|
||||||
QString name = fullname.section(Separator, -1).trimmed();
|
QString name = fullname.section(Separator, -1).trimmed();
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty())
|
||||||
name = fullname;
|
name = std::move(fullname);
|
||||||
}
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ void ValueAxis::updateLabels()
|
||||||
{
|
{
|
||||||
QLocale loc;
|
QLocale loc;
|
||||||
auto [minString, maxString] = getFirstLastLabel();
|
auto [minString, maxString] = getFirstLastLabel();
|
||||||
int numTicks = guessNumTicks({ minString, maxString});
|
int numTicks = guessNumTicks({ std::move(minString), std::move(maxString)});
|
||||||
|
|
||||||
// Use full decimal increments
|
// Use full decimal increments
|
||||||
double height = max - min;
|
double height = max - min;
|
||||||
|
|
|
@ -537,7 +537,8 @@ void StatsState::featureChanged(int id, bool state)
|
||||||
// Creates the new chart-type from the current chart-type and a list of possible chart types.
|
// Creates the new chart-type from the current chart-type and a list of possible chart types.
|
||||||
// If the flag "varChanged" is true, the current chart-type will be changed if the
|
// If the flag "varChanged" is true, the current chart-type will be changed if the
|
||||||
// current chart-type is undesired.
|
// current chart-type is undesired.
|
||||||
const ChartTypeDesc &newChartType(ChartType type, std::vector<std::pair<const ChartTypeDesc &, bool>> charts,
|
static const ChartTypeDesc &newChartType(ChartType type,
|
||||||
|
const std::vector<std::pair<const ChartTypeDesc &, bool>> &charts,
|
||||||
bool varChanged)
|
bool varChanged)
|
||||||
{
|
{
|
||||||
for (auto [desc, warn]: charts) {
|
for (auto [desc, warn]: charts) {
|
||||||
|
|
|
@ -329,14 +329,14 @@ QString StatsVariable::nameWithUnit() const
|
||||||
{
|
{
|
||||||
QString s = name();
|
QString s = name();
|
||||||
QString symb = unitSymbol();
|
QString symb = unitSymbol();
|
||||||
return symb.isEmpty() ? s : QStringLiteral("%1 [%2]").arg(s, symb);
|
return symb.isEmpty() ? std::move(s) : QStringLiteral("%1 [%2]").arg(s, symb);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StatsVariable::nameWithBinnerUnit(const StatsBinner &binner) const
|
QString StatsVariable::nameWithBinnerUnit(const StatsBinner &binner) const
|
||||||
{
|
{
|
||||||
QString s = name();
|
QString s = name();
|
||||||
QString symb = binner.unitSymbol();
|
QString symb = binner.unitSymbol();
|
||||||
return symb.isEmpty() ? s : QStringLiteral("%1 [%2]").arg(s, symb);
|
return symb.isEmpty() ? std::move(s) : QStringLiteral("%1 [%2]").arg(s, symb);
|
||||||
}
|
}
|
||||||
|
|
||||||
const StatsBinner *StatsVariable::getBinner(int idx) const
|
const StatsBinner *StatsVariable::getBinner(int idx) const
|
||||||
|
@ -551,7 +551,7 @@ std::vector<StatsBinValue<T>> bin_convert(const StatsVariable &variable, const S
|
||||||
T v = func(dives);
|
T v = func(dives);
|
||||||
if (is_invalid_value(v) && (res.empty() || !fill_empty))
|
if (is_invalid_value(v) && (res.empty() || !fill_empty))
|
||||||
continue;
|
continue;
|
||||||
res.push_back({ std::move(bin), v });
|
res.push_back({ std::move(bin), std::move(v) });
|
||||||
}
|
}
|
||||||
if (res.empty())
|
if (res.empty())
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -892,7 +892,7 @@ void StatsView::plotValueChart(const std::vector<dive *> &dives,
|
||||||
if (res.isValid()) {
|
if (res.isValid()) {
|
||||||
double height = res.get(valueAxisOperation);
|
double height = res.get(valueAxisOperation);
|
||||||
QString value = QString("%L1").arg(height, 0, 'f', decimals);
|
QString value = QString("%L1").arg(height, 0, 'f', decimals);
|
||||||
std::vector<QString> label = std::vector<QString> { value };
|
std::vector<QString> label = std::vector<QString> { std::move(value) };
|
||||||
items.push_back({ pos - 0.5, pos + 0.5, height, label,
|
items.push_back({ pos - 0.5, pos + 0.5, height, label,
|
||||||
categoryBinner->formatWithUnit(*bin), res });
|
categoryBinner->formatWithUnit(*bin), res });
|
||||||
}
|
}
|
||||||
|
@ -1080,7 +1080,7 @@ HistogramAxis *StatsView::createHistogramAxis(const QString &name, const StatsBi
|
||||||
QString label = binner.formatLowerBound(*bin);
|
QString label = binner.formatLowerBound(*bin);
|
||||||
double lowerBound = binner.lowerBoundToFloat(*bin);
|
double lowerBound = binner.lowerBoundToFloat(*bin);
|
||||||
bool prefer = binner.preferBin(*bin);
|
bool prefer = binner.preferBin(*bin);
|
||||||
labels.push_back({ label, lowerBound, prefer });
|
labels.push_back({ std::move(label), lowerBound, prefer });
|
||||||
}
|
}
|
||||||
|
|
||||||
const StatsBin &lastBin = *bins.back().bin;
|
const StatsBin &lastBin = *bins.back().bin;
|
||||||
|
@ -1129,7 +1129,7 @@ void StatsView::plotHistogramCountChart(const std::vector<dive *> &dives,
|
||||||
double upperBound = categoryBinner->upperBoundToFloat(*bin);
|
double upperBound = categoryBinner->upperBoundToFloat(*bin);
|
||||||
std::vector<QString> label = makePercentageLabels((int)dives.size(), total, isHorizontal);
|
std::vector<QString> label = makePercentageLabels((int)dives.size(), total, isHorizontal);
|
||||||
|
|
||||||
items.push_back({ lowerBound, upperBound, std::move(dives), label,
|
items.push_back({ lowerBound, upperBound, std::move(dives), std::move(label),
|
||||||
categoryBinner->formatWithUnit(*bin), total });
|
categoryBinner->formatWithUnit(*bin), total });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue