Changeset 58eb7cc


Ignore:
Timestamp:
05/05/10 15:56:57 (12 years ago)
Author:
kirilma <kirilma@…>
Branches:
master, qt5
Children:
0d995ed
Parents:
cec47c6
Message:

store room map in database

show it if it's available, otherwise show a warning
set proper values in default database
new rooms imported as without maps

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/fosdem.sql

    rcec47c6 r58eb7cc  
    5151    , name VARCHAR UNIQUE NOT NULL
    5252    , picture VARCHAR NOT NULL);
    53 INSERT INTO "ROOM" VALUES(1,'Janson','NOT DEFINED YET');
    54 INSERT INTO "ROOM" VALUES(2,'Chavanne','NOT DEFINED YET');
    55 INSERT INTO "ROOM" VALUES(3,'Ferrer','NOT DEFINED YET');
    56 INSERT INTO "ROOM" VALUES(4,'Lameere','NOT DEFINED YET');
    57 INSERT INTO "ROOM" VALUES(5,'H.1301','NOT DEFINED YET');
    58 INSERT INTO "ROOM" VALUES(6,'UA2.114','NOT DEFINED YET');
    59 INSERT INTO "ROOM" VALUES(7,'H.1302','NOT DEFINED YET');
    60 INSERT INTO "ROOM" VALUES(8,'H.1308','NOT DEFINED YET');
    61 INSERT INTO "ROOM" VALUES(9,'H.1309','NOT DEFINED YET');
    62 INSERT INTO "ROOM" VALUES(10,'H.2213','NOT DEFINED YET');
    63 INSERT INTO "ROOM" VALUES(11,'H.2214','NOT DEFINED YET');
    64 INSERT INTO "ROOM" VALUES(12,'AW1.105','NOT DEFINED YET');
    65 INSERT INTO "ROOM" VALUES(13,'AW1.120','NOT DEFINED YET');
    66 INSERT INTO "ROOM" VALUES(14,'AW1.121','NOT DEFINED YET');
    67 INSERT INTO "ROOM" VALUES(15,'AW1.124','NOT DEFINED YET');
    68 INSERT INTO "ROOM" VALUES(16,'AW1.126','NOT DEFINED YET');
    69 INSERT INTO "ROOM" VALUES(17,'Guillissen','NOT DEFINED YET');
    70 INSERT INTO "ROOM" VALUES(18,'AY','NOT DEFINED YET');
    71 INSERT INTO "ROOM" VALUES(19,'AW1.117','NOT DEFINED YET');
    72 INSERT INTO "ROOM" VALUES(20,'AW1.125','NOT DEFINED YET');
     53INSERT INTO "ROOM" VALUES(1,'Janson', ':/maps/rooms/janson.png');
     54INSERT INTO "ROOM" VALUES(2,'Chavanne', ':/maps/rooms/chavanne.png');
     55INSERT INTO "ROOM" VALUES(3,'Ferrer', ':/maps/rooms/ferrer.png');
     56INSERT INTO "ROOM" VALUES(4,'Lameere', ':/maps/rooms/lameere.png');
     57INSERT INTO "ROOM" VALUES(5,'H.1301', ':/maps/rooms/h1301.png');
     58INSERT INTO "ROOM" VALUES(6,'UA2.114', ':/maps/rooms/ua2114.png');
     59INSERT INTO "ROOM" VALUES(7,'H.1302', ':/maps/rooms/h1302.png');
     60INSERT INTO "ROOM" VALUES(8,'H.1308', ':/maps/rooms/h1308.png');
     61INSERT INTO "ROOM" VALUES(9,'H.1309', ':/maps/rooms/h1309.png');
     62INSERT INTO "ROOM" VALUES(10,'H.2213', ':/maps/rooms/h2213.png');
     63INSERT INTO "ROOM" VALUES(11,'H.2214', ':/maps/rooms/h2214.png');
     64INSERT INTO "ROOM" VALUES(12,'AW1.105', ':/maps/rooms/aw1105.png');
     65INSERT INTO "ROOM" VALUES(13,'AW1.120', ':/maps/rooms/aw1120.png');
     66INSERT INTO "ROOM" VALUES(14,'AW1.121', ':/maps/rooms/aw1121.png');
     67INSERT INTO "ROOM" VALUES(15,'AW1.124', ':/maps/rooms/aw1124.png');
     68INSERT INTO "ROOM" VALUES(16,'AW1.126', ':/maps/rooms/aw1126.png');
     69INSERT INTO "ROOM" VALUES(17,'Guillissen', ':/maps/rooms/guillissen.png');
     70INSERT INTO "ROOM" VALUES(18,'AY', ':/maps/rooms/ay.png');
     71INSERT INTO "ROOM" VALUES(19,'AW1.117', ':/maps/rooms/aw1117.png');
     72INSERT INTO "ROOM" VALUES(20,'AW1.125', ':/maps/rooms/aw1125.png');
    7373CREATE TABLE PERSON ( id INTEGER PRIMARY KEY  NOT NULL, name VARCHAR UNIQUE NOT NULL);
    7474INSERT INTO "PERSON" VALUES(19,'Tias Guns');
  • src/gui/tabcontainer.cpp

    rcec47c6 r58eb7cc  
    2828#include "eventdialog.h"
    2929#include "mapwindow.h"
     30#include "room.h"
     31#include "errormessage.h"
    3032
    3133#include "conflictsdialog.h"
     
    8486    Event *event = static_cast<Event*>(aIndex.internalPointer());
    8587
    86     // room names are stored in lower-case format
    87     // room names are stored without dots in the name, eg. "aw.1124.png" -> "aw1124.png"
    88     QString mapPath = QString(":/maps/rooms/%1.png").arg(event->room().toLower().remove("."));
    89     if(!QFile::exists(mapPath))
    90         mapPath = QString(":/maps/rooms/not-available.png");
    91 
    92     QString roomName;
    93     if(mapPath.contains("not-available", Qt::CaseInsensitive))
    94         roomName = QString("Map is not available: %1").arg(event->room());
    95     else
    96         roomName = event->room();
     88    Room room = Room::retrieve(event->roomId());
     89    QVariant mapPathV = room.map();
     90    QString mapPath;
     91    if (!mapPathV.isValid()) {
     92        error_message("No map for this room");
     93        return;
     94    } else {
     95        mapPath = mapPathV.toString();
     96        if (!QFile::exists(mapPath)) {
     97            error_message("Map for this room not found: " + mapPath);
     98            return;
     99        }
     100    }
    97101
    98102    QPixmap map(mapPath);
    99     MapWindow window(map,roomName,this);
     103    MapWindow window(map, room.name(),this);
    100104    window.exec();
    101105}
  • src/mvc/room.h

    rcec47c6 r58eb7cc  
    3535    QString name() const { return value("name").toString(); }
    3636    void setName(const QString & type) { setValue("name", type); }
     37    // TODO: make naming consistent - either "picture" or "map"
     38     QVariant map() const { return value("picture"); }
    3739    int insert();
    3840public:
  • src/sql/schedulexmlparser.cpp

    rcec47c6 r58eb7cc  
    103103                        room["event_id"] = eventElement.attribute("id");
    104104                        room["conference_id"] = QString::number(confId,10);
    105                         room["picture"] = "NOT DEFINED YET"; // TODO: implement some mapping to assign correct picture to specified room_name
     105                        room["picture"] = ""; // TODO: implement some mapping to assign correct picture to specified room_name
    106106                        SqlEngine::addRoomToDB(room);
    107107
Note: See TracChangeset for help on using the changeset viewer.