Changeset 41c4ceb for src/mvc/eventmodel.cpp
- Timestamp:
- 04/30/13 23:42:38 (10 years ago)
- Branches:
- master, qt5
- Children:
- 5130dc7
- Parents:
- 83481c6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/eventmodel.cpp
r83481c6 r41c4ceb 30 30 31 31 void EventModel::Group::setTitle(const QList<Event>& mEvents) { 32 Q Time startTime = mEvents.at(mFirstEventIndex).start().time();33 Q Time endTime(0, 0);32 QDateTime startTime = mEvents.at(mFirstEventIndex).start(); 33 QDateTime endTime(startTime); 34 34 for (int i = mFirstEventIndex; i != mFirstEventIndex + mChildCount; ++i) { 35 endTime = qMax(mEvents.at(i).start(). time().addSecs(mEvents.at(i).duration()), endTime);35 endTime = qMax(mEvents.at(i).start().addSecs(mEvents.at(i).duration()), endTime); 36 36 } 37 37 mTitle = QString("%1 - %2").arg(startTime.toString("HH:mm")).arg(endTime.toString("HH:mm")); … … 236 236 } 237 237 238 void EventModel::loadEvents(const QDate &aDate, int aConferenceId) 239 { 240 clearModel(); 241 // check for existence of the conference in the DB 242 if(Conference::getAll().count()) 243 { 244 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start, duration"); 245 } 238 239 void EventModel::loadEvents(const QDate &aDate, int aConferenceId) { 240 clearModel(); 241 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start, duration"); 246 242 createTimeGroups(); 247 243 } 248 244 249 void EventModel::loadFavEvents(const QDate &aDate, int aConferenceId) 250 { 251 clearModel(); 252 // check for existence of the conference in the DB 253 if(Conference::getAll().count()) 254 { 255 mEvents = Event::getFavByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId); 256 } 245 246 void EventModel::loadFavEvents(const QDate &aDate, int aConferenceId) { 247 clearModel(); 248 mEvents = Event::getFavByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId); 257 249 createTimeGroups(); 258 250 } 259 251 260 int EventModel::loadSearchResultEvents(const QDate &aDate, int aConferenceId) 261 { 262 clearModel(); 263 // check for existence of the conference in the DB 264 if(Conference::getAll().count()) 265 { 266 try{ 267 mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start, duration"); 268 } 269 catch( OrmException &e ){ 270 qDebug() << "Event::getSearchResultByDate failed: " << e.text(); 271 } 272 catch(...){ 273 qDebug() << "Event::getSearchResultByDate failed"; 274 } 275 252 253 int EventModel::loadSearchResultEvents(const QDate &aDate, int aConferenceId) { 254 clearModel(); 255 try { 256 mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start, duration"); 257 } 258 catch( OrmException &e ){ 259 qDebug() << "Event::getSearchResultByDate failed: " << e.text(); 260 } 261 catch(...){ 262 qDebug() << "Event::getSearchResultByDate failed"; 276 263 } 277 264 … … 281 268 } 282 269 283 void EventModel::loadEventsByTrack(const QDate &aDate, int aConferenceId) 284 { 285 clearModel(); 286 if (Conference::getAll().count()) 287 { 288 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "xid_track, start, duration"); 289 } 270 271 void EventModel::loadEventsByTrack(const QDate &aDate, int aConferenceId) { 272 clearModel(); 273 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "xid_track, start, duration"); 290 274 createTrackGroups(); 291 275 } 292 276 293 void EventModel::loadEventsByRoom(const QDate &aDate, int aConferenceId) 294 { 295 clearModel(); 296 if (Conference::getAll().count()) 297 { 298 mEvents = Event::getByDateAndRoom(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId); 299 } 277 278 void EventModel::loadEventsByRoom(const QDate &aDate, int aConferenceId) { 279 clearModel(); 280 mEvents = Event::getByDateAndRoom(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId); 300 281 createRoomGroups(); 301 282 } … … 304 285 void EventModel::loadConflictEvents(int aEventId, int aConferenceId) { 305 286 clearModel(); 306 // check for existence of the conference in the DB 307 if(Conference::getAll().count()) 308 { 309 mEvents = Event::conflictEvents(aEventId, aConferenceId); 310 } 287 mEvents = Event::conflictEvents(aEventId, aConferenceId); 311 288 createTimeGroups(); 312 289 } 290 313 291 314 292 void EventModel::updateModel(int aEventId)
Note: See TracChangeset
for help on using the changeset viewer.