Changeset 69393c0
- Timestamp:
- 01/13/10 14:27:33 (13 years ago)
- Branches:
- master, qt5
- Children:
- 969a840
- Parents:
- c2d66b2
- Location:
- src
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
rc2d66b2 r69393c0 65 65 QByteArray data = file.readAll(); 66 66 mXmlParser->parseData(data,mSqlEngine); 67 static_cast<EventModel*>(treeView->model())-> reload();67 static_cast<EventModel*>(treeView->model())->loadEvents(); 68 68 treeView->reset(); 69 69 } -
src/model/eventmodel.cpp
rc2d66b2 r69393c0 1 1 #include "eventmodel.h" 2 #include <conference.h> 2 3 3 EventModel::EventModel() : 4 mEvents(Event::getByDate(QDate(2009, 2, 7), 1)) 4 EventModel::EventModel() 5 5 { 6 createTimeGroups(); 6 7 loadEvents(); 7 8 } 8 9 … … 118 119 } 119 120 120 void EventModel:: reload()121 void EventModel::loadEvents() 121 122 { 122 123 mEvents.clear(); 123 mEvents=Event::getByDate(QDate(2009, 2, 7), 1); 124 125 mConfId = 1; // current conference selected: we have only one DB so far 126 // check for existence of conference in the DB 127 if(Conference::getAll().count()) 128 { 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); 132 } 133 mEvents = Event::getByDate(QDate(mCurrentDate.year(), mCurrentDate.month(), mCurrentDate.day()), mConfId); 124 134 createTimeGroups(); 125 135 } -
src/model/eventmodel.h
rc2d66b2 r69393c0 15 15 int columnCount ( const QModelIndex & parent = QModelIndex() ) const; 16 16 int rowCount ( const QModelIndex & parent = QModelIndex() ) const; 17 void reload(); // reloads Events from the DB17 void loadEvents(); // 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; 42 44 }; 43 45 44 46 #endif // EVENTMODEL_H 47 -
src/model/model.pro
rc2d66b2 r69393c0 13 13 HEADERS += \ 14 14 event.h \ 15 conference.h \ 15 16 delegate.h \ 16 17 eventmodel.h \ … … 18 19 SOURCES += \ 19 20 event.cpp \ 21 conference.cpp \ 20 22 delegate.cpp \ 21 23 eventmodel.cpp \ -
src/sql/sqlengine.cpp
rc2d66b2 r69393c0 68 68 .arg(aConference["venue"]) \ 69 69 .arg(aConference["city"]) \ 70 .arg( aConference["start"]) \71 .arg( aConference["end"]) \70 .arg(QDateTime(QDate::fromString(aConference["start"],DATE_FORMAT)).toTime_t()) \ 71 .arg(QDateTime(QDate::fromString(aConference["end"],DATE_FORMAT)).toTime_t()) \ 72 72 .arg(aConference["days"]) \ 73 .arg( aConference["day_change"]) \74 .arg( aConference["timeslot_duration"]);73 .arg(-QTime::fromString(aConference["day_change"],TIME_FORMAT).secsTo(QTime(0,0))) \ 74 .arg(-QTime::fromString(aConference["timeslot_duration"],TIME_FORMAT).secsTo(QTime(0,0))); 75 75 76 76 QString query = QString("INSERT INTO CONFERENCE (id,title,subtitle,venue,city,start,end,days,day_change,timeslot_duration) VALUES (%1)").arg(values); … … 90 90 // The items of the Event are divided into the two tables EVENT and VIRTUAL_EVENT 91 91 // VIRTUAL_EVENT is for Full-Text-Serach Support 92 QTime duration = QTime::fromString(aEvent["duration"],TIME_FORMAT);93 92 QDateTime startDateTime = QDateTime(QDate::fromString(aEvent["date"],DATE_FORMAT),QTime::fromString(aEvent["start"],TIME_FORMAT)); 94 93 QString values = QString("'%1', '%2', '%3', '%4', '%5', '%6', '%7'") \ … … 96 95 .arg(aEvent["id"]) \ 97 96 .arg(QString::number(startDateTime.toTime_t())) \ 98 .arg( QString::number(duration.hour()*3600 + duration.minute()*60 + duration.second())) \97 .arg(-QTime::fromString(aEvent["duration"],TIME_FORMAT).secsTo(QTime(0,0))) \ 99 98 .arg("123456") \ 100 99 .arg(aEvent["type"]) \ … … 201 200 venue VARCHAR, \ 202 201 city VARCHAR NOT NULL , \ 203 start DATETIMENOT NULL , \204 end DATETIMENOT NULL , \202 start INTEGER NOT NULL , \ 203 end INTEGER NOT NULL , \ 205 204 days INTEGER, \ 206 day_change DATETIME, \207 timeslot_duration DATETIME)");205 day_change INTEGER, \ 206 timeslot_duration INTEGER)"); 208 207 209 208 query.exec("CREATE TABLE ACTIVITY ( \
Note: See TracChangeset
for help on using the changeset viewer.