mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Revert "Made the agenda view of Calendar optional"
This reverts commit 5d58b75fe1.
It was a temporary fix to release v3.7.1
This commit is contained in:
@@ -44,10 +44,8 @@ CalendarWindow::CalendarWindow(Context *context)
|
||||
|
||||
setStartHour(8);
|
||||
setEndHour(21);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
setAgendaPastDays(7);
|
||||
setAgendaFutureDays(7);
|
||||
#endif
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
setChartLayout(mainLayout);
|
||||
@@ -240,7 +238,6 @@ CalendarWindow::setEndHour
|
||||
}
|
||||
|
||||
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
int
|
||||
CalendarWindow::getAgendaPastDays
|
||||
() const
|
||||
@@ -279,7 +276,6 @@ CalendarWindow::setAgendaFutureDays
|
||||
updateActivities();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool
|
||||
@@ -522,9 +518,7 @@ CalendarWindow::mkControls
|
||||
defaultViewCombo->addItem(tr("Day"));
|
||||
defaultViewCombo->addItem(tr("Week"));
|
||||
defaultViewCombo->addItem(tr("Month"));
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
defaultViewCombo->addItem(tr("Agenda"));
|
||||
#endif
|
||||
defaultViewCombo->setCurrentIndex(static_cast<int>(CalendarView::Month));
|
||||
firstDayOfWeekCombo = new QComboBox();
|
||||
for (int i = Qt::Monday; i <= Qt::Sunday; ++i) {
|
||||
@@ -537,14 +531,12 @@ CalendarWindow::mkControls
|
||||
endHourSpin = new QSpinBox();
|
||||
endHourSpin->setSuffix(":00");
|
||||
endHourSpin->setMaximum(24);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
agendaPastDaysSpin = new QSpinBox();
|
||||
agendaPastDaysSpin->setMaximum(31);
|
||||
agendaPastDaysSpin->setSuffix(" " + tr("day(s)"));
|
||||
agendaFutureDaysSpin = new QSpinBox();
|
||||
agendaFutureDaysSpin->setMaximum(31);
|
||||
agendaFutureDaysSpin->setSuffix(" " + tr("day(s)"));
|
||||
#endif
|
||||
summaryDayCheck = new QCheckBox(tr("Day View"));
|
||||
summaryDayCheck->setChecked(true);
|
||||
summaryWeekCheck = new QCheckBox(tr("Week View"));
|
||||
@@ -576,10 +568,8 @@ CalendarWindow::mkControls
|
||||
generalForm->addRow(tr("First Day of Week"), firstDayOfWeekCombo);
|
||||
generalForm->addRow(tr("Default Start Time"), startHourSpin);
|
||||
generalForm->addRow(tr("Default End Time"), endHourSpin);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
generalForm->addRow(tr("Agenda: Look Back"), agendaPastDaysSpin);
|
||||
generalForm->addRow(tr("Agenda: Look Forward"), agendaFutureDaysSpin);
|
||||
#endif
|
||||
generalForm->addRow(tr("Show Summary In"), summaryDayCheck);
|
||||
generalForm->addRow("", summaryWeekCheck);
|
||||
generalForm->addRow("", summaryMonthCheck);
|
||||
@@ -599,10 +589,8 @@ CalendarWindow::mkControls
|
||||
#if QT_VERSION < 0x060000
|
||||
connect(startHourSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &CalendarWindow::setStartHour);
|
||||
connect(endHourSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &CalendarWindow::setEndHour);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
connect(agendaPastDaysSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &CalendarWindow::setAgendaPastDays);
|
||||
connect(agendaFutureDaysSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &CalendarWindow::setAgendaFutureDays);
|
||||
#endif
|
||||
connect(defaultViewCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::setDefaultView);
|
||||
connect(firstDayOfWeekCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int idx) { setFirstDayOfWeek(idx + 1); });
|
||||
connect(primaryMainCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::updateActivities);
|
||||
@@ -612,10 +600,8 @@ CalendarWindow::mkControls
|
||||
#else
|
||||
connect(startHourSpin, &QSpinBox::valueChanged, this, &CalendarWindow::setStartHour);
|
||||
connect(endHourSpin, &QSpinBox::valueChanged, this, &CalendarWindow::setEndHour);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
connect(agendaPastDaysSpin, &QSpinBox::valueChanged, this, &CalendarWindow::setAgendaPastDays);
|
||||
connect(agendaFutureDaysSpin, &QSpinBox::valueChanged, this, &CalendarWindow::setAgendaFutureDays);
|
||||
#endif
|
||||
connect(defaultViewCombo, &QComboBox::currentIndexChanged, this, &CalendarWindow::setDefaultView);
|
||||
connect(firstDayOfWeekCombo, &QComboBox::currentIndexChanged, [=](int idx) { setFirstDayOfWeek(idx + 1); });
|
||||
connect(primaryMainCombo, &QComboBox::currentIndexChanged, this, &CalendarWindow::updateActivities);
|
||||
|
||||
@@ -42,10 +42,8 @@ class CalendarWindow : public GcChartWindow
|
||||
Q_PROPERTY(int firstDayOfWeek READ getFirstDayOfWeek WRITE setFirstDayOfWeek USER true)
|
||||
Q_PROPERTY(int startHour READ getStartHour WRITE setStartHour USER true)
|
||||
Q_PROPERTY(int endHour READ getEndHour WRITE setEndHour USER true)
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
Q_PROPERTY(int agendaPastDays READ getAgendaPastDays WRITE setAgendaPastDays USER true)
|
||||
Q_PROPERTY(int agendaFutureDays READ getAgendaFutureDays WRITE setAgendaFutureDays USER true)
|
||||
#endif
|
||||
Q_PROPERTY(bool summaryVisibleDay READ isSummaryVisibleDay WRITE setSummaryVisibleDay USER true)
|
||||
Q_PROPERTY(bool summaryVisibleWeek READ isSummaryVisibleWeek WRITE setSummaryVisibleWeek USER true)
|
||||
Q_PROPERTY(bool summaryVisibleMonth READ isSummaryVisibleMonth WRITE setSummaryVisibleMonth USER true)
|
||||
@@ -62,10 +60,8 @@ class CalendarWindow : public GcChartWindow
|
||||
int getFirstDayOfWeek() const;
|
||||
int getStartHour() const;
|
||||
int getEndHour() const;
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
int getAgendaPastDays() const;
|
||||
int getAgendaFutureDays() const;
|
||||
#endif
|
||||
bool isSummaryVisibleDay() const;
|
||||
bool isSummaryVisibleWeek() const;
|
||||
bool isSummaryVisibleMonth() const;
|
||||
@@ -84,10 +80,8 @@ class CalendarWindow : public GcChartWindow
|
||||
void setFirstDayOfWeek(int fdw);
|
||||
void setStartHour(int hour);
|
||||
void setEndHour(int hour);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
void setAgendaPastDays(int days);
|
||||
void setAgendaFutureDays(int days);
|
||||
#endif
|
||||
void setSummaryVisibleDay(bool visible);
|
||||
void setSummaryVisibleWeek(bool visible);
|
||||
void setSummaryVisibleMonth(bool svm);
|
||||
@@ -107,10 +101,8 @@ class CalendarWindow : public GcChartWindow
|
||||
QComboBox *firstDayOfWeekCombo;
|
||||
QSpinBox *startHourSpin;
|
||||
QSpinBox *endHourSpin;
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
QSpinBox *agendaPastDaysSpin;
|
||||
QSpinBox *agendaFutureDaysSpin;
|
||||
#endif
|
||||
QCheckBox *summaryDayCheck;
|
||||
QCheckBox *summaryWeekCheck;
|
||||
QCheckBox *summaryMonthCheck;
|
||||
|
||||
@@ -1803,7 +1803,6 @@ CalendarWeekView::selectedDate
|
||||
}
|
||||
|
||||
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CalendarAgendaView
|
||||
|
||||
@@ -2307,7 +2306,6 @@ CalendarAgendaView::showContextMenu
|
||||
|
||||
contextMenu.exec(agendaTree->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -2323,17 +2321,13 @@ Calendar::Calendar
|
||||
dayView = new CalendarDayView(dateInMonth, athleteMeasures);
|
||||
weekView = new CalendarWeekView(dateInMonth);
|
||||
monthView = new CalendarMonthTable(dateInMonth, firstDayOfWeek);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
agendaView = new CalendarAgendaView();
|
||||
#endif
|
||||
|
||||
viewStack = new QStackedWidget();
|
||||
viewStack->addWidget(dayView);
|
||||
viewStack->addWidget(weekView);
|
||||
viewStack->addWidget(monthView);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
viewStack->addWidget(agendaView);
|
||||
#endif
|
||||
|
||||
toolbar = new QToolBar();
|
||||
|
||||
@@ -2383,12 +2377,10 @@ Calendar::Calendar
|
||||
monthAction->setActionGroup(viewGroup);
|
||||
connect(monthAction, &QAction::triggered, [=]() { setView(CalendarView::Month); });
|
||||
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
agendaAction = toolbar->addAction(tr("Agenda"));
|
||||
agendaAction->setCheckable(true);
|
||||
agendaAction->setActionGroup(viewGroup);
|
||||
connect(agendaAction, &QAction::triggered, [=]() { setView(CalendarView::Agenda); });
|
||||
#endif
|
||||
|
||||
applyNavIcons();
|
||||
|
||||
@@ -2446,7 +2438,6 @@ Calendar::Calendar
|
||||
}
|
||||
});
|
||||
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
connect(agendaView, &CalendarAgendaView::dayChanged, [=](const QDate &date) {
|
||||
if (currentView() == CalendarView::Agenda) {
|
||||
emit dayChanged(date);
|
||||
@@ -2462,7 +2453,6 @@ Calendar::Calendar
|
||||
setDate(date);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
connect(prevAction, &QAction::triggered, [=]() { goNext(-1); });
|
||||
connect(nextAction, &QAction::triggered, [=]() { goNext(1); });
|
||||
@@ -2493,11 +2483,9 @@ Calendar::setDate
|
||||
if (monthView->isInDateRange(date)) {
|
||||
monthView->setMonth(date, allowKeepMonth);
|
||||
}
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
agendaView->updateDate();
|
||||
agendaView->setDateRange(dateRange);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2512,10 +2500,8 @@ Calendar::fillEntries
|
||||
weekView->fillEntries(activityEntries, summaries, headlineEntries);
|
||||
} else if (currentView() == CalendarView::Month) {
|
||||
monthView->fillEntries(activityEntries, summaries, headlineEntries);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
agendaView->fillEntries(activityEntries, summaries, headlineEntries);
|
||||
#endif
|
||||
}
|
||||
filterSpacerAction->setVisible(isFiltered);
|
||||
filterLabelAction->setVisible(isFiltered);
|
||||
@@ -2540,10 +2526,8 @@ Calendar::firstVisibleDay
|
||||
return weekView->firstVisibleDay();
|
||||
} else if (currentView() == CalendarView::Month) {
|
||||
return monthView->firstVisibleDay();
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
return agendaView->firstVisibleDay();
|
||||
#endif
|
||||
}
|
||||
return QDate();
|
||||
}
|
||||
@@ -2559,10 +2543,8 @@ Calendar::lastVisibleDay
|
||||
return weekView->lastVisibleDay();
|
||||
} else if (currentView() == CalendarView::Month) {
|
||||
return monthView->lastVisibleDay();
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
return agendaView->lastVisibleDay();
|
||||
#endif
|
||||
}
|
||||
return QDate();
|
||||
}
|
||||
@@ -2578,10 +2560,8 @@ Calendar::selectedDate
|
||||
return weekView->selectedDate();
|
||||
} else if (currentView() == CalendarView::Month) {
|
||||
return monthView->selectedDate();
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
return agendaView->selectedDate();
|
||||
#endif
|
||||
}
|
||||
return QDate();
|
||||
}
|
||||
@@ -2614,10 +2594,8 @@ Calendar::goNext
|
||||
if ((ret = newDate.isValid())) {
|
||||
setDate(newDate);
|
||||
}
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
ret = false;
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -2662,10 +2640,8 @@ Calendar::canGoNext
|
||||
fom = fom.addMonths(amount);
|
||||
lom = lom.addMonths(amount);
|
||||
return isInDateRange(fom) || isInDateRange(lom);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2689,15 +2665,11 @@ bool
|
||||
Calendar::isInDateRange
|
||||
(const QDate &date) const
|
||||
{
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
if (currentView() != CalendarView::Agenda) {
|
||||
return date.isValid() && dateRange.pass(date);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return date.isValid() && dateRange.pass(date);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -2714,11 +2686,9 @@ Calendar::activateDateRange
|
||||
setDate(currentDate, false);
|
||||
} else if (currentView() == CalendarView::Month) {
|
||||
setDate(fitToMonth(currentDate, false), true);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
agendaView->updateDate(); // AgendaView always uses today
|
||||
agendaView->setDateRange(dateRange); // AgendaView needs daterange for "Show in month view"
|
||||
#endif
|
||||
}
|
||||
seasonLabel->setText(tr("Season: %1").arg(dateRange.name));
|
||||
emit dateRangeActivated(dr.name);
|
||||
@@ -2760,7 +2730,6 @@ Calendar::setEndHour
|
||||
}
|
||||
|
||||
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
void
|
||||
Calendar::setAgendaPastDays
|
||||
(int days)
|
||||
@@ -2775,7 +2744,6 @@ Calendar::setAgendaFutureDays
|
||||
{
|
||||
agendaView->setFutureDays(days);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
@@ -2844,7 +2812,6 @@ Calendar::updateHeader
|
||||
separator->setVisible(true);
|
||||
dateNavigatorAction->setVisible(true);
|
||||
seasonLabelAction->setVisible(false);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
} else if (currentView() == CalendarView::Agenda) {
|
||||
prevAction->setVisible(false);
|
||||
nextAction->setVisible(false);
|
||||
@@ -2852,7 +2819,6 @@ Calendar::updateHeader
|
||||
separator->setVisible(false);
|
||||
dateNavigatorAction->setVisible(false);
|
||||
seasonLabelAction->setVisible(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2893,7 +2859,6 @@ Calendar::setView
|
||||
int oldIdx = viewStack->currentIndex();
|
||||
if (idx != oldIdx) {
|
||||
QDate useDate = selectedDate();
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
if (lastNonAgendaDate.isValid()) {
|
||||
useDate = lastNonAgendaDate;
|
||||
}
|
||||
@@ -2915,18 +2880,6 @@ Calendar::setView
|
||||
agendaView->updateDate();
|
||||
agendaView->setDateRange(dateRange);
|
||||
}
|
||||
#else
|
||||
if (view == CalendarView::Day) {
|
||||
dayAction->setChecked(true);
|
||||
dayView->setDay(useDate);
|
||||
} else if (view == CalendarView::Week) {
|
||||
weekAction->setChecked(true);
|
||||
weekView->setDay(useDate);
|
||||
} else if (view == CalendarView::Month) {
|
||||
monthAction->setChecked(true);
|
||||
monthView->setMonth(fitToMonth(selectedDate(), false), true);
|
||||
}
|
||||
#endif
|
||||
viewStack->setCurrentIndex(idx);
|
||||
emit viewChanged(view, static_cast<CalendarView>(oldIdx));
|
||||
updateHeader();
|
||||
|
||||
@@ -218,9 +218,7 @@ enum class CalendarView {
|
||||
Day = 0,
|
||||
Week = 1,
|
||||
Month = 2,
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
Agenda = 3
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -293,7 +291,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
struct CalendarAgendaStyles {
|
||||
QFont defaultFont;
|
||||
QFont relativeFont;
|
||||
@@ -351,7 +348,6 @@ private:
|
||||
private slots:
|
||||
void showContextMenu(const QPoint &pos);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class Calendar : public QWidget {
|
||||
@@ -380,10 +376,8 @@ public slots:
|
||||
void setFirstDayOfWeek(Qt::DayOfWeek firstDayOfWeek);
|
||||
void setStartHour(int hour);
|
||||
void setEndHour(int hour);
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
void setAgendaPastDays(int days);
|
||||
void setAgendaFutureDays(int days);
|
||||
#endif
|
||||
void setSummaryDayVisible(bool visible);
|
||||
void setSummaryWeekVisible(bool visible);
|
||||
void setSummaryMonthVisible(bool visible);
|
||||
@@ -429,14 +423,10 @@ private:
|
||||
CalendarDayView *dayView;
|
||||
CalendarWeekView *weekView;
|
||||
CalendarMonthTable *monthView;
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
CalendarAgendaView *agendaView;
|
||||
#endif
|
||||
DateRange dateRange;
|
||||
Qt::DayOfWeek firstDayOfWeek = Qt::Monday;
|
||||
#if defined(GC_CALENDAR_AGENDA)
|
||||
QDate lastNonAgendaDate;
|
||||
#endif
|
||||
|
||||
void setNavButtonState();
|
||||
void updateHeader();
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
# (calendar and main menu)
|
||||
#DEFINES += GC_ACTIVITY_PLAN
|
||||
|
||||
# Uncomment below if you want to enable the calendar agenda
|
||||
#DEFINES += GC_CALENDAR_AGENDA
|
||||
|
||||
# If you have conflicts with min/max macros defined in windows.h
|
||||
# then uncomment the following line.
|
||||
#DEFINES += NOMINMAX
|
||||
|
||||
Reference in New Issue
Block a user