Removed the ability to show "pictures" (maps) of rooms and maps of conferences.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 4 Jul 2011 21:42:02 +0000 (21:42 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 4 Jul 2011 21:42:02 +0000 (21:42 +0000)
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.

23 files changed:
src/create_tables.sql
src/gui/conferenceeditor.cpp
src/gui/conferenceeditor.h
src/gui/conferenceeditor.ui
src/gui/gui.pro
src/gui/mapwindow.cpp [deleted file]
src/gui/mapwindow.h [deleted file]
src/gui/mapwindow.ui [deleted file]
src/gui/tabcontainer.cpp
src/gui/tabcontainer.h
src/icons.qrc
src/icons/applications-internet.png [deleted file]
src/mvc/conference.cpp
src/mvc/conference.h
src/mvc/delegate.cpp
src/mvc/delegate.h
src/mvc/room.cpp
src/mvc/room.h
src/mvc/treeview.cpp
src/mvc/treeview.h
src/sql/schedulexmlparser.cpp
src/sql/sqlengine.cpp
src/sql/sqlengine.h

index f804900897a5dc64bdf592cbd3be063fb46d72f5..a04b8d2af150c347976e67245dd1bb8511b54389 100644 (file)
@@ -10,8 +10,7 @@ CREATE TABLE CONFERENCE ( id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL
     , day_change INTEGER
     , timeslot_duration INTEGER
     , active INTEGER DEFAULT 0
-    , url VARCHAR
-    , map VARCHAR);
+    , url VARCHAR);
 
 CREATE TABLE TRACK ( id INTEGER  PRIMARY KEY AUTOINCREMENT  NOT NULL
     , xid_conference INTEGER NOT NULL
index d99628adf7e6136672ba40c5f6f9bd97a9d61e4a..ac7b08e40ccd8aec27ef4d242afde3c94c1fe55b 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "conferencemodel.h"
 #include "urlinputdialog.h"
-#include "mapwindow.h"
 #include "errormessage.h"
 
 #include <QInputDialog>
@@ -50,7 +49,6 @@ ConferenceEditor::ConferenceEditor(ConferenceModel* model, QWidget* parent)
     connect(removeBtn, SIGNAL(clicked()), SLOT(removeClicked()));
     connect(changeUrl, SIGNAL(clicked()), SLOT(changeUrlClicked()));
     connect(refreshBtn, SIGNAL(clicked()), SLOT(refreshClicked()));
-    connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
     connect(buttonBox, SIGNAL(rejected()), SLOT(close()));
 
     // it's OK to emit selection signals here
@@ -96,14 +94,6 @@ void ConferenceEditor::itemSelected(const QModelIndex& current, const QModelInde
                 conf.start().toString("dd-MM-yyyy")
                 + ", " +
                 conf.end().toString("dd-MM-yyyy"));
-
-        QString map = conf.map();
-        if (map.isEmpty()) {
-            showMapButton->hide();
-        } else {
-            showMapButton->show();
-        }
-
         conferenceInfo->setCurrentIndex(0);
         removeBtn->show();
     }
@@ -219,18 +209,3 @@ void ConferenceEditor::importFinished(const QString& title)
     itemSelected(QModelIndex(), QModelIndex());
 }
 
-void ConferenceEditor::conferenceMapClicked()
-{
-    Conference conf = Conference::getById(selected_id);
-    QString mapPath = conf.map();
-    if(mapPath.isEmpty() or !QFile::exists(mapPath)) {
-        error_message("Map is not available");
-        return;
-    }
-
-    QString roomName;
-
-    QPixmap map(mapPath);
-    MapWindow window(map,roomName,this);
-    window.exec();
-}
index adddd15a32c29f1c5e79dc1a69019eb10d3b69d3..daa8f3fa2c1b955454589e3e187e9ba771e458e0 100644 (file)
@@ -64,7 +64,6 @@ private slots:
     void removeClicked();
     void changeUrlClicked();
     void refreshClicked();
-    void conferenceMapClicked();
 
 private:
     ConferenceModel* model;
index d4c8fda1a328bb41c55c3c90900d0622572d99ec..94fd1886736250d93b824bd1b018f7f1e45b40d8 100644 (file)
              </widget>
             </item>
             <item row="1" column="3">
-             <widget class="QPushButton" name="showMapButton">
-              <property name="text">
-               <string>MAP</string>
-              </property>
-              <property name="icon">
-               <iconset resource="../icons.qrc">
-                <normaloff>:/icons/applications-internet.png</normaloff>:/icons/applications-internet.png</iconset>
-              </property>
-              <property name="flat">
-               <bool>true</bool>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="4">
              <spacer name="horizontalSpacer_4">
               <property name="orientation">
                <enum>Qt::Horizontal</enum>
index f41eb37a27fcccbbeb81521bea9ba9e9a40f7185..e9b1dd43d63c862eeeb49bc8a780f7bc0ac56124 100644 (file)
@@ -43,7 +43,6 @@ FORMS += searchhead.ui \
     eventdialog.ui \
     conflictsdialog.ui \
     tabcontainer.ui \
-    mapwindow.ui \
     settingsdialog.ui \
     conferenceeditor.ui \
     urlinputdialog.ui
@@ -61,7 +60,6 @@ HEADERS += roomstabcontainer.h \
     daynavigatorwidget.h \
     eventdialog.h \
     tabcontainer.h \
-    mapwindow.h \
     settingsdialog.h \
     conferenceeditor.h \
     urlinputdialog.h
@@ -79,7 +77,6 @@ SOURCES += roomstabcontainer.cpp \
     daynavigatorwidget.cpp \
     eventdialog.cpp \
     tabcontainer.cpp \
-    mapwindow.cpp \
     settingsdialog.cpp \
     conferenceeditor.cpp \
     urlinputdialog.cpp
diff --git a/src/gui/mapwindow.cpp b/src/gui/mapwindow.cpp
deleted file mode 100644 (file)
index 1072159..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
- *
- * This file is part of ConfClerk.
- *
- * ConfClerk is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 2 of the License, or (at your option)
- * any later version.
- *
- * ConfClerk is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
- */
-#include "mapwindow.h"
-
-MapWindow::MapWindow(const QPixmap &aImage, const QString &aName, QWidget *aParent)
-    : QDialog(aParent)
-{
-    setupUi(this);
-#ifdef MAEMO
-    showFullScreen();
-    //map->setScaledContents(true);
-    //map->setPixmap(aImage.scaled(QSize(800,480),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation));
-    map->setPixmap(aImage.scaled(QSize(640,480),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation));
-#elif N810
-    showMaximized();
-    map->setPixmap(aImage.scaled(QSize(400,300),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation));
-#else
-    map->setPixmap(aImage);
-#endif
-    setMouseTracking(true); // to receive mouse events
-    setWindowTitle(aName);
-}
-
-// it is enough to handle mouseReleaseEvent, instead of
-// getting/creating mouseClikEvent, since the whole window
-// is occupied by only-one widget/label (image/map)
-void MapWindow::mouseReleaseEvent(QMouseEvent *event)
-{
-    Q_UNUSED(event);
-    close();
-}
-
diff --git a/src/gui/mapwindow.h b/src/gui/mapwindow.h
deleted file mode 100644 (file)
index f99bc45..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
- *
- * This file is part of ConfClerk.
- *
- * ConfClerk is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 2 of the License, or (at your option)
- * any later version.
- *
- * ConfClerk is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef MAPWINDOW_H
-#define MAPWINDOW_H
-
-#include <QDialog>
-#include <QPixmap>
-#include "ui_mapwindow.h"
-
-class MapWindow : public QDialog, Ui::MapWindow
-{
-public:
-    MapWindow(const QPixmap &aImage, const QString &aName, QWidget *aParent = NULL);
-    ~MapWindow() {}
-protected:
-    virtual void mouseReleaseEvent(QMouseEvent *event);
-};
-
-#endif /* MAPWINDOW_H */
-
diff --git a/src/gui/mapwindow.ui b/src/gui/mapwindow.ui
deleted file mode 100644 (file)
index 997b956..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MapWindow</class>
- <widget class="QDialog" name="MapWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>298</width>
-    <height>179</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <item row="0" column="0">
-    <widget class="QLabel" name="map">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>Map goes here</string>
-     </property>
-     <property name="alignment">
-      <set>Qt::AlignCenter</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
index da4b7fb7133b486f0b62e1b4f15677c57e6622ed..357ea35c7a0a7f1fc75e85377b1a241e66581198 100644 (file)
@@ -27,7 +27,6 @@
 #include <delegate.h>
 
 #include "eventdialog.h"
-#include "mapwindow.h"
 #include "room.h"
 #include "errormessage.h"
 
@@ -49,7 +48,6 @@ TabContainer::TabContainer(QWidget *aParent)
 
     connect(treeView, SIGNAL(eventHasChanged(int,bool)), SIGNAL(eventHasChanged(int,bool)));
     connect(treeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
-    connect(treeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
     connect(treeView, SIGNAL(requestForConflicts(const QModelIndex &)), SLOT(displayConflicts(const QModelIndex &)));
 
     // day navigator is hidden by default
@@ -82,28 +80,6 @@ void TabContainer::itemClicked(const QModelIndex &aIndex)
     disconnect(&dialog, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
 }
 
-void TabContainer::displayMap(const QModelIndex &aIndex)
-{
-    Event *event = static_cast<Event*>(aIndex.internalPointer());
-
-    QVariant mapPathV = event->room()->map();
-    QString mapPath;
-    if (!mapPathV.isValid()) {
-        error_message("No map for this room");
-        return;
-    } else {
-        mapPath = mapPathV.toString();
-        if (!QFile::exists(mapPath)) {
-            error_message("Map for this room not found: " + mapPath);
-            return;
-        }
-    }
-
-    QPixmap map(mapPath);
-    MapWindow window(map, event->room()->name(),this);
-    window.exec();
-}
-
 void TabContainer::displayConflicts(const QModelIndex &aIndex)
 {
     ConflictsDialog dialog(static_cast<Event*>(aIndex.internalPointer())->id(),this);
index 6146268eebcf1b39971cad65ebd7848e9e194d0e..572b9957a273c0921a2aa7e80f3273f018f8e1d2 100644 (file)
@@ -50,7 +50,6 @@ public slots:
 protected slots:
     virtual void updateTreeView(const QDate &aDate);
     void itemClicked(const QModelIndex &aIndex);
-    void displayMap(const QModelIndex &aIndex);
     void displayConflicts(const QModelIndex &aIndex);
 };
 
index 644c48ec201f70e958684f8b2026799df8bb54c2..8f472eda7afcbeed7b2c380fe82900eca5aea53e 100644 (file)
@@ -1,14 +1,13 @@
 <RCC>
-    <qresource prefix="/">
-        <file>icons/add.png</file>
-        <file>icons/remove.png</file>
-        <file>icons/reload.png</file>
-        <file>icons/appointment-soon-off.png</file>
-        <file>icons/appointment-soon.png</file>
-        <file>icons/applications-internet.png</file>
-        <file>icons/emblem-new-off.png</file>
-        <file>icons/emblem-new.png</file>
-        <file>icons/dialog-warning.png</file>
-        <file>icons/search.png</file>
-    </qresource>
+  <qresource prefix="/">
+    <file>icons/add.png</file>
+    <file>icons/remove.png</file>
+    <file>icons/reload.png</file>
+    <file>icons/appointment-soon-off.png</file>
+    <file>icons/appointment-soon.png</file>
+    <file>icons/emblem-new-off.png</file>
+    <file>icons/emblem-new.png</file>
+    <file>icons/dialog-warning.png</file>
+    <file>icons/search.png</file>
+  </qresource>
 </RCC>
diff --git a/src/icons/applications-internet.png b/src/icons/applications-internet.png
deleted file mode 100644 (file)
index cc989b6..0000000
Binary files a/src/icons/applications-internet.png and /dev/null differ
index 667b0c5c94d954d8db9be0c6a93c382bf8ae6689..1fd60d653333f440b02437689695fe5344ab382d 100644 (file)
@@ -33,7 +33,6 @@ QSqlRecord const Conference::sColumns = Conference::toRecord(QList<QSqlField>()
     << QSqlField("timeslot_duration", QVariant::Int)
     << QSqlField("active", QVariant::Bool)
     << QSqlField("url", QVariant::String)
-    << QSqlField("map", QVariant::String)
     );
 
 QString const Conference::sTableName = QString("conference");
index 1d704390a3562e75b5dc325f271b1c32253ee31b..c9ae184e406f1d85d6e681d0ad7bf53fea2551e4 100644 (file)
@@ -51,7 +51,6 @@ public:
     int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds
     bool isActive() const { return value("active").toBool(); }
     QString url() const { return stringFromNullable(value("url")); }
-    QString map() const { return stringFromNullable(value("map")); }
 
     #if 0
     void setId(int id) { setValue("id", id); }
index d14daa2518c4824ddec43cc072d3bc0cc6b6dba0..9d4c8dfc346510cd438d204c8bb89b0a9238417f 100644 (file)
@@ -149,8 +149,6 @@ void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, cons
         else
             mControls[AlarmControlOff]->paint(painter, option.rect);
 #endif
-        if (event->room()->hasMap())
-            mControls[MapControl]->paint(painter, option.rect);
         if(event->hasTimeConflict())
             mControls[WarningControl]->paint(painter, option.rect);
 
@@ -375,19 +373,11 @@ void Delegate::defineControls()
     // off
     mControls.insert(AlarmControlOff,
                     new Control(AlarmControlOff, QString(":icons/appointment-soon-off.png"), mControls[FavouriteControlOff]));
-
-    // MAP ICON
-    mControls.insert(MapControl,
-                    new Control(MapControl, QString(":icons/applications-internet.png"), mControls[AlarmControlOn]));
-#else
-    // MAP ICON
-    mControls.insert(MapControl,
-                    new Control(MapControl, QString(":icons/applications-internet.png"), mControls[FavouriteControlOn]));
 #endif
 
     // WARNING ICON
     mControls.insert(WarningControl,
-                    new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[MapControl]));
+                    new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[FavouriteControlOn]));
 }
 
 bool Delegate::isPointFromRect(const QPoint &aPoint, const QRect &aRect) const
index 5f4428eea1c1109b35420103297ce91de83fe3be..f24bea36e91b8b9b454af9af9a84a5e178193552 100644 (file)
@@ -37,7 +37,6 @@ class Delegate : public QItemDelegate
             FavouriteControlOff,
             AlarmControlOn,
             AlarmControlOff,
-            MapControl,
             WarningControl
         };
 
index 41cd35e5d1d277402e67b1a2382d529a18ff2665..b0a455e3c1f366b3dffd75278bfd066501052b3f 100644 (file)
 #include "room.h"
 
 QString const Room::sTableName = QString("room");
-int const Room::sTableColCount = 3;
+int const Room::sTableColCount = 2;
 const QString Room::NAME = "name";
 
 QSqlRecord const Room::sColumns = Room::toRecord(QList<QSqlField>()
     << QSqlField("id", QVariant::Int)
-    << QSqlField(NAME, QVariant::String)
-    << QSqlField("picture", QVariant::String));
+    << QSqlField(NAME, QVariant::String));
 
 Room Room::retrieveByName(QString name)
 {
index 2710c24208cf5343e1522907e4a68e31b3682fbf..93c132f2a14e7d45d6d773733e65e9145487d97a 100644 (file)
@@ -35,14 +35,6 @@ public:
     void setId(int id) { setValue("id", id); }
     QString name() const { return value("name").toString(); }
     void setName(const QString & type) { setValue("name", type); }
-    // TODO: make naming consistent - either "picture" or "map"
-    QVariant map() const { return value("picture"); }
-    bool hasMap() const
-    {
-        // empty strings also treasted as NULL,
-        // as storing NULLs requires rewrite of storing code and DB scheme
-        return !isNull("picture") and !value("picture").toString().isEmpty();
-    }
     int insert();
 public:
     static QList<Room> getAll();
index 956e49f0f78966ac0ede952a6ca56ebac6e31ac1..151fd8a697915c9f0775d387e5700b47e7feddad 100644 (file)
@@ -125,13 +125,6 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP
                 handled = true;
             }
             break;
-        case Delegate::MapControl:
-            {
-                // handle Alarm Control clicked
-                emit(requestForMap(aIndex));
-                handled = true;
-            }
-        break;
         case Delegate::WarningControl:
         {
 
index 04138503e6464ef255b4e39e874446471d29283d..888b6f75b9d0d44db4fff138893907231135856d 100644 (file)
@@ -36,7 +36,6 @@ public slots:
 private slots:
     void handleItemClicked(const QModelIndex &index);
 signals:
-    void requestForMap(const QModelIndex &aIndex);
     void requestForConflicts(const QModelIndex &aIndex);
     void eventHasChanged(int aEventId, bool aReloadModel = false); // emited when user changes some event details, eg. sets it Favourite
 };
index dadfa6a7fe420206eeb5285d8f7f29494915e3ee..bfea3a464d2b2b8321fa0d1f971c5b20c32125d1 100644 (file)
@@ -103,7 +103,6 @@ void ScheduleXmlParser::parseData(const QByteArray &aData, const QString& url)
                         room["name"] = roomElement.attribute("name");
                         room["event_id"] = eventElement.attribute("id");
                         room["conference_id"] = QString::number(confId,10);
-                        room["picture"] = ""; // TODO: implement some mapping to assign correct picture to specified room_name
                         SqlEngine::addRoomToDB(room);
 
                         // process event's nodes
index f85d1f6cbcc9a521d7806be86e0eccdc3b11cc34..5e60826ab4a21b3bdcd23a382e910f7e67918a27 100644 (file)
@@ -67,8 +67,6 @@ QString SqlEngine::login(const QString &aDatabaseType, const QString &aDatabaseN
         database.open();
     }
 
-    checkConferenceMap(database);
-
     //LOG_INFO(QString("Opening '%1' database '%2'").arg(aDatabaseType).arg(aDatabaseName));
 
     return result ? QString() : database.lastError().text();
@@ -256,10 +254,9 @@ void SqlEngine::addRoomToDB(QHash<QString,QString> &aRoom)
         else // ROOM record doesn't exist yet, need to create it
         {
             query = QSqlQuery(db);
-            query.prepare("INSERT INTO ROOM (xid_conference,name,picture) VALUES (:xid_conference, :name, :picture)");
+            query.prepare("INSERT INTO ROOM (xid_conference,name,picture) VALUES (:xid_conference, :name, '')");
             query.bindValue(":xid_conference", aRoom["conference_id"]);
             query.bindValue(":xid_name", aRoom["name"]);
-            query.bindValue(":xid_picture", aRoom["picture"]);
             if (!query.exec()) qDebug() << "Could not execute 'insert into room ...' query." << query.lastError();
             aRoom["id"]= query.lastInsertId().toString(); // 'id' is assigned automatically
             //LOG_AUTOTEST(query);
@@ -401,13 +398,3 @@ bool SqlEngine::execQueryWithParameter(QSqlDatabase &aDatabase, const QString &a
     }
     return true;
 }
-
-void SqlEngine::checkConferenceMap(QSqlDatabase &aDatabase)
-{
-    QSqlQuery sqlQuery(aDatabase);
-    sqlQuery.prepare("SELECT map FROM conference");
-    if (!sqlQuery.exec()) {
-        qWarning() << "column conference.map is missing; adding";
-        execQuery(aDatabase, "ALTER TABLE conference ADD COLUMN map VARCHAR");
-    }
-}
index 01d14b8b7aa8b810efc6f553facd6b9f1d7b61ca..c10f3a22ab682cf9f1abf5a8d9e8936b33187d34 100644 (file)
@@ -48,8 +48,6 @@ class SqlEngine : public QObject
         static QString login(const QString &aDatabaseType, const QString &aDatabaseName);
         static bool execQuery(QSqlDatabase &aDatabase, const QString &aQuery);
         static bool execQueryWithParameter(QSqlDatabase &aDatabase, const QString &aQuery, const QHash<QString, QVariant>& params);
-
-        static void checkConferenceMap(QSqlDatabase &aDatabase);
 };
 
 #endif /* SQLENGINE_H */