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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.