diff --git a/contrib/httpserver/httpconnectionhandlerpool.cpp b/contrib/httpserver/httpconnectionhandlerpool.cpp index 63264f9c2..6fb96f8b4 100644 --- a/contrib/httpserver/httpconnectionhandlerpool.cpp +++ b/contrib/httpserver/httpconnectionhandlerpool.cpp @@ -64,7 +64,7 @@ void HttpConnectionHandlerPool::cleanup() { if (++idleCounter > maxIdleHandlers) { pool.removeOne(handler); delete handler; - wDebug("HttpConnectionHandlerPool: Removed connection handler (%p), pool size is now %i",handler,pool.size()); + wDebug("HttpConnectionHandlerPool: Removed connection handler (%p), pool size is now %lld",handler,pool.size()); break; // remove only one handler in each interval } } diff --git a/contrib/httpserver/staticfilecontroller.cpp b/contrib/httpserver/staticfilecontroller.cpp index cf88c9361..a14862b1c 100644 --- a/contrib/httpserver/staticfilecontroller.cpp +++ b/contrib/httpserver/staticfilecontroller.cpp @@ -31,7 +31,7 @@ StaticFileController::StaticFileController(QSettings* settings, QObject* parent) maxCachedFileSize=settings->value("maxCachedFileSize","65536").toInt(); cache.setMaxCost(settings->value("cacheSize","1000000").toInt()); cacheTimeout=settings->value("cacheTime","60000").toInt(); - wDebug("StaticFileController: cache timeout=%i, size=%i",cacheTimeout,cache.maxCost()); + wDebug("StaticFileController: cache timeout=%i, size=%lld",cacheTimeout,cache.maxCost()); } diff --git a/src/ANT/ANT.cpp b/src/ANT/ANT.cpp index 93b352639..64f4d0e14 100644 --- a/src/ANT/ANT.cpp +++ b/src/ANT/ANT.cpp @@ -1188,7 +1188,7 @@ int ANT::openPort() #else // LINUX AND MAC USES TERMIO / IOCTL / STDIO -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) int ldisc=TTYDISC; #else int ldisc=N_TTY; // LINUX @@ -1227,7 +1227,7 @@ int ANT::openPort() deviceSettings.c_iflag= IGNPAR; deviceSettings.c_oflag=0; deviceSettings.c_cflag &= (~CSIZE & ~CSTOPB); -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) deviceSettings.c_cflag |= (CS8 | CREAD | HUPCL | CCTS_OFLOW | CRTS_IFLOW); #else deviceSettings.c_cflag |= (CS8 | CREAD | HUPCL | CRTSCTS); diff --git a/src/Charts/Aerolab.cpp b/src/Charts/Aerolab.cpp index 59e31551c..9986c1d96 100644 --- a/src/Charts/Aerolab.cpp +++ b/src/Charts/Aerolab.cpp @@ -334,7 +334,6 @@ Aerolab::setData(RideItem *_rideItem, bool new_zoom) { } // Fill the virtual elevation profile with data from the ride data: - double t = 0.0; double vlast = 0.0; double e = 0.0; arrayLength = 0; @@ -387,7 +386,6 @@ Aerolab::setData(RideItem *_rideItem, bool new_zoom) { double de = s * v * dt * (GlobalContext::context()->useMetricUnits ? 1 : FEET_PER_METER); e += de; - t += dt; veArray[arrayLength] = e; diff --git a/src/Charts/AgendaWindow.cpp b/src/Charts/AgendaWindow.cpp index b3db81303..c91040b2e 100644 --- a/src/Charts/AgendaWindow.cpp +++ b/src/Charts/AgendaWindow.cpp @@ -69,7 +69,7 @@ AgendaWindow::AgendaWindow(Context *context) connect(context, &Context::rideDeleted, this, &AgendaWindow::updateActivitiesIfInRange); connect(context, &Context::rideChanged, this, &AgendaWindow::updateActivitiesIfInRange); connect(context, &Context::configChanged, this, &AgendaWindow::configChanged); - connect(agendaView, &AgendaView::showInTrainMode, this, [this, context](const CalendarEntry &activity) { + connect(agendaView, &AgendaView::showInTrainMode, this, [context](const CalendarEntry &activity) { for (RideItem *rideItem : context->athlete->rideCache->rides()) { if (rideItem != nullptr && rideItem->fileName == activity.reference) { QString filter = buildWorkoutFilter(rideItem); @@ -82,7 +82,7 @@ AgendaWindow::AgendaWindow(Context *context) } } }); - connect(agendaView, &AgendaView::viewActivity, this, [this, context](const CalendarEntry &activity) { + connect(agendaView, &AgendaView::viewActivity, this, [context](const CalendarEntry &activity) { for (RideItem *rideItem : context->athlete->rideCache->rides()) { if (rideItem != nullptr && rideItem->fileName == activity.reference) { context->notifyRideSelected(rideItem); diff --git a/src/Charts/GenericAnnotations.h b/src/Charts/GenericAnnotations.h index 80aad3361..409557afa 100644 --- a/src/Charts/GenericAnnotations.h +++ b/src/Charts/GenericAnnotations.h @@ -29,12 +29,13 @@ class GenericPlot; extern double qtchartaxismin(QAbstractAxis *axis); extern double qtchartaxismax(QAbstractAxis *axis); -// base class for a chart annotation- you have one job +// abstract base class for a chart annotation- you have one job class GenericAnnotation { public: // annotation controller calls this to paint virtual void paint(QPainter*, const QStyleOptionGraphicsItem *, QWidget*)=0; + virtual ~GenericAnnotation() = default; }; // gets attached to the chart and is used to register diff --git a/src/Charts/GenericLegend.cpp b/src/Charts/GenericLegend.cpp index 5e046483e..81d5cc854 100644 --- a/src/Charts/GenericLegend.cpp +++ b/src/Charts/GenericLegend.cpp @@ -116,6 +116,8 @@ GenericLegendItem::eventFilter(QObject *obj, QEvent *e) // hover indicator show/hide as mouse hovers over the item update(); break; + + default: break; } return false; } diff --git a/src/Charts/GenericPlot.cpp b/src/Charts/GenericPlot.cpp index 63dd3de65..fe29c4ed1 100644 --- a/src/Charts/GenericPlot.cpp +++ b/src/Charts/GenericPlot.cpp @@ -1518,6 +1518,8 @@ GenericPlot::plotAnnotations(GenericSeriesInfo &seriesinfo) annotations << line; } break; + + default: break; } } } diff --git a/src/Charts/OverviewItems.cpp b/src/Charts/OverviewItems.cpp index cdcdf5d1f..27dc0f51c 100644 --- a/src/Charts/OverviewItems.cpp +++ b/src/Charts/OverviewItems.cpp @@ -1267,7 +1267,7 @@ DataOverviewItem::sort(int column, Qt::SortOrder order) if (column >= names.count()) return; // out of bounds // step 1: infer the type for column - int isdate=0, istime=0, isnumber=0, isstring=0; + int isstring=0; int rows = values.count() / names.count(); @@ -1282,9 +1282,9 @@ DataOverviewItem::sort(int column, Qt::SortOrder order) QString &val = values[i]; // check, the order here is important - if (renumber.exactMatch(val)) isnumber++; // numbers + . - else if (retime.exactMatch(val)) istime++; // numbers + : - else if (redate.exactMatch(val)) isdate++; // numbers + date + if (renumber.exactMatch(val)) continue; // numbers + . + else if (retime.exactMatch(val)) continue; // numbers + : + else if (redate.exactMatch(val)) continue; // numbers + date else isstring++; // all bets are off } // step 2: generate an argsort index as strings or numbers @@ -3594,8 +3594,6 @@ MetaOverviewItem::itemPaint(QPainter *painter, const QStyleOptionGraphicsItem *, painter->setPen(QColor(150,150,150)); painter->setFont(parent->smallfont); - QRectF rect = QFontMetrics(parent->bigfont, parent->device()).boundingRect(value); - // draw text and wrap / truncate to bounding rectangle painter->drawText(QRectF(ROWHEIGHT, ROWHEIGHT*2.5, geometry().width()-(ROWHEIGHT*2), geometry().height()-(ROWHEIGHT*4)), value); diff --git a/src/Charts/PowerHist.cpp b/src/Charts/PowerHist.cpp index 7d362a25e..7397b8299 100644 --- a/src/Charts/PowerHist.cpp +++ b/src/Charts/PowerHist.cpp @@ -1191,10 +1191,6 @@ PowerHist::binData(HistData &standard, QVector&x, // x-axis for data sx.resize(selectedArray->size() * 4); sy.resize(selectedArray->size() * 4); - // so we can calculate percentage for the labels - double total=0; - for (int i=0; isize(); i++) total += dt * (double)(*array)[i]; - // samples to time for (int i=0, offset=0; isize(); i++) { diff --git a/src/Cloud/Strava.cpp b/src/Cloud/Strava.cpp index dc0ab221d..750729fea 100644 --- a/src/Cloud/Strava.cpp +++ b/src/Cloud/Strava.cpp @@ -385,7 +385,7 @@ Strava::writeFile(QByteArray &data, QString remotename, RideFile *ride) trainerPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"trainer\"")); trainerPart.setBody((ride->getTag("Trainer", "0").toInt() || - ride->xdata("TRAIN") && !ride->isDataPresent(RideFile::lat)) ? "1" : "0"); + (ride->xdata("TRAIN") && !ride->isDataPresent(RideFile::lat))) ? "1" : "0"); multiPart->append(trainerPart); if (manual) { diff --git a/src/Cloud/WithingsDownload.cpp b/src/Cloud/WithingsDownload.cpp index 08916b5be..e9aaedcfa 100644 --- a/src/Cloud/WithingsDownload.cpp +++ b/src/Cloud/WithingsDownload.cpp @@ -67,7 +67,7 @@ WithingsDownload::getBodyMeasures(QString &error, QDateTime from, QDateTime to, strNokiaRefreshToken = appsettings->cvalue(context->athlete->cyclist, GC_NOKIA_REFRESH_TOKEN).toString(); if(strNokiaRefreshToken.isEmpty() || strNokiaRefreshToken == "" || strNokiaRefreshToken == "0" ) { - #ifdef Q_OS_MACX + #ifdef Q_OS_MACOS #define GC_PREF tr("Golden Cheetah->Preferences") #else #define GC_PREF tr("Tools->Options") diff --git a/src/Core/DataFilter.cpp b/src/Core/DataFilter.cpp index cfb7d97af..a12440308 100644 --- a/src/Core/DataFilter.cpp +++ b/src/Core/DataFilter.cpp @@ -1798,6 +1798,8 @@ void Leaf::clear(Leaf *leaf) break; case Leaf::Float : case Leaf::Integer : break; + + default: break; } } diff --git a/src/Core/Quadtree.cpp b/src/Core/Quadtree.cpp index d0d0ff131..3b1158cb0 100644 --- a/src/Core/Quadtree.cpp +++ b/src/Core/Quadtree.cpp @@ -71,10 +71,6 @@ QuadtreeNode::candidates(QRectF rect, QList &here) } } -// infitesmal amount to make quadtrees have slightly -// tiny differences on boundaries -static double tiny = 0.000000001; - // split leaf into nodes (when to many entries) void QuadtreeNode::split(Quadtree *root) diff --git a/src/Core/RideItem.cpp b/src/Core/RideItem.cpp index 7fc2c190b..28826053e 100644 --- a/src/Core/RideItem.cpp +++ b/src/Core/RideItem.cpp @@ -98,9 +98,10 @@ RideItem::setFrom(RideItem&here, bool temp) // used when loading cache/rideDB.js // don't update the interval pointers if this is a // temporary "fake" rideitem. - if (!temp) + if (!temp) { foreach(IntervalItem *p, intervals_) p->rideItem_ = this; + } context = here.context; isdirty = here.isdirty; diff --git a/src/Core/main.cpp b/src/Core/main.cpp index a3e85edfe..023c5b959 100644 --- a/src/Core/main.cpp +++ b/src/Core/main.cpp @@ -514,7 +514,7 @@ main(int argc, char *argv[]) QString oldLibraryPath=QDir::home().canonicalPath()+"/Library/GoldenCheetah"; //these are the new platform-dependent library paths -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) QString libraryPath="Library/GoldenCheetah"; #elif defined(Q_OS_WIN) QStringList paths=QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation); diff --git a/src/FileIO/D2XX.cpp b/src/FileIO/D2XX.cpp index c462f5ad9..abcb2f07f 100644 --- a/src/FileIO/D2XX.cpp +++ b/src/FileIO/D2XX.cpp @@ -167,7 +167,7 @@ D2XX::read(void *buf, size_t nbyte, QString &err) if (nbyte > rxbytes) lib->set_timeouts(ftHandle, 5000, 5000); DWORD n; - ftStatus = lib->read(ftHandle, buf, nbyte, &n); + ftStatus = lib->read(ftHandle, buf, static_cast(nbyte), &n); if (ftStatus == FT_OK) return n; err = QString("FT_Read: %1").arg(ftStatus); @@ -178,7 +178,7 @@ int D2XX::write(void *buf, size_t nbyte, QString &err) { DWORD n; - FT_STATUS ftStatus = lib->write(ftHandle, buf, nbyte, &n); + FT_STATUS ftStatus = lib->write(ftHandle, buf, static_cast(nbyte), &n); if (ftStatus == FT_OK) return n; err = QString("FT_Write: %1").arg(ftStatus); diff --git a/src/FileIO/FixGaps.cpp b/src/FileIO/FixGaps.cpp index 5101cbfcb..7ae0b9a3c 100644 --- a/src/FileIO/FixGaps.cpp +++ b/src/FileIO/FixGaps.cpp @@ -262,7 +262,7 @@ FixGaps::postProcess(RideFile *ride, DataProcessorConfig *config=0, QString op=" } // stationary or greater than stop seconds... fill with zeroes - } else if (stationary && gap >= tolerance || gap > stop) { + } else if ((stationary && gap >= tolerance) || gap > stop) { dropouts++; dropouttime += gap; diff --git a/src/FileIO/PolarRideFile.cpp b/src/FileIO/PolarRideFile.cpp index 236173eca..4b889d72d 100644 --- a/src/FileIO/PolarRideFile.cpp +++ b/src/FileIO/PolarRideFile.cpp @@ -175,9 +175,6 @@ void HrmRideFile(RideFile *rideFile, RideFile*gpxresult, bool haveGPX, XDataSeri RideFilePoint *p; - int lineno = 1; - - double next_interval=0; double hrv_time=0; QList intervals; @@ -219,7 +216,6 @@ void HrmRideFile(RideFile *rideFile, RideFile*gpxresult, bool haveGPX, XDataSeri QStringList lines = linesIn.split('\r'); // workaround for empty lines if(lines.size() == 0) { - lineno++; continue; } for (int li = 0; li < lines.size(); ++li) { @@ -467,8 +463,6 @@ void HrmRideFile(RideFile *rideFile, RideFile*gpxresult, bool haveGPX, XDataSeri seconds += recInterval; } } - - ++lineno; } } diff --git a/src/FileIO/RideFileCache.cpp b/src/FileIO/RideFileCache.cpp index 2f4b03477..97bd39ae2 100644 --- a/src/FileIO/RideFileCache.cpp +++ b/src/FileIO/RideFileCache.cpp @@ -1607,7 +1607,6 @@ RideFileCache::computeDistribution(QVector &array, RideFile::SeriesType s // set timeinzone to zero wbalTimeInZone.fill(0.0f, 4); array.fill(0.0f); - int count = 0; // lets count them first then turn into percentages // after we have traversed all the data @@ -1620,7 +1619,6 @@ RideFileCache::computeDistribution(QVector &array, RideFile::SeriesType s // increment counts array[percent]++; - count++; // and zones in 1s increments if (percent <= 25.0f) wbalTimeInZone[0]++; diff --git a/src/Gui/AthletePages.cpp b/src/Gui/AthletePages.cpp index f1a575764..c7206aacd 100644 --- a/src/Gui/AthletePages.cpp +++ b/src/Gui/AthletePages.cpp @@ -2035,7 +2035,7 @@ CPPage::mkReviewRow connect( accept, &QCheckBox::toggled, this, - [this, current, estimate](bool checked) { + [current, estimate](bool checked) { current->setEnabled(! checked); estimate->setEnabled(checked); } @@ -2061,7 +2061,7 @@ CPPage::connectReviewDialogApplyButton hasChecked |= checkboxes[i]->isChecked(); connect( checkboxes[i], &QCheckBox::toggled, this, - [this, checkboxes, applyButton](bool checked) { + [checkboxes, applyButton](bool checked) { bool anyChecked = checked; int j = 0; while (! anyChecked && j < checkboxes.size()) { diff --git a/src/Gui/CalendarItemDelegates.cpp b/src/Gui/CalendarItemDelegates.cpp index 2a0b2692c..775f1f903 100644 --- a/src/Gui/CalendarItemDelegates.cpp +++ b/src/Gui/CalendarItemDelegates.cpp @@ -806,7 +806,6 @@ CalendarCompactDayDelegate::paint CalendarDay calendarDay = index.data(DayRole).value(); QColor bgColor; QColor selColor = opt.palette.highlight().color(); - QColor dayColor; QColor entryColor; bool ok; @@ -1454,7 +1453,6 @@ AgendaEntryDelegate::sizeHint const int iconWidth = 2 * lineHeight + lineSpacing; int tertiaryWidth = width - iconWidth - attributes.iconTextSpacing * dpiXFactor - attributes.padding.left() - attributes.padding.right(); int numLines; - // int tertiary; layoutTertiaryText(entry.tertiary, option.font, tertiaryWidth, numLines, tertiaryHeight, nullptr, true); tertiaryHeight += 2 * lineSpacing; } diff --git a/src/Gui/ConfigDialog.cpp b/src/Gui/ConfigDialog.cpp index 7ef987584..03f9544e6 100644 --- a/src/Gui/ConfigDialog.cpp +++ b/src/Gui/ConfigDialog.cpp @@ -189,7 +189,7 @@ ConfigDialog::ConfigDialog(QDir _home, Context *context) : // We go fixed width to ensure a consistent layout for // tabs, sub-tabs and internal widgets and lists -#ifdef Q_OS_MACX +#ifdef Q_OS_MACOS setWindowTitle(tr("Preferences")); #else setWindowTitle(tr("Options")); diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index e4157b3c8..2400c9ec5 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -530,8 +530,8 @@ MainWindow::MainWindow(const QDir &home) rideMenu->addAction(tr("&Import from file..."), QKeySequence("Ctrl+I"), this, SLOT (importFile())); rideMenu->addAction(tr("&Manual entry..."), QKeySequence("Ctrl+M"), this, SLOT(manualRide())); QAction *actionPlan = new QAction(tr("&Plan activity...")); - connect(context, &Context::start, this, [this, actionPlan]() { actionPlan->setEnabled(false); }); // The dialog can change the contexts workout - connect(context, &Context::stop, this, [this, actionPlan]() { actionPlan->setEnabled(true); }); // temporarily which might cause unwanted effects + connect(context, &Context::start, this, [actionPlan]() { actionPlan->setEnabled(false); }); // The dialog can change the contexts workout + connect(context, &Context::stop, this, [actionPlan]() { actionPlan->setEnabled(true); }); // temporarily which might cause unwanted effects connect(actionPlan, &QAction::triggered, this, [this]() { planActivity(); }); rideMenu->addAction(actionPlan); rideMenu->addSeparator (); @@ -1233,6 +1233,8 @@ MainWindow::sidebarClicked(GcSideBarBtnId id) switch (id) { case GcSideBarBtnId::SYNC_BTN: checkCloud(); break; // sync quick link case GcSideBarBtnId::OPTIONS_BTN: showOptions(); break; // prefs + + default: break; } } @@ -1247,6 +1249,8 @@ MainWindow::sidebarSelected(GcSideBarBtnId id) case GcSideBarBtnId::REFLECT_BTN: break; // reflect not written yet case GcSideBarBtnId::TRAIN_BTN: selectTrain(); break; case GcSideBarBtnId::APPS_BTN: break;// apps not written yet + + default: break; } } diff --git a/src/Gui/ManualActivityWizard.cpp b/src/Gui/ManualActivityWizard.cpp index 9e7272ed4..f2eb9ea26 100644 --- a/src/Gui/ManualActivityWizard.cpp +++ b/src/Gui/ManualActivityWizard.cpp @@ -301,7 +301,7 @@ ManualActivityPageBasics::ManualActivityPageBasics woTypeEdit->setCurrentIndex(1); if (plan) { - connect(woTypeEdit, &QComboBox::currentIndexChanged, this, [this, sportEdit](int index) { + connect(woTypeEdit, &QComboBox::currentIndexChanged, this, [sportEdit](int index) { sportEdit->setEnabled(index != 0); if (index == 0) { diff --git a/src/Gui/MetadataDialog.cpp b/src/Gui/MetadataDialog.cpp index 0941d39cb..484f842ab 100644 --- a/src/Gui/MetadataDialog.cpp +++ b/src/Gui/MetadataDialog.cpp @@ -26,7 +26,7 @@ #include MetadataDialog::MetadataDialog(Context* context, const QString& fieldName, const QString& value, QPoint pos) : - QDialog(context->mainWindow), context_(context), completer_(nullptr), pos_(pos) + QDialog(context->mainWindow), context_(context), pos_(pos), completer_(nullptr) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Metadata Editor")); diff --git a/src/Gui/MetadataDialog.h b/src/Gui/MetadataDialog.h index 7abc3e2e9..6a591d8d6 100644 --- a/src/Gui/MetadataDialog.h +++ b/src/Gui/MetadataDialog.h @@ -59,9 +59,11 @@ class MetadataDialog : public QDialog private: + Context *context_ = nullptr; + bool isTime = false; // when we edit metrics but they are really times QPoint pos_; - Context *context_ = nullptr; + FieldDefinition field_; QCompleter* completer_ = nullptr; diff --git a/src/Gui/MetricOverrideDialog.h b/src/Gui/MetricOverrideDialog.h index e370c90b2..13e50695c 100644 --- a/src/Gui/MetricOverrideDialog.h +++ b/src/Gui/MetricOverrideDialog.h @@ -50,11 +50,13 @@ class MetricOverrideDialog : public QDialog enum class DialogMetricType { DATE, SECS_TIME, MINS_TIME, DOUBLE }; - QPoint pos_; - QString fieldName_; - DialogMetricType dlgMetricType_ = DialogMetricType::DOUBLE; Context* context_ = nullptr; + QString fieldName_; + QPoint pos_; + + DialogMetricType dlgMetricType_ = DialogMetricType::DOUBLE; + QLabel* metricLabel_ = nullptr; QWidget* metricEdit_ = nullptr; }; diff --git a/src/Gui/RepeatScheduleWizard.cpp b/src/Gui/RepeatScheduleWizard.cpp index 3347766d6..1397d7b67 100644 --- a/src/Gui/RepeatScheduleWizard.cpp +++ b/src/Gui/RepeatScheduleWizard.cpp @@ -202,7 +202,7 @@ RepeatSchedulePageSetup::RepeatSchedulePageSetup all->addWidget(scrollArea); setLayout(all); - connect(seasonTree, &QTreeWidget::currentItemChanged, this, [this, startDate, endDate, when](QTreeWidgetItem *current) { + connect(seasonTree, &QTreeWidget::currentItemChanged, this, [startDate, endDate, when](QTreeWidgetItem *current) { if (current != nullptr) { QDate seasonStart(current->data(0, Qt::UserRole).toDate()); QDate seasonEnd(current->data(0, Qt::UserRole + 1).toDate()); @@ -216,10 +216,10 @@ RepeatSchedulePageSetup::RepeatSchedulePageSetup endDate->setDate(seasonEnd); } }); - connect(startDate, &QDateEdit::dateChanged, this, [this, endDate](QDate date) { + connect(startDate, &QDateEdit::dateChanged, this, [endDate](QDate date) { endDate->setMinimumDate(date); }); - connect(endDate, &QDateEdit::dateChanged, this, [this, startDate](QDate date) { + connect(endDate, &QDateEdit::dateChanged, this, [startDate](QDate date) { startDate->setMaximumDate(date); }); diff --git a/src/Gui/RideImportWizard.cpp b/src/Gui/RideImportWizard.cpp index 642a4b5be..736c0951a 100644 --- a/src/Gui/RideImportWizard.cpp +++ b/src/Gui/RideImportWizard.cpp @@ -875,7 +875,6 @@ RideImportWizard::todayClicked(int index) // Only apply to selected date - set time to current time - ride duration // pretty daft but at least it sets it to something, anything is gonna be random - int countselected = 0; int totalduration = 0; for (int i=0; i< filenames.count(); i++) { if (tableWidget->item(i,FILENAME_COLUMN)->isSelected() || @@ -884,7 +883,6 @@ RideImportWizard::todayClicked(int index) tableWidget->item(i,DURATION_COLUMN)->isSelected() || tableWidget->item(i,DISTANCE_COLUMN)->isSelected() || tableWidget->item(i,STATUS_COLUMN)->isSelected()) { - countselected++; QTime duration = QTime().fromString(tableWidget->item(i,DURATION_COLUMN)->text(), "hh:mm:ss"); totalduration += duration.hour() * 3600 + diff --git a/src/Gui/RideNavigator.cpp b/src/Gui/RideNavigator.cpp index 3064d166f..e54de327b 100644 --- a/src/Gui/RideNavigator.cpp +++ b/src/Gui/RideNavigator.cpp @@ -658,11 +658,9 @@ RideNavigator::setColumnWidth(int x, bool resized, int logicalIndex, int oldWidt // is it narrower than the headings? int headwidth=0; - int n=0; for (int i=1; iheader()->count(); i++) if (tableView->header()->isSectionHidden(i) == false) { headwidth += tableView->columnWidth(i); - n++; } if (!resized) { diff --git a/src/Metrics/Estimator.cpp b/src/Metrics/Estimator.cpp index 608fda058..191fcec4e 100644 --- a/src/Metrics/Estimator.cpp +++ b/src/Metrics/Estimator.cpp @@ -318,7 +318,7 @@ Estimator::run() printd("%s WPK Estimates for %s - %s (%s): CP=%.1f W'=%.1f\n", sport.toStdString().c_str(), add.from.toString().toStdString().c_str(), add.to.toString().toStdString().c_str(), add.model.toStdString().c_str(), add.CP, add.WPrime); est << add; } else { - printd("%s WPK Estimates for %s - %s (%s): Not available\n", sport.toStdString().c_str(), add.from.toString().toStdString().c_str(), add.to.toString().toStdString().c_str(), add.model.toStdString().c_str(), add.CP, add.WPrime); + printd("%s WPK Estimates for %s - %s (%s): Not available\n", sport.toStdString().c_str(), add.from.toString().toStdString().c_str(), add.to.toString().toStdString().c_str(), add.model.toStdString().c_str()); } } diff --git a/src/Metrics/ExtendedCriticalPower.cpp b/src/Metrics/ExtendedCriticalPower.cpp index 0e090ecc8..74c0cdc7b 100644 --- a/src/Metrics/ExtendedCriticalPower.cpp +++ b/src/Metrics/ExtendedCriticalPower.cpp @@ -2477,8 +2477,6 @@ ExtendedCriticalPower::getPlotCurveForDerived(RideFileCache *bests, RideFile::Se QVector smoothed; QVector time; - double total = 0.0; - int l = 10; int d = 5; for (int i = 1; i < 1 + d; i++) { @@ -2486,7 +2484,6 @@ ExtendedCriticalPower::getPlotCurveForDerived(RideFileCache *bests, RideFile::Se yValues.append(newvalue); xValues.append((i)/60.0f); - total += newvalue; } for (int i=1; i < count - d; i++) { @@ -2494,10 +2491,8 @@ ExtendedCriticalPower::getPlotCurveForDerived(RideFileCache *bests, RideFile::Se yValues.append(newvalue); xValues.append((i+d)/60.0f); - total += newvalue; if (yValues.count() > l) { - total -= yValues.at(0); xValues.remove(0); yValues.remove(0); } diff --git a/src/Metrics/RideMetadata.cpp b/src/Metrics/RideMetadata.cpp index d4c4b133c..53e4e8618 100644 --- a/src/Metrics/RideMetadata.cpp +++ b/src/Metrics/RideMetadata.cpp @@ -729,7 +729,6 @@ Form::arrange() { QGridLayout *here; - int x=0; int y=0; // ok, so we are managing interval metadata @@ -758,7 +757,6 @@ Form::arrange() for (int i=0; i= rows && meta->singlecolumn==false) { - x+=1; y=0; vlayout2 = new QVBoxLayout; @@ -788,9 +786,6 @@ Form::arrange() override->addWidget(fields[i]->widget); here->addLayout(override, y, 1, alignment); - //} else if (fields[i]->definition.type == GcFieldType::FIELD_TEXTBOX) { - // here->addWidget(fields[i]->widget, ++y, 0, 2, 2, alignment); - // y++; } else { here->addWidget(fields[i]->widget, y, 1, alignment); } @@ -900,7 +895,7 @@ Form::metadataChanged() /*---------------------------------------------------------------------- * Form fields *--------------------------------------------------------------------*/ -FormField::FormField(Form *form, FieldDefinition field, RideMetadata *meta) : form(form), definition(field), meta(meta), active(true) +FormField::FormField(Form *form, FieldDefinition field, RideMetadata *meta) : definition(field), form(form), meta(meta), active(true) { QString units; enabled = NULL; @@ -1019,6 +1014,8 @@ FormField::FormField(Form *form, FieldDefinition field, RideMetadata *meta) : fo //widget->setFixedHeight(18); connect(widget, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int))); break; + + default: break; } widget->setPalette(meta->palette); @@ -1100,6 +1097,8 @@ FormField::metadataFlush() break; case GcFieldType::FIELD_DATE : text = ((QDateEdit*)widget)->date().toString("dd/MM/yyyy"); break; case GcFieldType::FIELD_TIME : text = ((QTimeEdit*)widget)->time().toString("hh:mm:ss.zzz"); break; + + default: break; } // Update special field @@ -1239,6 +1238,8 @@ FormField::editFinished() break; case GcFieldType::FIELD_DATE : text = ((QDateEdit*)widget)->date().toString("dd/MM/yyyy"); break; case GcFieldType::FIELD_TIME : text = ((QTimeEdit*)widget)->time().toString("hh:mm:ss.zzz"); break; + + default: break; } meta->active = active = true; @@ -1571,6 +1572,8 @@ FormField::metadataChanged() ((QCheckBox*)widget)->setChecked((value == "1") ? true : false); } break; + + default: break; } } active = false; diff --git a/src/Metrics/WPrime.cpp b/src/Metrics/WPrime.cpp index 29c3bda4c..92c41efe5 100644 --- a/src/Metrics/WPrime.cpp +++ b/src/Metrics/WPrime.cpp @@ -395,8 +395,6 @@ WPrime::setWatts(Context *context, QVector&wattsArray, int CP, int WPRIME) // input array contains the actual W' expenditure // and will also contain non-zero values - double totalBelowCP=0; - double countBelowCP=0; QVector powerValues(last+1); EXP = 0; for (int i=0; i&wattsArray, int CP, int WPRIME) powerValues[i] = value > CP ? value-CP : 0; - if (value < CP) { - totalBelowCP += value; - countBelowCP++; - } else EXP += value; // total expenditure above CP + if (value >= CP) EXP += value; // total expenditure above CP } TAU = appsettings->cvalue(context->athlete->cyclist, GC_WBALTAU, 300).toInt(); @@ -513,8 +508,6 @@ WPrime::setErg(ErgFile *input) // input array contains the actual W' expenditure // and will also contain non-zero values - double totalBelowCP=0; - double countBelowCP=0; QVector powerValues(last+1); EXP = 0; for (int i=0; i CP ? value-CP : 0; - if (value < CP) { - totalBelowCP += value; - countBelowCP++; - } else EXP += value; // total expenditure above CP + if (value >= CP) EXP += value; // total expenditure above CP } TAU = appsettings->cvalue(input->context->athlete->cyclist, GC_WBALTAU, 300).toInt(); diff --git a/src/R/RTool.cpp b/src/R/RTool.cpp index e0b8e8f1f..6a9661a7f 100644 --- a/src/R/RTool.cpp +++ b/src/R/RTool.cpp @@ -2419,10 +2419,6 @@ RTool::activity(SEXP datetime, SEXP pCompare, SEXP pSplit, SEXP pJoin) if (compare && rtool->context->isCompareIntervals) { - // how many to return? - int count=0; - foreach(CompareInterval p, rtool->context->compareIntervals) if (p.isChecked()) count++; - // cool we can return a list of intervals to compare QList f; diff --git a/src/Train/Computrainer.cpp b/src/Train/Computrainer.cpp index 9fd1cc85f..d5db9e2b0 100644 --- a/src/Train/Computrainer.cpp +++ b/src/Train/Computrainer.cpp @@ -191,7 +191,9 @@ void Computrainer::getTelemetry(double &power, double &heartrate, double &cadenc void Computrainer::getSpinScan(double spinData[]) { pvars.lock(); - for (int i=0; i<24; spinData[i] = this->spinScan[i]) ; + for (int i=0; i<24; i++) { + spinData[i] = this->spinScan[i]; + } pvars.unlock(); } @@ -803,7 +805,7 @@ int Computrainer::openPort() // LINUX AND MAC USES TERMIO / IOCTL / STDIO -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) int ldisc=TTYDISC; #else int ldisc=N_TTY; // LINUX @@ -829,7 +831,7 @@ int Computrainer::openPort() deviceSettings.c_cflag &= (~CSIZE & ~CSTOPB); deviceSettings.c_oflag=0; -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) deviceSettings.c_cflag &= (~CCTS_OFLOW & ~CRTS_IFLOW); // no hardware flow control deviceSettings.c_cflag |= (CS8 | CLOCAL | CREAD | HUPCL); #else diff --git a/src/Train/DialWindow.cpp b/src/Train/DialWindow.cpp index fe957b962..114e84bb5 100644 --- a/src/Train/DialWindow.cpp +++ b/src/Train/DialWindow.cpp @@ -792,6 +792,8 @@ void DialWindow::seriesChanged() case RealtimeData::HeatLoad: foreground = GColor(CHEATLOAD); break; + + default: break; } valueLabel->setStrategy(appsettings->value(this, TRAIN_TELEMETRY_FONT_SCALING, 0).toInt() == 0 ? ScalingLabelStrategy::HeightOnly : ScalingLabelStrategy::Linear); diff --git a/src/Train/ElevationChartWindow.h b/src/Train/ElevationChartWindow.h index e0aa9da7f..67a98b812 100644 --- a/src/Train/ElevationChartWindow.h +++ b/src/Train/ElevationChartWindow.h @@ -21,7 +21,7 @@ namespace elevationChart { public: explicit BubbleWidget(double deltaSeconds_, QWidget *parent = nullptr) : - deltaSeconds(deltaSeconds_), QWidget(parent), m_rtData(nullptr), m_ergFileAdapter(nullptr) + QWidget(parent), deltaSeconds(deltaSeconds_), m_rtData(nullptr), m_ergFileAdapter(nullptr) { // Set a size policy to allow resizing setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -32,9 +32,9 @@ namespace elevationChart { void setErgFileAdapter(ErgFileQueryAdapter *ergFileAdapter) { m_ergFileAdapter = ergFileAdapter; } private: + double deltaSeconds; RealtimeData *m_rtData; ErgFileQueryAdapter *m_ergFileAdapter; - double deltaSeconds; protected: void paintEvent(QPaintEvent *event) override; diff --git a/src/Train/ErgFile.cpp b/src/Train/ErgFile.cpp index fa7951c7e..4a3320ee4 100644 --- a/src/Train/ErgFile.cpp +++ b/src/Train/ErgFile.cpp @@ -783,7 +783,7 @@ void ErgFile::parseFromRideFileFactory() // TTS File Gradient Should be smoothly interpolated from Altitude. strictGradient(false); - static double km = 0; + // static double km = 0; QFile gpxFile(filename()); diff --git a/src/Train/EzUsb.c b/src/Train/EzUsb.c index a45a521d8..e84b4e32e 100644 --- a/src/Train/EzUsb.c +++ b/src/Train/EzUsb.c @@ -334,7 +334,7 @@ int parse_ihex ( /* Read the record type */ tmp = buf[9]; buf[9] = 0; - type = strtoul(buf+7, 0, 16); + type = (char) strtoul(buf+7, 0, 16); buf[9] = tmp; /* If this is an EOF record, then make it so. */ @@ -378,7 +378,7 @@ int parse_ihex ( for (idx = 0, cp = buf+9 ; idx < len ; idx += 1, cp += 2) { tmp = cp[2]; cp[2] = 0; - data [data_len + idx] = strtoul(cp, 0, 16); + data [data_len + idx] = (unsigned char) strtoul(cp, 0, 16); cp[2] = tmp; } data_len += len; @@ -449,7 +449,7 @@ int parse_imagic ( } while (1) { - rc = fread(&imagic_firmware_element, 1, sizeof(imagic_firmware_element), image); + rc = (int) fread(&imagic_firmware_element, 1, sizeof(imagic_firmware_element), image); if (rc != sizeof(imagic_firmware_element)) { printf("Error reading imagic driver file\n"); return -2; @@ -475,7 +475,7 @@ int parse_imagic ( return -2; } while (1) { - rc = fread(&imagic_firmware_element, 1, sizeof(imagic_firmware_element), image); + rc = (int) fread(&imagic_firmware_element, 1, sizeof(imagic_firmware_element), image); if (rc != sizeof(imagic_firmware_element)) { printf("Error reading imagic driver file\n"); return -2; @@ -555,7 +555,7 @@ static int ram_poke ( return -EDOM; } - ctx->total += len; + ctx->total += (unsigned int) len; ctx->count++; /* Retry this till we get a real error. Control messages are not @@ -749,10 +749,10 @@ static int eeprom_poke ( */ /* write header */ - header [0] = len >> 8; - header [1] = len; + header [0] = (unsigned char) (len >> 8); + header [1] = (unsigned char) len; header [2] = addr >> 8; - header [3] = addr; + header [3] = (unsigned char) addr; if (ctx->last) header [0] |= 0x80; if ((rc = ezusb_write (ctx->device, "write EEPROM segment header", @@ -767,7 +767,7 @@ static int eeprom_poke ( return rc; /* next shouldn't overwrite it */ - ctx->ee_addr += 4 + len; + ctx->ee_addr += (unsigned short) (4 + len); return 0; } diff --git a/src/Train/Fortius.cpp b/src/Train/Fortius.cpp index 5f503528c..bee1407fb 100644 --- a/src/Train/Fortius.cpp +++ b/src/Train/Fortius.cpp @@ -706,7 +706,6 @@ int Fortius::sendRunCommand(int16_t pedalSensor) int retCode = 0; pvars.lock(); int mode = this->mode; - double gradient = this->gradient; double load = this->load; double weight = this->weight; double brakeCalibrationForce_N = this->brakeCalibrationForce_N; diff --git a/src/Train/Integrator.h b/src/Train/Integrator.h index 55d1496d8..1ee5d1175 100644 --- a/src/Train/Integrator.h +++ b/src/Train/Integrator.h @@ -240,8 +240,8 @@ Integrate_Yoshida8(const T &state, double v) { // Yoshida Solution A, B, C static const double s_WA[] = {-1.61582374150097,-2.44699182370524,-0.00716989419708120, 2.44002732616735, 0.157739928123617, 1.82020630970714, 1.04242620869991 }; - static const double s_WB[] = {-0.00169248587770116, 2.89195744315849, 0.00378039588360192, -2.89688250328827, 2.89105148970595, -2.33864815101035, 1.48819229202922 }; - static const double s_WC[] = { 0.311790812418427,-1.55946803821447,-1.6789692825964, 1.66335809963315,-1.06458714789183, 1.36934946416871, 0.629030650210433 }; + // static const double s_WB[] = {-0.00169248587770116, 2.89195744315849, 0.00378039588360192, -2.89688250328827, 2.89105148970595, -2.33864815101035, 1.48819229202922 }; + // static const double s_WC[] = { 0.311790812418427,-1.55946803821447,-1.6789692825964, 1.66335809963315,-1.06458714789183, 1.36934946416871, 0.629030650210433 }; static const double *s_W = s_WA; diff --git a/src/Train/TrainerDayAPIDialog.cpp b/src/Train/TrainerDayAPIDialog.cpp index 01c820065..0d514583b 100644 --- a/src/Train/TrainerDayAPIDialog.cpp +++ b/src/Train/TrainerDayAPIDialog.cpp @@ -424,7 +424,6 @@ TrainerDayAPIDialog::groupBoxClicked { int checked = 0; int unchecked = 0; - int uncheckable = 0; for (QGroupBox *box : groupBoxes) { if (box->isCheckable()) { if (box->isChecked()) { @@ -432,8 +431,6 @@ TrainerDayAPIDialog::groupBoxClicked } else { ++unchecked; } - } else { - ++uncheckable; } } selectAll->setEnabled(checked + unchecked > 0); diff --git a/src/Train/USBXpress.cpp b/src/Train/USBXpress.cpp index 723cb75b0..9e3dc23b3 100644 --- a/src/Train/USBXpress.cpp +++ b/src/Train/USBXpress.cpp @@ -31,7 +31,7 @@ bool USBXpress::find() // any USBXpress devices connected? SI_GetNumDevices(&numDevices); - if (numDevices == 0) return -1; + if (numDevices == 0) return false; // lets see if one of them is a GARMIN USB1 stick and open it for (unsigned int i=0; i* metersWidget, QList* layoutNames, QWidget* VideoContainer, Context* context) - : metersWidget(metersWidget), layoutNames(layoutNames), VideoContainer(VideoContainer), context(context) + : context(context), metersWidget(metersWidget), layoutNames(layoutNames), VideoContainer(VideoContainer) { nonameindex = 0; skipLayout = false; diff --git a/src/Train/VideoSyncFile.cpp b/src/Train/VideoSyncFile.cpp index b3e223381..9c3c5b2e1 100644 --- a/src/Train/VideoSyncFile.cpp +++ b/src/Train/VideoSyncFile.cpp @@ -358,7 +358,7 @@ void VideoSyncFile::parseFromRideFileFactory() format(VideoSyncFileFormat::rlv); Points.clear(); - static double km = 0; + // static double km = 0; QFile rideFile(filename()); diff --git a/src/Train/WorkoutMenuProvider.cpp b/src/Train/WorkoutMenuProvider.cpp index 8663fd676..3fa3c71a6 100644 --- a/src/Train/WorkoutMenuProvider.cpp +++ b/src/Train/WorkoutMenuProvider.cpp @@ -318,10 +318,10 @@ WorkoutMenuProvider::addTagDialog layout->addWidget(matchMode); layout->addWidget(buttonBox); - connect(filterEdit, &WorkoutFilterBox::textChanged, this, [this, filterModel](const QString &text) { + connect(filterEdit, &WorkoutFilterBox::textChanged, this, [filterModel](const QString &text) { filterModel->setContains(text.trimmed()); }); - connect(tagList->selectionModel(), &QItemSelectionModel::selectionChanged, this, [this, buttonBox, tagList]() { + connect(tagList->selectionModel(), &QItemSelectionModel::selectionChanged, this, [buttonBox, tagList]() { buttonBox->button(QDialogButtonBox::Ok)->setEnabled(tagList->selectionModel()->hasSelection()); }); connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); @@ -407,7 +407,7 @@ WorkoutMenuProvider::manageFiltersDialog connect(actionButtons, &ActionButtonBox::addRequested, this, [this, filterTree]() { manageAdd(filterTree); }); connect(actionButtons, &ActionButtonBox::deleteRequested, this, [this, filterTree]() { manageDelete(filterTree->currentItem()); }); connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::accept); - QMetaObject::Connection updateEnabledConn = connect(editor, &WorkoutFilterBox::textChanged, this, [this, update](const QString &text) { + QMetaObject::Connection updateEnabledConn = connect(editor, &WorkoutFilterBox::textChanged, this, [update](const QString &text) { update->setEnabled(! text.trimmed().isEmpty()); }); @@ -441,7 +441,7 @@ WorkoutMenuProvider::addFilterDialog connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); - connect(nameEdit, &QLineEdit::textChanged, this, [this, buttonBox](const QString &text) { + connect(nameEdit, &QLineEdit::textChanged, this, [buttonBox](const QString &text) { buttonBox->button(QDialogButtonBox::Ok)->setEnabled(! text.trimmed().isEmpty()); }); nameEdit->setClearButtonEnabled(true); diff --git a/src/Train/WorkoutWidget.cpp b/src/Train/WorkoutWidget.cpp index 5c077a4f8..465a443e2 100644 --- a/src/Train/WorkoutWidget.cpp +++ b/src/Train/WorkoutWidget.cpp @@ -49,8 +49,8 @@ static double CTEMP_BASE = 36.5; static double CTEMP_DEFAULT_MAX = 38.0; static double STEMP_BASE = 32.0; static double STEMP_DEFAULT_MAX = 38.0; -static double HRPWR_DEFAULT_MAX = 40; -static double HRPWR_MAX_LIMIT = 60; +// static double HRPWR_DEFAULT_MAX = 40; +// static double HRPWR_MAX_LIMIT = 60; static double CTEMP_MAX_LIMIT = 39.5; diff --git a/src/Train/WorkoutWizard.cpp b/src/Train/WorkoutWizard.cpp index 4e69bc669..50c75a694 100644 --- a/src/Train/WorkoutWizard.cpp +++ b/src/Train/WorkoutWizard.cpp @@ -161,8 +161,6 @@ void WorkoutEditorGradient::insertDataRow(int row) void WorkoutMetricsSummary::updateMetrics(QStringList &order, QHash &metrics) { - int row = 0; - foreach(QString name, order) { RideMetricPtr rmp = metrics[name]; @@ -189,14 +187,12 @@ void WorkoutMetricsSummary::updateMetrics(QStringList &order, QHashsetText(QString::number(rmp->value(true),'f',rmp->precision()) + " " + (rmp->units(true)) ); } //qDebug() << name << ":" << (int)rmp->value(true); - row++; } } void WorkoutMetricsSummary::updateMetrics(QMap &map) { QMap::iterator i = map.begin(); - int row = 0; while(i != map.end()) { if(!metricMap.contains(i.key())) @@ -209,7 +205,6 @@ void WorkoutMetricsSummary::updateMetrics(QMap &map) } QLabel *value = metricMap[i.key()].second; value->setText(i.value()); - row++; ++i; } } @@ -578,7 +573,7 @@ void GradientPage::updateMetrics() int totalDistance = 0; double gain = 0; - int elevation = 0; + // create rideFile QSharedPointer workout(new RideFile()); workout->setRecIntSecs(1); @@ -589,7 +584,6 @@ void GradientPage::updateMetrics() double grade = data[i].second.toDouble(); double delta = distance * (metricUnits ? 1000 : 5120) * grade /100; gain += (delta > 0) ? delta : 0; - elevation += delta; totalDistance += distance; } QMap metricSummaryMap;