Changeset 9afc0ee for src


Ignore:
Timestamp:
01/19/10 10:09:41 (13 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
c5324ca
Parents:
b1fc17a
Message:

set MapDialog? title

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    rb1fc17a r9afc0ee  
    200200{
    201201    Event *event = static_cast<Event*>(aIndex.internalPointer());
    202     QString mapPath = QString(":/maps/rooms/%1.png").arg(event->room());
     202
     203    // room names are stored in lower-case format
     204    // room names are stored without dots in the name, eg. "aw.1124.png" -> "aw1124.png"
     205    QString mapPath = QString(":/maps/rooms/%1.png").arg(event->room().toLower().remove("."));
    203206    if(!QFile::exists(mapPath))
    204207        mapPath = QString(":/maps/rooms/not-available.png");
     208
     209    QString roomName;
     210    if(mapPath.contains("not-available", Qt::CaseInsensitive))
     211        roomName = QString("Map is not available: %1").arg(event->room());
     212    else
     213        roomName = event->room();
     214
    205215    QPixmap map(mapPath);
    206     MapWindow window(map,this);
     216    MapWindow window(map,roomName,this);
    207217    window.exec();
    208218}
  • src/gui/mapwindow.cpp

    rb1fc17a r9afc0ee  
    11#include "mapwindow.h"
    22
    3 MapWindow::MapWindow(const QPixmap &aImage, QWidget *aParent)
     3MapWindow::MapWindow(const QPixmap &aImage, const QString &aName, QWidget *aParent)
    44    : QDialog(aParent)
    55{
    66    setupUi(this);
    77    setMouseTracking(true); // to receive mouse events
     8    setWindowTitle(aName);
    89    map->setPixmap(aImage);
    910}
  • src/gui/mapwindow.h

    rb1fc17a r9afc0ee  
    99{
    1010public:
    11     MapWindow(const QPixmap &aImage, QWidget *aParent = NULL);
     11    MapWindow(const QPixmap &aImage, const QString &aName, QWidget *aParent = NULL);
    1212    ~MapWindow() {}
    1313protected:
  • src/mvc/event.cpp

    rb1fc17a r9afc0ee  
    7979    //qDebug() << query.lastError();
    8080    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     }
     81        return query.record().value("name").toString();
    8782    else
    8883        return QString("not-available");
Note: See TracChangeset for help on using the changeset viewer.