Changeset 969a840
- Timestamp:
- 01/13/10 21:51:06 (13 years ago)
- Branches:
- master, qt5
- Children:
- 6a624f7
- Parents:
- 69393c0
- Location:
- src
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/gui.pro
r69393c0 r969a840 16 16 # (which means they need to be added to the test module as well, 17 17 # but I am sure you can live with that for the time being). 18 18 19 FORMS += mainwindow.ui \ 20 daynavigatorwidget.ui \ 19 21 about.ui 20 SOURCES += mainwindow.cpp21 HEADERS += mainwindow.h22 22 23 HEADERS += mainwindow.h \ 24 daynavigatorwidget.h 25 26 SOURCES += mainwindow.cpp \ 27 daynavigatorwidget.cpp 28 -
src/gui/mainwindow.cpp
r69393c0 r969a840 10 10 #include <delegate.h> 11 11 12 #include <conference.h> 13 12 14 #include <QDialog> 13 15 #include "ui_about.h" 16 #include "daynavigatorwidget.h" 14 17 15 18 MainWindow::MainWindow(QWidget *parent) … … 32 35 statusBar()->showMessage(tr("Ready")); 33 36 37 connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &))); 38 34 39 treeView->setHeaderHidden(true); 35 40 treeView->setRootIsDecorated(false); … … 38 43 treeView->setModel(new EventModel()); 39 44 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 } 40 53 } 41 54 … … 65 78 QByteArray data = file.readAll(); 66 79 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 } 69 87 } 70 88 … … 83 101 } 84 102 103 void 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 -
src/gui/mainwindow.h
r69393c0 r969a840 19 19 void showParsingProgress(int aStatus); 20 20 void aboutApp(); 21 void updateDayView(const QDate &aDate); 21 22 private: 22 23 SqlEngine *mSqlEngine; -
src/gui/mainwindow.ui
r69393c0 r969a840 28 28 <layout class="QVBoxLayout" name="verticalLayout" > 29 29 <item> 30 <layout class="QHBoxLayout" name="horizontalLayout_2" > 31 <item> 32 <widget class="QToolButton" name="buttonPrevDay" > 33 <property name="text" > 34 <string><|</string> 35 </property> 36 <property name="autoRaise" > 37 <bool>true</bool> 38 </property> 39 <property name="arrowType" > 40 <enum>Qt::LeftArrow</enum> 41 </property> 42 </widget> 43 </item> 44 <item> 45 <spacer name="horizontalSpacer" > 46 <property name="orientation" > 47 <enum>Qt::Horizontal</enum> 48 </property> 49 <property name="sizeHint" stdset="0" > 50 <size> 51 <width>40</width> 52 <height>20</height> 53 </size> 54 </property> 55 </spacer> 56 </item> 57 <item> 58 <widget class="QLabel" name="label" > 59 <property name="text" > 60 <string>Selected Date Goes Here</string> 61 </property> 62 </widget> 63 </item> 64 <item> 65 <spacer name="horizontalSpacer_2" > 66 <property name="orientation" > 67 <enum>Qt::Horizontal</enum> 68 </property> 69 <property name="sizeHint" stdset="0" > 70 <size> 71 <width>40</width> 72 <height>20</height> 73 </size> 74 </property> 75 </spacer> 76 </item> 77 <item> 78 <widget class="QToolButton" name="buttonNextDay" > 79 <property name="text" > 80 <string>|></string> 81 </property> 82 <property name="autoRaise" > 83 <bool>true</bool> 84 </property> 85 <property name="arrowType" > 86 <enum>Qt::RightArrow</enum> 87 </property> 88 </widget> 89 </item> 90 </layout> 30 <widget class="DayNavigatorWidget" native="1" name="dayNavigator" /> 91 31 </item> 92 32 <item> … … 161 101 <header>../model/treeview.h</header> 162 102 </customwidget> 103 <customwidget> 104 <class>DayNavigatorWidget</class> 105 <extends>QWidget</extends> 106 <header>daynavigatorwidget.h</header> 107 <container>1</container> 108 </customwidget> 163 109 </customwidgets> 164 110 <resources/> -
src/model/conference.h
r69393c0 r969a840 24 24 QString venue() const { return value("venue").toString(); } 25 25 QString city() const { return value("city").toString(); } 26 QDate start() const { return value("start").toDate(); } 27 QDate end() const { return value("end").toDate(); } 26 // TODO: there is some problem with converting "Time_t" to QDateTime: had to manually add 1 day 27 // NEEDS TO BE FIXED 28 QDate start() const { return value("start").toDateTime().addDays(1).date(); } 29 QDate end() const { return value("end").toDateTime().addDays(1).date(); } 30 // 28 31 int days() const { return value("days").toInt(); } 29 32 int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00 -
src/model/eventmodel.cpp
r69393c0 r969a840 4 4 EventModel::EventModel() 5 5 { 6 7 loadEvents(); 6 mEvents.clear(); 8 7 } 9 8 … … 119 118 } 120 119 121 void EventModel::loadEvents( )120 void EventModel::loadEvents(const QDate &aDate, int aConferenceId) 122 121 { 123 122 mEvents.clear(); 124 123 125 mConfId = 1; // current conference selected: we have only one DB so far 126 // check for existence of conference in the DB 124 // check for existence of the conference in the DB 127 125 if(Conference::getAll().count()) 128 126 { 129 mCurrentDate = Conference::getById(mConfId).start(); 130 qDebug() << "Loading Conference Data: [" << Conference::getById(mConfId).title() << "] " << mCurrentDate; 131 mEvents = Event::getByDate(QDate(mCurrentDate.year(), mCurrentDate.month(), mCurrentDate.day()), mConfId); 127 qDebug() << "Loading Conference Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate; 128 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId); 132 129 } 133 mEvents = Event::getByDate(QDate(mCurrentDate.year(), mCurrentDate.month(), mCurrentDate.day()), mConfId);134 130 createTimeGroups(); 135 131 } -
src/model/eventmodel.h
r69393c0 r969a840 15 15 int columnCount ( const QModelIndex & parent = QModelIndex() ) const; 16 16 int rowCount ( const QModelIndex & parent = QModelIndex() ) const; 17 void loadEvents( ); // loads Events from the DB17 void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB 18 18 19 19 private: … … 40 40 QList<Group> mGroups; 41 41 QHash<int, int> mParents; 42 QDate mCurrentDate;43 int mConfId;44 42 }; 45 43
Note: See TracChangeset
for help on using the changeset viewer.