Changeset e6ab8a2


Ignore:
Timestamp:
07/04/11 23:42:02 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
526128c
Parents:
8dd3dd2
Message:

Removed the ability to show "pictures" (maps) of rooms and maps of conferences.
The XML file does not contain picture/map/image information of conferences or rooms.
We left the room.picture definition in the database SQL because there is no "drop column"
in sqlite.

Location:
src
Files:
4 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • src/create_tables.sql

    r8dd3dd2 re6ab8a2  
    1111    , timeslot_duration INTEGER
    1212    , active INTEGER DEFAULT 0
    13     , url VARCHAR
    14     , map VARCHAR);
     13    , url VARCHAR);
    1514
    1615CREATE TABLE TRACK ( id INTEGER  PRIMARY KEY AUTOINCREMENT  NOT NULL
  • src/gui/conferenceeditor.cpp

    r8dd3dd2 re6ab8a2  
    2222#include "conferencemodel.h"
    2323#include "urlinputdialog.h"
    24 #include "mapwindow.h"
    2524#include "errormessage.h"
    2625
     
    5150    connect(changeUrl, SIGNAL(clicked()), SLOT(changeUrlClicked()));
    5251    connect(refreshBtn, SIGNAL(clicked()), SLOT(refreshClicked()));
    53     connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
    5452    connect(buttonBox, SIGNAL(rejected()), SLOT(close()));
    5553
     
    9795                + ", " +
    9896                conf.end().toString("dd-MM-yyyy"));
    99 
    100         QString map = conf.map();
    101         if (map.isEmpty()) {
    102             showMapButton->hide();
    103         } else {
    104             showMapButton->show();
    105         }
    106 
    10797        conferenceInfo->setCurrentIndex(0);
    10898        removeBtn->show();
     
    220210}
    221211
    222 void ConferenceEditor::conferenceMapClicked()
    223 {
    224     Conference conf = Conference::getById(selected_id);
    225     QString mapPath = conf.map();
    226     if(mapPath.isEmpty() or !QFile::exists(mapPath)) {
    227         error_message("Map is not available");
    228         return;
    229     }
    230 
    231     QString roomName;
    232 
    233     QPixmap map(mapPath);
    234     MapWindow window(map,roomName,this);
    235     window.exec();
    236 }
  • src/gui/conferenceeditor.h

    r8dd3dd2 re6ab8a2  
    6565    void changeUrlClicked();
    6666    void refreshClicked();
    67     void conferenceMapClicked();
    6867
    6968private:
  • src/gui/conferenceeditor.ui

    r8dd3dd2 re6ab8a2  
    217217            </item>
    218218            <item row="1" column="3">
    219              <widget class="QPushButton" name="showMapButton">
    220               <property name="text">
    221                <string>MAP</string>
    222               </property>
    223               <property name="icon">
    224                <iconset resource="../icons.qrc">
    225                 <normaloff>:/icons/applications-internet.png</normaloff>:/icons/applications-internet.png</iconset>
    226               </property>
    227               <property name="flat">
    228                <bool>true</bool>
    229               </property>
    230              </widget>
    231             </item>
    232             <item row="1" column="4">
    233219             <spacer name="horizontalSpacer_4">
    234220              <property name="orientation">
  • src/gui/gui.pro

    r8dd3dd2 re6ab8a2  
    4444    conflictsdialog.ui \
    4545    tabcontainer.ui \
    46     mapwindow.ui \
    4746    settingsdialog.ui \
    4847    conferenceeditor.ui \
     
    6261    eventdialog.h \
    6362    tabcontainer.h \
    64     mapwindow.h \
    6563    settingsdialog.h \
    6664    conferenceeditor.h \
     
    8078    eventdialog.cpp \
    8179    tabcontainer.cpp \
    82     mapwindow.cpp \
    8380    settingsdialog.cpp \
    8481    conferenceeditor.cpp \
  • src/gui/tabcontainer.cpp

    r8dd3dd2 re6ab8a2  
    2828
    2929#include "eventdialog.h"
    30 #include "mapwindow.h"
    3130#include "room.h"
    3231#include "errormessage.h"
     
    5049    connect(treeView, SIGNAL(eventHasChanged(int,bool)), SIGNAL(eventHasChanged(int,bool)));
    5150    connect(treeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
    52     connect(treeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
    5351    connect(treeView, SIGNAL(requestForConflicts(const QModelIndex &)), SLOT(displayConflicts(const QModelIndex &)));
    5452
     
    8179    dialog.exec();
    8280    disconnect(&dialog, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
    83 }
    84 
    85 void TabContainer::displayMap(const QModelIndex &aIndex)
    86 {
    87     Event *event = static_cast<Event*>(aIndex.internalPointer());
    88 
    89     QVariant mapPathV = event->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     }
    101 
    102     QPixmap map(mapPath);
    103     MapWindow window(map, event->room()->name(),this);
    104     window.exec();
    10581}
    10682
  • src/gui/tabcontainer.h

    r8dd3dd2 re6ab8a2  
    5151    virtual void updateTreeView(const QDate &aDate);
    5252    void itemClicked(const QModelIndex &aIndex);
    53     void displayMap(const QModelIndex &aIndex);
    5453    void displayConflicts(const QModelIndex &aIndex);
    5554};
  • src/icons.qrc

    r8dd3dd2 re6ab8a2  
    11<RCC>
    2     <qresource prefix="/">
    3         <file>icons/add.png</file>
    4         <file>icons/remove.png</file>
    5         <file>icons/reload.png</file>
    6         <file>icons/appointment-soon-off.png</file>
    7         <file>icons/appointment-soon.png</file>
    8         <file>icons/applications-internet.png</file>
    9         <file>icons/emblem-new-off.png</file>
    10         <file>icons/emblem-new.png</file>
    11         <file>icons/dialog-warning.png</file>
    12         <file>icons/search.png</file>
    13     </qresource>
     2  <qresource prefix="/">
     3    <file>icons/add.png</file>
     4    <file>icons/remove.png</file>
     5    <file>icons/reload.png</file>
     6    <file>icons/appointment-soon-off.png</file>
     7    <file>icons/appointment-soon.png</file>
     8    <file>icons/emblem-new-off.png</file>
     9    <file>icons/emblem-new.png</file>
     10    <file>icons/dialog-warning.png</file>
     11    <file>icons/search.png</file>
     12  </qresource>
    1413</RCC>
  • src/mvc/conference.cpp

    r8dd3dd2 re6ab8a2  
    3434    << QSqlField("active", QVariant::Bool)
    3535    << QSqlField("url", QVariant::String)
    36     << QSqlField("map", QVariant::String)
    3736    );
    3837
  • src/mvc/conference.h

    r8dd3dd2 re6ab8a2  
    5252    bool isActive() const { return value("active").toBool(); }
    5353    QString url() const { return stringFromNullable(value("url")); }
    54     QString map() const { return stringFromNullable(value("map")); }
    5554
    5655    #if 0
  • src/mvc/delegate.cpp

    r8dd3dd2 re6ab8a2  
    150150            mControls[AlarmControlOff]->paint(painter, option.rect);
    151151#endif
    152         if (event->room()->hasMap())
    153             mControls[MapControl]->paint(painter, option.rect);
    154152        if(event->hasTimeConflict())
    155153            mControls[WarningControl]->paint(painter, option.rect);
     
    376374    mControls.insert(AlarmControlOff,
    377375                    new Control(AlarmControlOff, QString(":icons/appointment-soon-off.png"), mControls[FavouriteControlOff]));
    378 
    379     // MAP ICON
    380     mControls.insert(MapControl,
    381                     new Control(MapControl, QString(":icons/applications-internet.png"), mControls[AlarmControlOn]));
    382 #else
    383     // MAP ICON
    384     mControls.insert(MapControl,
    385                     new Control(MapControl, QString(":icons/applications-internet.png"), mControls[FavouriteControlOn]));
    386376#endif
    387377
    388378    // WARNING ICON
    389379    mControls.insert(WarningControl,
    390                     new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[MapControl]));
     380                    new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[FavouriteControlOn]));
    391381}
    392382
  • src/mvc/delegate.h

    r8dd3dd2 re6ab8a2  
    3838            AlarmControlOn,
    3939            AlarmControlOff,
    40             MapControl,
    4140            WarningControl
    4241        };
  • src/mvc/room.cpp

    r8dd3dd2 re6ab8a2  
    2222
    2323QString const Room::sTableName = QString("room");
    24 int const Room::sTableColCount = 3;
     24int const Room::sTableColCount = 2;
    2525const QString Room::NAME = "name";
    2626
    2727QSqlRecord const Room::sColumns = Room::toRecord(QList<QSqlField>()
    2828    << QSqlField("id", QVariant::Int)
    29     << QSqlField(NAME, QVariant::String)
    30     << QSqlField("picture", QVariant::String));
     29    << QSqlField(NAME, QVariant::String));
    3130
    3231Room Room::retrieveByName(QString name)
  • src/mvc/room.h

    r8dd3dd2 re6ab8a2  
    3636    QString name() const { return value("name").toString(); }
    3737    void setName(const QString & type) { setValue("name", type); }
    38     // TODO: make naming consistent - either "picture" or "map"
    39     QVariant map() const { return value("picture"); }
    40     bool hasMap() const
    41     {
    42         // empty strings also treasted as NULL,
    43         // as storing NULLs requires rewrite of storing code and DB scheme
    44         return !isNull("picture") and !value("picture").toString().isEmpty();
    45     }
    4638    int insert();
    4739public:
  • src/mvc/treeview.cpp

    r8dd3dd2 re6ab8a2  
    126126            }
    127127            break;
    128         case Delegate::MapControl:
    129             {
    130                 // handle Alarm Control clicked
    131                 emit(requestForMap(aIndex));
    132                 handled = true;
    133             }
    134         break;
    135128        case Delegate::WarningControl:
    136129        {
  • src/mvc/treeview.h

    r8dd3dd2 re6ab8a2  
    3737    void handleItemClicked(const QModelIndex &index);
    3838signals:
    39     void requestForMap(const QModelIndex &aIndex);
    4039    void requestForConflicts(const QModelIndex &aIndex);
    4140    void eventHasChanged(int aEventId, bool aReloadModel = false); // emited when user changes some event details, eg. sets it Favourite
  • src/sql/schedulexmlparser.cpp

    r8dd3dd2 re6ab8a2  
    104104                        room["event_id"] = eventElement.attribute("id");
    105105                        room["conference_id"] = QString::number(confId,10);
    106                         room["picture"] = ""; // TODO: implement some mapping to assign correct picture to specified room_name
    107106                        SqlEngine::addRoomToDB(room);
    108107
  • src/sql/sqlengine.cpp

    r8dd3dd2 re6ab8a2  
    6767        database.open();
    6868    }
    69 
    70     checkConferenceMap(database);
    7169
    7270    //LOG_INFO(QString("Opening '%1' database '%2'").arg(aDatabaseType).arg(aDatabaseName));
     
    257255        {
    258256            query = QSqlQuery(db);
    259             query.prepare("INSERT INTO ROOM (xid_conference,name,picture) VALUES (:xid_conference, :name, :picture)");
     257            query.prepare("INSERT INTO ROOM (xid_conference,name,picture) VALUES (:xid_conference, :name, '')");
    260258            query.bindValue(":xid_conference", aRoom["conference_id"]);
    261259            query.bindValue(":xid_name", aRoom["name"]);
    262             query.bindValue(":xid_picture", aRoom["picture"]);
    263260            if (!query.exec()) qDebug() << "Could not execute 'insert into room ...' query." << query.lastError();
    264261            aRoom["id"]= query.lastInsertId().toString(); // 'id' is assigned automatically
     
    402399    return true;
    403400}
    404 
    405 void SqlEngine::checkConferenceMap(QSqlDatabase &aDatabase)
    406 {
    407     QSqlQuery sqlQuery(aDatabase);
    408     sqlQuery.prepare("SELECT map FROM conference");
    409     if (!sqlQuery.exec()) {
    410         qWarning() << "column conference.map is missing; adding";
    411         execQuery(aDatabase, "ALTER TABLE conference ADD COLUMN map VARCHAR");
    412     }
    413 }
  • src/sql/sqlengine.h

    r8dd3dd2 re6ab8a2  
    4949        static bool execQuery(QSqlDatabase &aDatabase, const QString &aQuery);
    5050        static bool execQueryWithParameter(QSqlDatabase &aDatabase, const QString &aQuery, const QHash<QString, QVariant>& params);
    51 
    52         static void checkConferenceMap(QSqlDatabase &aDatabase);
    5351};
    5452
Note: See TracChangeset for help on using the changeset viewer.