Ignore:
Timestamp:
01/13/10 21:51:06 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
6a624f7
Parents:
69393c0
Message:

implemented day navigator widget

  • to switch between conference days
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r69393c0 r969a840  
    1010#include <delegate.h>
    1111
     12#include <conference.h>
     13
    1214#include <QDialog>
    1315#include "ui_about.h"
     16#include "daynavigatorwidget.h"
    1417
    1518MainWindow::MainWindow(QWidget *parent)
     
    3235    statusBar()->showMessage(tr("Ready"));
    3336
     37    connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &)));
     38
    3439    treeView->setHeaderHidden(true);
    3540    treeView->setRootIsDecorated(false);
     
    3843    treeView->setModel(new EventModel());
    3944    treeView->setItemDelegate(new Delegate(treeView));
     45
     46    if(!Conference::getAll().count()) // no conference(s) in the DB
     47        dayNavigator->hide(); // hide DayNavigatorWidget
     48    else
     49    {
     50        int confId = 1;
     51        dayNavigator->setDates(Conference::getById(confId).start(),Conference::getById(confId).end());
     52    }
    4053}
    4154
     
    6578    QByteArray data = file.readAll();
    6679    mXmlParser->parseData(data,mSqlEngine);
    67     static_cast<EventModel*>(treeView->model())->loadEvents();
    68     treeView->reset();
     80
     81    if(Conference::getAll().count())
     82    {
     83        int confId = 1;
     84        // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates
     85        dayNavigator->setDates(Conference::getById(confId).start(),Conference::getById(confId).end());
     86    }
    6987}
    7088
     
    83101}
    84102
     103void MainWindow::updateDayView(const QDate &aDate)
     104{
     105    int confId = 1;
     106    static_cast<EventModel*>(treeView->model())->loadEvents(aDate,confId);
     107    treeView->reset();
     108    dayNavigator->show();
     109}
     110
Note: See TracChangeset for help on using the changeset viewer.