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.
, 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
#include "conferencemodel.h"
#include "urlinputdialog.h"
-#include "mapwindow.h"
#include "errormessage.h"
#include <QInputDialog>
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
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();
}
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();
-}
void removeClicked();
void changeUrlClicked();
void refreshClicked();
- void conferenceMapClicked();
private:
ConferenceModel* model;
</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>
eventdialog.ui \
conflictsdialog.ui \
tabcontainer.ui \
- mapwindow.ui \
settingsdialog.ui \
conferenceeditor.ui \
urlinputdialog.ui
daynavigatorwidget.h \
eventdialog.h \
tabcontainer.h \
- mapwindow.h \
settingsdialog.h \
conferenceeditor.h \
urlinputdialog.h
daynavigatorwidget.cpp \
eventdialog.cpp \
tabcontainer.cpp \
- mapwindow.cpp \
settingsdialog.cpp \
conferenceeditor.cpp \
urlinputdialog.cpp
+++ /dev/null
-/*
- * 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();
-}
-
+++ /dev/null
-/*
- * 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 */
-
+++ /dev/null
-<?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>
#include <delegate.h>
#include "eventdialog.h"
-#include "mapwindow.h"
#include "room.h"
#include "errormessage.h"
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
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);
protected slots:
virtual void updateTreeView(const QDate &aDate);
void itemClicked(const QModelIndex &aIndex);
- void displayMap(const QModelIndex &aIndex);
void displayConflicts(const QModelIndex &aIndex);
};
<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>
<< QSqlField("timeslot_duration", QVariant::Int)
<< QSqlField("active", QVariant::Bool)
<< QSqlField("url", QVariant::String)
- << QSqlField("map", QVariant::String)
);
QString const Conference::sTableName = QString("conference");
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); }
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);
// 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
FavouriteControlOff,
AlarmControlOn,
AlarmControlOff,
- MapControl,
WarningControl
};
#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)
{
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();
handled = true;
}
break;
- case Delegate::MapControl:
- {
- // handle Alarm Control clicked
- emit(requestForMap(aIndex));
- handled = true;
- }
- break;
case Delegate::WarningControl:
{
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
};
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
database.open();
}
- checkConferenceMap(database);
-
//LOG_INFO(QString("Opening '%1' database '%2'").arg(aDatabaseType).arg(aDatabaseName));
return result ? QString() : database.lastError().text();
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);
}
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");
- }
-}
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 */