Esempio n. 1
0
int DaysModel::calculateHoursPerWeek(const QDate& date) const
{
    int res = 0;
    QSqlRelationalTableModel& model = (QSqlRelationalTableModel&)_base;
    QString currFilter = model.filter();
    QString newFilter = "week = '" + QString::number(date.weekNumber(), 10) + "'";
    model.setFilter(newFilter);
    model.select();
    int count = model.rowCount();
    for(int i=0; i<count; i++)
    {
        QSqlRecord record =  model.record(i);
        if(record.value("end").toUInt() > 0)
        {
            uint diff = record.value("end").toUInt() - record.value("start").toUInt();
            res+=diff;
        }
    }

    int resUncompleted = calculateHoursFromUncompletedRecord();
    res += resUncompleted;

    model.setFilter(currFilter);
    return res;
}
Esempio n. 2
0
QList<QPair<QString, QString> > Kitchen::getByWeekdayQuery(QString lang, QDate date)
{
    // format:
    // GetMenuByWeekday?KitchenId=6&MenuTypeId=60&Week=50&Weekday=3&lang='fi'&format=json
    QList<QPair<QString, QString> > query;

    QString language = "Finnish";
    if(QString::compare(lang, language) == 0) {
        language = "'fi'";
    } else {
        language = "'en'";
    }

    // Add query components to a list
    query.append(qMakePair(QString("KitchenId"), QString::number(kitchenId_, 10)));
    query.append(qMakePair(QString("MenuTypeId"), QString::number(menuTypeId_, 10)));
    query.append(qMakePair(QString("Week"), QString::number(date.weekNumber(), 10)));
    query.append(qMakePair(QString("Weekday"), QString::number(date.dayOfWeek(), 10)));
    // Debug for specific day and week
    // query.append(qMakePair(QString("Week"), QString("7")));
    // query.append(qMakePair(QString("Weekday"), QString("7")));
    query.append(qMakePair(QString("lang"), language));
    query.append(qMakePair(QString("format"), QString("json")));

    return query;
}
void EventEditorDelegate::paint( QPainter* painter,
                                 const QStyleOptionViewItem& option,
                                 const QModelIndex& index ) const
{
    const Event& event = m_model->eventForIndex( index );
    Q_ASSERT( event.isValid() );
    const TaskTreeItem& item = DATAMODEL->taskTreeItem( event.taskId() );

    if ( event.isValid() ) {
        bool locked = DATAMODEL->isEventActive( event.id() );
        QString dateAndDuration;
        QTextStream dateStream( &dateAndDuration );
        QDate date = event.startDateTime().date();
        QTime time = event.startDateTime().time();
        QTime endTime = event.endDateTime().time();
        dateStream << date.toString( Qt::SystemLocaleDate )
               << " " << time.toString( "h:mm" )
               << " - " << endTime.toString( "h:mm" )
               << " (" << hoursAndMinutes( event.duration() ) << ") Week "
               << date.weekNumber();

        QString taskName;
        QTextStream taskStream( &taskName );
        // print leading zeroes for the TaskId
        const int taskIdLength = CONFIGURATION.taskPaddingLength;
        taskStream << QString( "%1" ).arg( item.task().id(), taskIdLength, 10, QChar( '0' ) )
                   << " " << DATAMODEL->smartTaskName( item.task() );

        paint( painter, option,
               taskName,
               dateAndDuration,
               logDuration( event.duration() ),
               locked ? EventState_Locked : EventState_Default );
    }
}
Esempio n. 4
0
void DateEntrySyncer::dateSelectionChanged()
{
    if ( sender() == m_week || sender() == m_year ) {
        //spinboxes changed, update date edit
        fixWeek( m_year, m_week );
        const int week = m_week->value();
        const int year = m_year->value();
        if ( m_date ) {
            m_date->blockSignals( true );
            m_date->setDate( Charm::dateByWeekNumberAndWeekDay( year, week, m_weekDay ) );
            m_date->blockSignals( false );
        }
    } else {
        Q_ASSERT( m_date );
        //date edit changed, update spinboxes
        const QDate date = m_date->date();
        int year = 0;
        const int week = date.weekNumber( &year );
        m_year->blockSignals( true );
        m_week->blockSignals( true );
        m_year->setValue( year );
        m_week->setValue( week );
        m_week->blockSignals( false );
        m_year->blockSignals( false );
    }
}
/*!
    Returns the week number for the first day of the week corresponding to \a row,
    or -1 if \a row is outside of our range.
*/
int QQuickCalendarModel::weekNumberAt(int row) const
{
    const int index = row * daysInAWeek;
    const QDate date = dateAt(index);
    if (date.isValid())
        return date.weekNumber();
    return -1;
}
Esempio n. 6
0
void WeeklyTimeSheetReport::setReportProperties(
    const QDate& start, const QDate& end,
    TaskId rootTask, bool activeTasksOnly )
{
    m_start = start;
    m_end = end;
    m_rootTask = rootTask;
    m_activeTasksOnly = activeTasksOnly;
    m_weekNumber = start.weekNumber( &m_yearOfWeek );

    slotUpdate();
}
Esempio n. 7
0
void
DiaryWindow::rideSelected()
{
    if (active) {
        return;
    }

    RideItem *ride = myRideItem;

    // ignore if not active or null ride
    if (!ride) {
        return;
    }

    // set the date range to put the current ride in view...
    QDate when = ride->dateTime.date();
    int month = when.month();
    int year = when.year();
    int weekNumber = when.weekNumber();

    // monthly view updates
    calendarModel->setMonth(when.month(), when.year());

    when = when.addDays(Qt::Monday - when.dayOfWeek());
    weeklyView->setDateRange(when, when.addDays(6));
    weeklyView->setViewMode(QxtScheduleView::DayView);

#if 0
    // ok update title
    switch (viewMode->currentIndex()) {
    case 0 : // monthly
#endif
        title->setText(QString("%1 %2").arg(QDate::longMonthName(month)).arg(year));
        next->show();
        prev->show();
#if 0
        break;
    case 1 : // weekly
        title->setText(QString("Week %1 %2").arg(weekNumber).arg(year));
        next->show();
        prev->show();
        break;

    default:
    case 2 : //ride
        title->setText("");
        next->hide();
        prev->hide();
        break;
    }
#endif
}
Esempio n. 8
0
int getTypeofWeek()
{
    QDate today;
    today = today.currentDate();
    int currentYear = today.year();
    int *p= &currentYear;
    int week = today.weekNumber();



    return ;

}
Esempio n. 9
0
bool GenericCashFlowPrivate::SamePeriod(const QDate& a, const QDate& b, GenericCashFlow::CashFlowAggregation Freq)
{
	int YearA=0, YearB=0;
	bool Result;
	switch (Freq) {
    case GenericCashFlow::TotalAggragate:
		return true;
    case GenericCashFlow::Annually:
		return a.year() == b.year();
    case GenericCashFlow::SemiAnnually:
		return a.year() == b.year() && (a.month() - 1) / 6 == (b.month() - 1) / 6;
    case GenericCashFlow::Quarterly:
		return a.year() == b.year() && (a.month() - 1) / 3 == (b.month() - 1) / 3;
    case GenericCashFlow::Monthly:
		return a.year() == b.year() && a.month() == b.month();
    case GenericCashFlow::Weekly:
		Result = a.weekNumber(&YearA) == b.weekNumber(&YearB);
		return Result && YearA == YearB;
    case GenericCashFlow::NoAggregation:
	default:
		return a==b;
	}
}
Esempio n. 10
0
/*!
  Find the week number of a date

  - QwtDate::FirstThursday\n
    Corresponding to ISO 8601 ( see QDate::weekNumber() ). 

  - QwtDate::FirstDay\n
    Number of weeks that have begun since dateOfWeek0().

  \param date Date
  \param type Option how to identify the first week

  \return Week number, starting with 1
 */
int QwtDate::weekNumber( const QDate &date, Week0Type type )
{
    int weekNo;

    if ( type == QwtDate::FirstDay )
    {
        const QDate day0 = dateOfWeek0( date.year(), type );
        weekNo = day0.daysTo( date ) / 7 + 1;
    }
    else
    {
        weekNo = date.weekNumber();
    }

    return weekNo;
}
Esempio n. 11
0
void DDatePicker::Private::fillWeeksCombo()
{
    // every year can have a different number of weeks
    // it could be that we had 53,1..52 and now 1..53 which is the same number but different
    // so always fill with new values
    // We show all week numbers for all weeks between first day of year to last day of year
    // This of course can be a list like 53,1,2..52

    const QDate thisDate      = q->date();
    const int thisYear        = thisDate.year();
    QDate day(thisDate.year(), 1, 1);
    const QDate lastDayOfYear = QDate(thisDate.year() + 1, 1, 1).addDays(-1);

    selectWeek->clear();

    // Starting from the first day in the year, loop through the year a week at a time
    // adding an entry to the week combo for each week in the year

    for (; day.isValid() && day <= lastDayOfYear; day = day.addDays(7))
    {
        // Get the ISO week number for the current day and what year that week is in
        // e.g. 1st day of this year may fall in week 53 of previous year
        int weekYear       = thisYear;
        const int week     = day.weekNumber(&weekYear);
        QString weekString = i18n("Week %1", QString::number(week));

        // show that this is a week from a different year
        if (weekYear != thisYear)
        {
            weekString += QLatin1Char('*');
        }

        // when the week is selected, go to the same weekday as the one
        // that is currently selected in the date table
        QDate targetDate = day.addDays(thisDate.dayOfWeek() - day.dayOfWeek());
        selectWeek->addItem(weekString, targetDate);

        // make sure that the week of the lastDayOfYear is always inserted: in Chinese calendar
        // system, this is not always the case
        if (day < lastDayOfYear           &&
            day.daysTo(lastDayOfYear) < 7 &&
            lastDayOfYear.weekNumber() != day.weekNumber())
        {
            day = lastDayOfYear.addDays(-7);
        }
    }
}
Esempio n. 12
0
QString DateStringBuilder::getGroupedDate(const KDateTime &dateTime)
{
    if (!dateTime.isValid() || dateTime.isNull()) {
        return QString();
    }
    QDate currentDate = QDateTime::currentDateTime().date();
    if (currentDate.weekNumber() == dateTime.date().weekNumber()) { //this week
        return getDayName(dateTime);
    }
    if (currentDate.addDays(-7).weekNumber() == dateTime.date().weekNumber()) { //last week
        return i18n("Last Week");
    }
    if (currentDate.year() == dateTime.date().year()) { //this year
        return dateTime.toString("%B");
    }
    return dateTime.toString("%B %Y");
}
Esempio n. 13
0
QString DateStringBuilder::getShortDate(const KDateTime &dateTime)
{
    if (!dateTime.isValid() || dateTime.isNull()) {
        return QString();
    }
    QDate currentDate = QDateTime().currentDateTime().date();
    if (currentDate.weekNumber() == dateTime.date().weekNumber() || currentDate.addDays(1) == dateTime.date()) { //this week or tomorrow (i.e. on sunday)
        return getDayName(dateTime);
    }
    if (currentDate.year() == dateTime.date().year()) { //this year
        //Micro optimization because this function showed up as hotspot
        static QCache<uint, QString> cache;
        uint hash = dateTime.date().month() ^ dateTime.date().day();
        if (!cache.contains(hash)) {
            cache.insert(hash, new QString(dateTime.toString("%d.%m")));
        }
        return *cache[hash];
    }
    return dateTime.toString("%d.%m.%Y");
}
Esempio n. 14
0
QVariant QQuickMonthModel::data(const QModelIndex &index, int role) const
{
    Q_D(const QQuickMonthModel);
    if (index.isValid() && index.row() < daysOnACalendarMonth) {
        const QDate date = d->dates.at(index.row());
        switch (role) {
        case DateRole:
            return date;
        case DayRole:
            return date.day();
        case TodayRole:
            return date == d->today;
        case WeekNumberRole:
            return date.weekNumber();
        case MonthRole:
            return date.month() - 1;
        case YearRole:
            return date.year();
        default:
            break;
        }
    }
    return QVariant();
}
Esempio n. 15
0
Element::List Datenums::createWeekElements(const QDate &date)
{
    Element::List result;

    const KCalendarSystem *calsys = KLocale::global()->calendar();
    int *yearOfTheWeek;
    yearOfTheWeek = Q_NULLPTR;
    int remainingWeeks;
    const int weekOfYear = date.weekNumber(yearOfTheWeek);

    QString weekOfYearShort;
    QString weekOfYearLong;
    QString weekOfYearExtensive;
    QString remainingWeeksShort;
    QString remainingWeeksLong;
    QString remainingWeeksExtensive;
    QString weekOfYearAndRemainingWeeksShort;

    // Usual case: the week belongs to this year
    remainingWeeks = calsys->weeksInYear(date.year()) - weekOfYear;

    weekOfYearShort = QString::number(weekOfYear);
    weekOfYearLong = i18nc("Week weekOfYear", "Week %1", weekOfYear);
    weekOfYearExtensive = i18np("1 week since the beginning of the year",
                                "%1 weeks since the beginning of the year",
                                weekOfYear);

    if (yearOfTheWeek) {    // The week does not belong to this year

        weekOfYearShort = i18nc("weekOfYear (year)",
                                "%1 (%2)", weekOfYear, *yearOfTheWeek);
        weekOfYearLong = i18nc("Week weekOfYear (year)",
                               "Week %1 (%2)", weekOfYear, *yearOfTheWeek);

        if (*yearOfTheWeek == date.year() + 1) {
            // The week belongs to next year
            remainingWeeks = 0;

            weekOfYearExtensive = i18np("1 week since the beginning of the year",
                                        "%1 weeks since the beginning of the year",
                                        weekOfYear);

        } else {
            // The week belongs to last year
            remainingWeeks = calsys->weeksInYear(date.year());

            weekOfYearExtensive = i18np("1 week since the beginning of the year",
                                        "%1 weeks since the beginning of the year",
                                        0);
        }
    }

    remainingWeeksShort = QString::number(remainingWeeks);
    remainingWeeksShort = i18np("1 week remaining",
                                "%1 weeks remaining",
                                remainingWeeks);
    remainingWeeksExtensive = i18np("1 week until the end of the year",
                                    "%1 weeks until the end of the year",
                                    remainingWeeks);
    weekOfYearAndRemainingWeeksShort = i18nc("weekOfYear / weeksTillEndOfYear",
                                       "%1 / %2", weekOfYear,
                                       remainingWeeks);

    StoredElement *e;
    switch (mDisplayedInfo) {
    case DayOfYear: // only week of year
        e = new StoredElement(QStringLiteral("main element"), weekOfYearShort, weekOfYearLong,
                              weekOfYearExtensive);
        break;
    case DaysRemaining: // only weeks until end of year
        e = new StoredElement(QStringLiteral("main element"), remainingWeeksShort,
                              remainingWeeksLong, remainingWeeksExtensive);
        break;
    case DayOfYear + DaysRemaining: // both week of year and weeks till end of year
    default:
        e = new StoredElement(QStringLiteral("main element"), weekOfYearShort,
                              weekOfYearAndRemainingWeeksShort,
                              i18nc("n weeks since the beginning of the year\n"
                                    "n weeks until the end of the year",
                                    "%1\n%2", weekOfYearExtensive,
                                    remainingWeeksExtensive));
        break;
    }
    result.append(e);

    return result;
}
Esempio n. 16
0
void Controller::sendDummyWeek(QDate startDate, QDate endDate)
{
//	Sleep( 500 );

	std::vector<Dish> dishesVect;
	dishesVect.push_back( Dish( "Ciorba de varza",
		"tortilla  piept de pui  cascaval  ardei gras  ceapa  patrunjel  ulei  boia  usturoi  oregano  sare",
		QPixmap(RESOURCES_ROOT"supa3.png"), 1 ) );
	dishesVect.push_back( Dish( "Aripioare de pui cu crusta de porumb",
		"tortilla  piept de pui  cascaval  ardei gras  ceapa  patrunjel  ulei  boia  usturoi  oregano  sare",
		QPixmap(RESOURCES_ROOT"mancare5.png"), 2 ) );
	dishesVect.push_back( Dish( "Pastrav pane cu spanac",
		"tortilla  piept de pui  cascaval  ardei gras  ceapa  patrunjel  ulei  boia  usturoi  oregano  sare",
		QPixmap(RESOURCES_ROOT"mancare1.png"), 2 ) );
	dishesVect.push_back( Dish( "Salata din gradina ursului",
		"tortilla  piept de pui  cascaval  ardei gras  ceapa  patrunjel  ulei  boia  usturoi  oregano  sare",
		QPixmap(RESOURCES_ROOT"salata1.png"), 3 ) );
	dishesVect.push_back( Dish( "Salata din gradina bunicii",
		"tortilla  piept de pui  cascaval  ardei gras  ceapa  patrunjel  ulei  boia  usturoi  oregano  sare",
		QPixmap(RESOURCES_ROOT"salata2.png"), 3 ) );
	dishesVect.push_back( Dish( "Supa de ceva fara ceva",
		"tortilla  piept de pui  cascaval  ardei gras  ceapa  patrunjel  ulei  boia  usturoi  oregano  sare",
		QPixmap(RESOURCES_ROOT"supa4.png"), 1 ) );

	dishesVect[0].setNumHappies( rand() % 250 );
	dishesVect[1].setNumMeahs( rand() % 250 );
	dishesVect[2].setNumWows( rand() % 250 );
	dishesVect[3].setNumWows( rand() % 250 );
	dishesVect[4].setNumWows( rand() % 250 );
	dishesVect[5].setNumWows( rand() % 250 );
// 
// 	dishesVect[0].setUserRating( Dish::eHappy );
// 	dishesVect[1].setUserRating( Dish::eMeah );
// 	dishesVect[5].setUserRating( Dish::eHappy );

// 	dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) );
// 	dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) );

	std::vector<Day> daysVect;

	srand(time(0));
	randomizeRatings(dishesVect);
	std::random_shuffle( dishesVect.begin(), dishesVect.end() );
// 	dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) );
// 	dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) );

	daysVect.push_back( Day( "Luni", dishesVect ) );

	randomizeRatings(dishesVect);
	std::random_shuffle( dishesVect.begin(), dishesVect.end() );
// 	dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) );
// 	dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) );

	daysVect.push_back( Day( "Marti", dishesVect ) );

	randomizeRatings(dishesVect);
	std::random_shuffle( dishesVect.begin(), dishesVect.end() );
// 	dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) );
// 	dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) );

	daysVect.push_back( Day( "Miercuri", dishesVect ) );

	randomizeRatings(dishesVect);
	std::random_shuffle( dishesVect.begin(), dishesVect.end() );
// 	dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) );
// 	dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) );

	daysVect.push_back( Day( "Joi", dishesVect ) );

	randomizeRatings(dishesVect);
	std::random_shuffle( dishesVect.begin(), dishesVect.end() );
// 	dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) );
// 	dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) );
// 	dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) );
// 	dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) );

	daysVect.push_back( Day( "Vineri", dishesVect ) );

	Week week( startDate, endDate, daysVect );

	// Show only 2 after and 2 before
	QDate today = QDate::currentDate();
	if( startDate.weekNumber() - today.weekNumber() > 1 )
		week.setLastAvailable( true );
	else if( startDate.weekNumber() - today.weekNumber() < -1 )
		week.setFirstAvailable( true );

	emit dataFinished( week );
}
Esempio n. 17
0
void tst_QDate::weekNumber_invalid()
{
    QDate dt;
    int yearNumber;
    QCOMPARE( dt.weekNumber( &yearNumber ), 0 );
}
Esempio n. 18
0
void MainWindow::setupViews()
{
  qDebug() << "Setting up views...";

  QDate today = QDate::currentDate();
  QDate monday; // Monday is the first day of the week (according to Qt)
  if (today.dayOfWeek() == Qt::Monday) {
    monday = today;
  }
  else {
    monday = today.addDays(1 - today.dayOfWeek());
  }

  AbstractActivityModel *todayTableModel = m_ui.tblToday->model();
  AbstractActivityModel *todayListModel = m_ui.lvTodayTotals->model();

  /* If the views have already been setup, check to see if any need to
   * be changed (because the date has changed) */
  if (todayTableModel != NULL) {
    if (todayTableModel->date() == today) {
      /* Nothing to do */
      qDebug() << "Nothing to do.";
      return;
    }
    else {
      QDate previousDate = todayTableModel->date();
      if (previousDate.weekNumber() != today.weekNumber()) {
        /* We've switched weeks, need to reset everything */
        qDebug() << "Switched weeks, resetting models";
      }
      else {
        /* Just need to change today's view */
        qDebug() << "Switching today's models";
        AbstractActivityModel *tableModel = NULL, *listModel = NULL;
        switch (today.dayOfWeek()) {
          case Qt::Monday:
            tableModel = m_ui.tblMonday->model();
            listModel = m_ui.lvMondayTotals->model();
            break;

          case Qt::Tuesday:
            tableModel = m_ui.tblTuesday->model();
            listModel = m_ui.lvTuesdayTotals->model();
            break;

          case Qt::Wednesday:
            tableModel = m_ui.tblWednesday->model();
            listModel = m_ui.lvWednesdayTotals->model();
            break;

          case Qt::Thursday:
            tableModel = m_ui.tblThursday->model();
            listModel = m_ui.lvThursdayTotals->model();
            break;

          case Qt::Friday:
            tableModel = m_ui.tblFriday->model();
            listModel = m_ui.lvFridayTotals->model();
            break;

          case Qt::Saturday:
            tableModel = m_ui.tblSaturday->model();
            listModel = m_ui.lvSaturdayTotals->model();
            break;

          case Qt::Sunday:
            tableModel = m_ui.tblSunday->model();
            listModel = m_ui.lvSundayTotals->model();
            break;
        }
        /* Set cleanup to false because we don't want to delete old models */
        setupDay(m_ui.tblToday, m_ui.lvTodayTotals, tableModel, listModel, false);
        return;
      }
    }
  }

  /* Today */
  setupDay(m_ui.tblToday, m_ui.lvTodayTotals, today);
  todayTableModel = m_ui.tblToday->model();
  todayListModel = m_ui.lvTodayTotals->model();

  /* Monday */
  if (today.dayOfWeek() == Qt::Monday) {
    setupDay(m_ui.tblMonday, m_ui.lvMondayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblMonday, m_ui.lvMondayTotals, monday);
  }

  /* Tuesday */
  if (today.dayOfWeek() == Qt::Tuesday) {
    setupDay(m_ui.tblTuesday, m_ui.lvTuesdayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblTuesday, m_ui.lvTuesdayTotals, monday.addDays(1));
  }

  /* Wednesday */
  if (today.dayOfWeek() == Qt::Wednesday) {
    setupDay(m_ui.tblWednesday, m_ui.lvWednesdayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblWednesday, m_ui.lvWednesdayTotals, monday.addDays(2));
  }

  /* Thursday */
  if (today.dayOfWeek() == Qt::Thursday) {
    setupDay(m_ui.tblThursday, m_ui.lvThursdayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblThursday, m_ui.lvThursdayTotals, monday.addDays(3));
  }

  /* Friday */
  if (today.dayOfWeek() == Qt::Friday) {
    setupDay(m_ui.tblFriday, m_ui.lvFridayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblFriday, m_ui.lvFridayTotals, monday.addDays(4));
  }

  /* Saturday */
  if (today.dayOfWeek() == Qt::Saturday) {
    setupDay(m_ui.tblSaturday, m_ui.lvSaturdayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblSaturday, m_ui.lvSaturdayTotals, monday.addDays(5));
  }

  /* Sunday */
  if (today.dayOfWeek() == Qt::Sunday) {
    setupDay(m_ui.tblSunday, m_ui.lvSundayTotals, todayTableModel, todayListModel);
  }
  else {
    setupDay(m_ui.tblSunday, m_ui.lvSundayTotals, monday.addDays(6));
  }
}