mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
Using "actual activity" instead of "completed activity" (#4813)
To match #4811
This commit is contained in:
committed by
GitHub
parent
253b2206ce
commit
f6d4f6a6cb
@@ -54,7 +54,7 @@ LinkDialog::LinkDialog
|
||||
|
||||
QLabel *introLabel = new QLabel();
|
||||
if (entry.planned) {
|
||||
introLabel->setText(tr("Find a completed activity for:"));
|
||||
introLabel->setText(tr("Find an actual activity for:"));
|
||||
} else {
|
||||
introLabel->setText(tr("Find a planned activity for:"));
|
||||
}
|
||||
@@ -112,7 +112,7 @@ LinkDialog::LinkDialog
|
||||
|
||||
QLabel *rangeLabel = new QLabel();
|
||||
if (entry.planned) {
|
||||
rangeLabel->setText(tr("Show <b>completed %2</b> activities").arg(entry.sport));
|
||||
rangeLabel->setText(tr("Show <b>actual %2</b> activities").arg(entry.sport));
|
||||
} else {
|
||||
rangeLabel->setText(tr("Show <b>planned %2</b> activities").arg(entry.sport));
|
||||
}
|
||||
@@ -137,7 +137,7 @@ LinkDialog::LinkDialog
|
||||
QString emptyHeadline = tr("No matching activities found");
|
||||
QString emptyInfoline;
|
||||
if (entry.planned) {
|
||||
emptyInfoline = tr("There are no unlinked completed %1 activities in the selected date range.").arg(entry.sport);
|
||||
emptyInfoline = tr("There are no unlinked actual %1 activities in the selected date range.").arg(entry.sport);
|
||||
} else {
|
||||
emptyInfoline = tr("There are no unlinked planned %1 activities in the selected date range.").arg(entry.sport);
|
||||
}
|
||||
@@ -1000,7 +1000,7 @@ CalendarWindow::getActivities
|
||||
activity.reference = rideItem->fileName;
|
||||
activity.start = rideItem->dateTime.time();
|
||||
activity.durationSecs = rideItem->getForSymbol("workout_time", GlobalContext::context()->useMetricUnits);
|
||||
activity.type = rideItem->planned ? ENTRY_TYPE_PLANNED_ACTIVITY : ENTRY_TYPE_ACTIVITY;
|
||||
activity.type = rideItem->planned ? ENTRY_TYPE_PLANNED_ACTIVITY : ENTRY_TYPE_ACTUAL_ACTIVITY;
|
||||
activity.isRelocatable = rideItem->planned;
|
||||
activity.hasTrainMode = rideItem->planned && sport == "Bike" && ! buildWorkoutFilter(rideItem).isEmpty();
|
||||
activity.dirty = rideItem->isDirty();
|
||||
|
||||
@@ -1443,20 +1443,20 @@ RideCache::checkShiftPlannedActivities
|
||||
check.requiresUserDecision = true;
|
||||
|
||||
QStringList plannedDirty;
|
||||
QStringList completedDirty;
|
||||
QStringList actualDirty;
|
||||
for (RideItem *item : check.dirtyItems) {
|
||||
if (item->planned) {
|
||||
plannedDirty << item->fileName;
|
||||
} else {
|
||||
completedDirty << item->fileName;
|
||||
actualDirty << item->fileName;
|
||||
}
|
||||
}
|
||||
QString msg = tr("This operation will shift %1 planned activities.\n\n").arg(itemsToShift.count());
|
||||
if (! plannedDirty.isEmpty()) {
|
||||
msg += tr("Planned activities with unsaved changes:\n%1\n\n").arg(plannedDirty.join("\n"));
|
||||
}
|
||||
if (! completedDirty.isEmpty()) {
|
||||
msg += tr("Linked completed activities with unsaved changes:\n%1\n\n").arg(completedDirty.join("\n"));
|
||||
if (! actualDirty.isEmpty()) {
|
||||
msg += tr("Linked actual activities with unsaved changes:\n%1\n\n").arg(actualDirty.join("\n"));
|
||||
}
|
||||
|
||||
msg += tr("All affected activities must be saved or changes discarded before shifting.");
|
||||
@@ -1797,7 +1797,7 @@ RideCache::isValidLink
|
||||
return false;
|
||||
}
|
||||
if (item1->planned == item2->planned) {
|
||||
error = tr("Cannot link two activities of the same type. One must be planned, one completed.");
|
||||
error = tr("Cannot link two activities of the same type. One must be planned, one actual.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -161,32 +161,33 @@ CalendarBaseTable::buildContextMenu
|
||||
(const CalendarDay &day, CalendarEntry const * const entryPtr, const QTime &time, bool canHavePhasesEvents)
|
||||
{
|
||||
QMenu *contextMenu = new QMenu(this);
|
||||
const QString ellipsis = QStringLiteral("...");
|
||||
if (entryPtr != nullptr) {
|
||||
CalendarEntry entry = *entryPtr; // Prevent dereferencing of dangling pointer in lambdas
|
||||
switch (entry.type) {
|
||||
case ENTRY_TYPE_ACTIVITY:
|
||||
case ENTRY_TYPE_ACTUAL_ACTIVITY:
|
||||
if (entry.dirty) {
|
||||
contextMenu->addAction(tr("Save changes"), this, [this, entry]() { emit saveChanges(entry); });
|
||||
contextMenu->addAction(tr("Discard changes"), this, [this, entry]() { emit discardChanges(entry); });
|
||||
contextMenu->addSeparator();
|
||||
}
|
||||
if (! entry.linkedReference.isEmpty()) {
|
||||
contextMenu->addAction(tr("View planned activity..."), this, [this, entry]() {
|
||||
contextMenu->addAction(tr("View planned activity") % ellipsis, this, [this, entry]() {
|
||||
emit viewLinkedActivity(entry);
|
||||
});
|
||||
}
|
||||
contextMenu->addAction(tr("View completed activity..."), this, [this, entry]() { emit viewActivity(entry); });
|
||||
contextMenu->addAction(tr("View actual activity") % ellipsis, this, [this, entry]() { emit viewActivity(entry); });
|
||||
contextMenu->addSeparator();
|
||||
if (entry.linkedReference.isEmpty()) {
|
||||
contextMenu->addAction(tr("Link to planned activity"), this, [this, entry]() { emit linkActivity(entry, true); });
|
||||
contextMenu->addAction(tr("Link to planned activity..."), this, [this, entry]() { emit linkActivity(entry, false); });
|
||||
contextMenu->addAction(tr("Link to planned activity") % ellipsis, this, [this, entry]() { emit linkActivity(entry, false); });
|
||||
} else {
|
||||
contextMenu->addAction(tr("Unlink from planned activity"), this, [this, entry]() { emit unlinkActivity(entry); });
|
||||
}
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(tr("Filter similar activities..."), this, [this, entry]() { emit filterSimilar(entry); });
|
||||
contextMenu->addAction(tr("Filter similar activities") % ellipsis, this, [this, entry]() { emit filterSimilar(entry); });
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(tr("Delete completed activity"), this, [this, entry]() { emit delActivity(entry); });
|
||||
contextMenu->addAction(tr("Delete actual activity"), this, [this, entry]() { emit delActivity(entry); });
|
||||
break;
|
||||
case ENTRY_TYPE_PLANNED_ACTIVITY:
|
||||
if (entry.dirty) {
|
||||
@@ -195,34 +196,34 @@ CalendarBaseTable::buildContextMenu
|
||||
contextMenu->addSeparator();
|
||||
}
|
||||
if (! entry.linkedReference.isEmpty()) {
|
||||
contextMenu->addAction(tr("View completed activity..."), this, [this, entry]() { emit viewLinkedActivity(entry); });
|
||||
contextMenu->addAction(tr("View actual activity") % ellipsis, this, [this, entry]() { emit viewLinkedActivity(entry); });
|
||||
}
|
||||
contextMenu->addAction(tr("View planned activity..."), this, [this, entry]() { emit viewActivity(entry); });
|
||||
contextMenu->addAction(tr("View planned activity") % ellipsis, this, [this, entry]() { emit viewActivity(entry); });
|
||||
contextMenu->addSeparator();
|
||||
if (entry.linkedReference.isEmpty()) {
|
||||
contextMenu->addAction(tr("Mark as completed"), this, [this, entry]() { emit linkActivity(entry, true); });
|
||||
contextMenu->addAction(tr("Mark as completed..."), this, [this, entry]() { emit linkActivity(entry, false); });
|
||||
contextMenu->addAction(tr("Link to actual activity"), this, [this, entry]() { emit linkActivity(entry, true); });
|
||||
contextMenu->addAction(tr("Link to actual activity") % ellipsis, this, [this, entry]() { emit linkActivity(entry, false); });
|
||||
} else {
|
||||
contextMenu->addAction(tr("Mark as incomplete"), this, [this, entry]() { emit unlinkActivity(entry); });
|
||||
contextMenu->addAction(tr("Unlink from actual activity"), this, [this, entry]() { emit unlinkActivity(entry); });
|
||||
}
|
||||
contextMenu->addSeparator();
|
||||
if (entry.hasTrainMode) {
|
||||
contextMenu->addAction(tr("Show in train mode..."), this, [this, entry]() { emit showInTrainMode(entry); });
|
||||
contextMenu->addAction(tr("Show in train mode") % ellipsis, this, [this, entry]() { emit showInTrainMode(entry); });
|
||||
}
|
||||
contextMenu->addAction(tr("Filter similar activities..."), this, [this, entry]() { emit filterSimilar(entry); });
|
||||
contextMenu->addAction(tr("Filter similar activities") % ellipsis, this, [this, entry]() { emit filterSimilar(entry); });
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(tr("Delete planned activity"), this, [this, entry]() { emit delActivity(entry); });
|
||||
break;
|
||||
case ENTRY_TYPE_EVENT:
|
||||
if (canHavePhasesEvents) {
|
||||
contextMenu->addAction(tr("Edit event..."), this, [this, entry]() { emit editEvent(entry); });
|
||||
contextMenu->addAction(tr("Edit event") % ellipsis, this, [this, entry]() { emit editEvent(entry); });
|
||||
contextMenu->addAction(tr("Delete event"), this, [this, entry]() { emit delEvent(entry); });
|
||||
}
|
||||
break;
|
||||
case ENTRY_TYPE_PHASE:
|
||||
if (canHavePhasesEvents) {
|
||||
contextMenu->addAction(tr("Edit phase..."), this, [this, entry]() { emit editPhase(entry); });
|
||||
contextMenu->addAction(tr("Delete phase..."), this, [this, entry]() { emit delPhase(entry); });
|
||||
contextMenu->addAction(tr("Edit phase") % ellipsis, this, [this, entry]() { emit editPhase(entry); });
|
||||
contextMenu->addAction(tr("Delete phase") % ellipsis, this, [this, entry]() { emit delPhase(entry); });
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -241,7 +242,7 @@ CalendarBaseTable::buildContextMenu
|
||||
canAddPlanned = day.date >= QDate::currentDate();
|
||||
}
|
||||
if (canAddActivity) {
|
||||
contextMenu->addAction(tr("Log activity..."), this, [this, day, time]() {
|
||||
contextMenu->addAction(tr("Log activity") % ellipsis, this, [this, day, time]() {
|
||||
QTime activityTime(time);
|
||||
if (! activityTime.isValid()) {
|
||||
activityTime = QTime::currentTime();
|
||||
@@ -253,7 +254,7 @@ CalendarBaseTable::buildContextMenu
|
||||
});
|
||||
}
|
||||
if (canAddPlanned) {
|
||||
contextMenu->addAction(tr("Plan activity..."), this, [this, day, time]() {
|
||||
contextMenu->addAction(tr("Plan activity") % ellipsis, this, [this, day, time]() {
|
||||
QTime activityTime(time);
|
||||
if (! activityTime.isValid()) {
|
||||
activityTime = QTime::currentTime();
|
||||
@@ -266,12 +267,12 @@ CalendarBaseTable::buildContextMenu
|
||||
}
|
||||
if (canHavePhasesEvents) {
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(tr("Add phase..."), this, [this, day]() { emit addPhase(day.date); });
|
||||
contextMenu->addAction(tr("Add event..."), this, [this, day]() { emit addEvent(day.date); });
|
||||
contextMenu->addAction(tr("Add phase") % ellipsis, this, [this, day]() { emit addPhase(day.date); });
|
||||
contextMenu->addAction(tr("Add event") % ellipsis, this, [this, day]() { emit addEvent(day.date); });
|
||||
}
|
||||
if (day.date >= QDate::currentDate()) {
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(tr("Repeat schedule..."), this, [this, day]() { emit repeatSchedule(day.date); });
|
||||
contextMenu->addAction(tr("Repeat schedule") % ellipsis, this, [this, day]() { emit repeatSchedule(day.date); });
|
||||
bool hasPlannedActivity = false;
|
||||
for (const CalendarEntry &dayEntry : day.entries) {
|
||||
if (dayEntry.type == ENTRY_TYPE_PLANNED_ACTIVITY) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <QColor>
|
||||
#include <utility>
|
||||
|
||||
#define ENTRY_TYPE_ACTIVITY 0
|
||||
#define ENTRY_TYPE_ACTUAL_ACTIVITY 0
|
||||
#define ENTRY_TYPE_PLANNED_ACTIVITY 1
|
||||
#define ENTRY_TYPE_EVENT 10
|
||||
#define ENTRY_TYPE_PHASE 11
|
||||
|
||||
@@ -428,7 +428,7 @@ CalendarDetailedDayDelegate::paint
|
||||
relColor = GCColor::blendedColor(relColor, bgColor);
|
||||
entryBG = relColor;
|
||||
entryFrame = relColor;
|
||||
} else if (entry.type == ENTRY_TYPE_ACTIVITY) {
|
||||
} else if (entry.type == ENTRY_TYPE_ACTUAL_ACTIVITY) {
|
||||
QColor overlayBG = entry.color;
|
||||
overlayBG = entry.color;
|
||||
if (GCColor::isPaletteDark(option.palette)) {
|
||||
@@ -1750,8 +1750,8 @@ toolTipDayEntry(const QPoint &pos, QAbstractItemView *view, const CalendarDay &d
|
||||
if (idx >= 0 && idx < day.entries.size()) {
|
||||
CalendarEntry calEntry = day.entries[idx];
|
||||
QString status;
|
||||
if (calEntry.type == ENTRY_TYPE_ACTIVITY) {
|
||||
status = QObject::tr("completed");
|
||||
if (calEntry.type == ENTRY_TYPE_ACTUAL_ACTIVITY) {
|
||||
status = QObject::tr("actual");
|
||||
} else {
|
||||
status = QObject::tr("planned");
|
||||
}
|
||||
@@ -1775,11 +1775,7 @@ toolTipDayEntry(const QPoint &pos, QAbstractItemView *view, const CalendarDay &d
|
||||
}
|
||||
if (! calEntry.linkedReference.isEmpty()) {
|
||||
QString countertype;
|
||||
if (calEntry.type == ENTRY_TYPE_PLANNED_ACTIVITY) {
|
||||
countertype = QObject::tr("Completed by");
|
||||
} else {
|
||||
countertype = QObject::tr("Planned as");
|
||||
}
|
||||
countertype = QObject::tr("Linked");
|
||||
tooltip += QString("<tr><td style='padding-top: %1px'><b>%2:</b></td><td style='padding-top: %1px'>%3</td></tr>").arg(6 * dpiYFactor).arg(countertype).arg(calEntry.linkedPrimary);
|
||||
if (calEntry.linkedStartDT.isValid()) {
|
||||
QString linkedWhen;
|
||||
|
||||
Reference in New Issue
Block a user