Changeset f9db452
- Timestamp:
- 01/19/10 08:44:40 (13 years ago)
- Branches:
- master, qt5
- Children:
- b1fc17a
- Parents:
- 446bce4
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
r446bce4 rf9db452 199 199 void MainWindow::displayMap(const QModelIndex &aIndex) 200 200 { 201 QPixmap map(":/maps/rooms/janson.png"); 201 Event *event = static_cast<Event*>(aIndex.internalPointer()); 202 QString mapPath = QString(":/maps/rooms/%1.png").arg(event->room()); 203 QPixmap map(mapPath); 202 204 MapWindow window(map,this); 203 205 window.exec(); -
src/mvc/event.cpp
r446bce4 rf9db452 70 70 } 71 71 72 QString Event::room() const 73 { 74 QSqlQuery query; 75 query.prepare("SELECT name FROM room WHERE id = (SELECT xid_room FROM event_room WHERE xid_event = :id)"); 76 query.bindValue(":id", id()); 77 query.exec(); 78 // TODO: handle qeury error 79 //qDebug() << query.lastError(); 80 if(query.next()) 81 { 82 QString map = query.record().value("name").toString(); 83 map=map.toLower(); // room names are stored in lower-case format 84 map=map.remove("."); // room names are stored without dots in the name, eg. "aw.1124.png" -> "aw1124.png" 85 return map; 86 } 87 else 88 return QString("not-available"); 89 } 72 90 91 void Event::setRoom(const QString &room) 92 { 93 qWarning("WARINING: setRoom() is NOT IMPLEMENTED YET"); 94 // TODO: implement 95 } 96 -
src/mvc/event.h
r446bce4 rf9db452 47 47 QString abstract() const { return value("abstract").toString(); } 48 48 QString description() const { return value("description").toString(); } 49 // records from other tables associated with 'id' 50 QString room() const; 49 51 50 52 // Table 1 … … 64 66 void setAbstract(const QString& abstract) { setValue("abstract", abstract); } 65 67 void setDescription(const QString& description) { setValue("description", description); } 68 // records from other tables associated with 'id' 69 void setRoom(const QString& room); 66 70 67 71 friend class EventTest;
Note: See TracChangeset
for help on using the changeset viewer.