Beispiel #1
0
void TimeTrackingWindow::slotSelectTasksToShow()
{
    // we would like to always show some tasks, if there are any
    // first, we select tasks that most recently where active
    const NamedTimeSpan thisWeek = TimeSpans().thisWeek();
    // and update the widget:
    m_summaries = WeeklySummary::summariesForTimespan( DATAMODEL, thisWeek.timespan );
    m_summaryWidget->setSummaries( m_summaries );
}
Beispiel #2
0
void EventView::timeSpansChanged()
{
    m_timeSpans = TimeSpans(QDate::currentDate()).standardTimeSpans();
    // close enough to "ever" for our purposes:
    NamedTimeSpan allEvents = {
        tr("Ever"),
        TimeSpan(QDate::currentDate().addYears(-200),
                 QDate::currentDate().addYears(+200)),
        Range
    };
    m_timeSpans << allEvents;

    const int currentIndex = m_comboBox->currentIndex();
    m_comboBox->clear();
    for (int i = 0; i < m_timeSpans.size(); ++i)
        m_comboBox->addItem(m_timeSpans[i].name);
    if (currentIndex >= 0 && currentIndex <= m_timeSpans.size()) {
        m_comboBox->setCurrentIndex(currentIndex);
    } else {
        m_comboBox->setCurrentIndex(0);
    }
}