#include <sqlengine.h>
#include <schedulexmlparser.h>
-#include <activity.h>
+#include <track.h>
#include <eventmodel.h>
#include <delegate.h>
connect(mXmlParser, SIGNAL(progressStatus(int)), this, SLOT(showParsingProgress(int)));
statusBar()->showMessage(tr("Ready"));
- //update activity map
- Activity::updateActivityMap();
+ //update track map
+ Track::updateTrackMap();
connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &)));
- connect(activityDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateActivitiesDayView(const QDate &)));
- connect(favouriteDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateFavouritesDayView(const QDate &)));
+ connect(trackDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateTracksView(const QDate &)));
+ connect(favouriteDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateFavouritesView(const QDate &)));
// DAY EVENTS View
dayTreeView->setHeaderHidden(true);
favTreeView->setItemDelegate(new Delegate(favTreeView));
//ACTIVITIES View
- actTreeView->setHeaderHidden(true);
- actTreeView->setRootIsDecorated(false);
- actTreeView->setIndentation(0);
- actTreeView->setAnimated(true);
- actTreeView->setModel(new EventModel());
- actTreeView->setItemDelegate(new Delegate(actTreeView));
+ trackTreeView->setHeaderHidden(true);
+ trackTreeView->setRootIsDecorated(false);
+ trackTreeView->setIndentation(0);
+ trackTreeView->setAnimated(true);
+ trackTreeView->setModel(new EventModel());
+ trackTreeView->setItemDelegate(new Delegate(trackTreeView));
// DAY EVENTS View
searchTreeView->setHeaderHidden(true);
// event clicked
connect(dayTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
connect(favTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
- connect(actTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
+ connect(trackTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
connect(searchTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
// request for map to be displayed
connect(dayTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
connect(favTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
- connect(actTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
+ connect(trackTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
connect(searchTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
// event search button clicked
connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked()));
if(!Conference::getAll().count()) // no conference(s) in the DB
{
dayNavigator->hide(); // hide DayNavigatorWidget
- activityDayNavigator->hide();
+ trackDayNavigator->hide();
}
else
{
QDate aStartDate = Conference::getById(confId).start();
QDate aEndDate = Conference::getById(confId).end();
dayNavigator->setDates(aStartDate, aEndDate);
- activityDayNavigator->setDates(aStartDate, aEndDate);
+ trackDayNavigator->setDates(aStartDate, aEndDate);
favouriteDayNavigator->setDates(aStartDate, aEndDate);
}
QDate aStartDate = Conference::getById(confId).start();
QDate aEndDate = Conference::getById(confId).end();
dayNavigator->setDates(aStartDate, aEndDate);
- activityDayNavigator->setDates(aStartDate, aEndDate);
+ trackDayNavigator->setDates(aStartDate, aEndDate);
}
- //update activity map
- Activity::updateActivityMap();
+ //update track map
+ Track::updateTrackMap();
}
void MainWindow::showParsingProgress(int aStatus)
favouriteDayNavigator->show();
}
break;
- case 2: //index 2 of tabWidget: activitiesTab
+ case 2: //index 2 of tabWidget: trackTab
{
- static_cast<EventModel*>(actTreeView->model())->loadEventsByActivities(Conference::getById(confId).start(), confId);
- actTreeView->reset();
- activityDayNavigator->show();
+ static_cast<EventModel*>(trackTreeView->model())->loadEventsByTrack(Conference::getById(confId).start(), confId);
+ trackTreeView->reset();
+ trackDayNavigator->show();
}
break;
default:
};
}
-void MainWindow::updateActivitiesDayView(const QDate &aDate)
+void MainWindow::updateTracksView(const QDate &aDate)
{
- static_cast<EventModel*>(actTreeView->model())->loadEventsByActivities(aDate, confId);
- actTreeView->reset();
- activityDayNavigator->show();
+ static_cast<EventModel*>(trackTreeView->model())->loadEventsByTrack(aDate, confId);
+ trackTreeView->reset();
+ trackDayNavigator->show();
}
-void MainWindow::updateFavouritesDayView(const QDate &aDate)
+void MainWindow::updateFavouritesView(const QDate &aDate)
{
static_cast<EventModel*>(favTreeView->model())->loadFavEvents(aDate,confId);
favTreeView->reset();
void aboutApp();
void updateDayView(const QDate &aDate);
void updateTab(const int n);
- void updateActivitiesDayView(const QDate &aDate);
- void updateFavouritesDayView(const QDate &aDate);
+ void updateTracksView(const QDate &aDate);
+ void updateFavouritesView(const QDate &aDate);
void itemClicked(const QModelIndex &aIndex);
void displayMap(const QModelIndex &aIndex);
void searchClicked();
<rect>
<x>0</x>
<y>0</y>
- <width>531</width>
- <height>373</height>
+ <width>609</width>
+ <height>431</height>
</rect>
</property>
<property name="minimumSize" >
</widget>
<widget class="QWidget" name="activitiesTab" >
<attribute name="title" >
- <string>Activities</string>
+ <string>Tracks</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" >
<layout class="QVBoxLayout" name="activitiesVerticalLayout" >
<item>
- <widget class="DayNavigatorWidget" native="1" name="activityDayNavigator" />
+ <widget class="DayNavigatorWidget" native="1" name="trackDayNavigator" />
</item>
<item>
- <widget class="TreeView" name="actTreeView" >
+ <widget class="TreeView" name="trackTreeView" >
<property name="maximumSize" >
<size>
<width>16777215</width>
</item>
</layout>
</widget>
- <widget class="QWidget" name="searchTab">
- <attribute name="title">
+ <widget class="QWidget" name="searchTab" >
+ <attribute name="title" >
<string>Search</string>
</attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QCheckBox" name="searchTitle">
- <property name="text">
- <string>Title</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLineEdit" name="searchEdit">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>type a keyword to search</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="searchButton">
- <property name="text">
- <string>Search</string>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="searchAbstract">
- <property name="text">
- <string>Abstract</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="DayNavigatorWidget" name="searchDayNavigator" native="true">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TreeView" name="searchTreeView">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <layout class="QFormLayout" name="formLayout" >
+ <property name="fieldGrowthPolicy" >
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="searchTitle" >
+ <property name="text" >
+ <string>Title</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QLineEdit" name="searchEdit" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" >
+ <string>type a keyword to search</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="searchButton" >
+ <property name="text" >
+ <string>Search</string>
+ </property>
+ <property name="checkable" >
+ <bool>false</bool>
+ </property>
+ <property name="autoDefault" >
+ <bool>false</bool>
+ </property>
+ <property name="default" >
+ <bool>true</bool>
+ </property>
+ <property name="flat" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QCheckBox" name="searchAbstract" >
+ <property name="text" >
+ <string>Abstract</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="DayNavigatorWidget" native="1" name="searchDayNavigator" >
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="TreeView" name="searchTreeView" >
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
- <widget class="QWidget" name="mapTab">
- <attribute name="title">
+ <widget class="QWidget" name="mapTab" >
+ <attribute name="title" >
<string>Map</string>
</attribute>
</widget>
<rect>
<x>0</x>
<y>0</y>
- <width>531</width>
+ <width>609</width>
<height>22</height>
</rect>
</property>
+++ /dev/null
-/*
- * activity.cpp
- *
- * Created on: Dec 27, 2009
- * Author: Pavol Korinek
- */
-
-#include "activity.h"
-
-QString const Activity::sTableName = QString("activity");
-int const Activity::sTableColCount = 2;
-
-QSqlRecord const Activity::sColumns = Activity::toRecord(QList<QSqlField>()
- << QSqlField("id", QVariant::Int)
- << QSqlField("name", QVariant::String));
-
-QMap<int, Activity> Activity::mIdToActivity;
-
-QList<Activity> Activity::getAll()
-{
- QSqlQuery query;
- query.prepare(selectQuery());
- return load(query);
-}
-
-void Activity::updateActivityMap()
-{
- mIdToActivity.clear();
- QList<Activity> activityList = Activity::getAll();
- Activity activity;
- for (int id = 0; id < activityList.count(); ++id) {
- activity = activityList.at(id);
- mIdToActivity.insert(activity.id(), activity);
- }
-}
-
-QString Activity::getActivityName(int id)
-{
- QString name = mIdToActivity.value(id).name();
- if (name == "") {
- qDebug() << QString("Error: undefined activity name for id %1").arg(id);
- }
- return name;
-}
+++ /dev/null
-/*
- * activity.h
- *
- * Created on: Dec 27, 2009
- * Author: Pavol Korinek
- */
-
-#ifndef ACTIVITY_H_
-#define ACTIVITY_H_
-
-#include <ormrecord.h>
-
-class Activity : public OrmRecord<Activity>
-{
-public:
- static const QSqlRecord sColumns;
- static QString const sTableName;
- static const int sTableColCount;
-public:
- static QMap<int, Activity> mIdToActivity;
-public:
- static QList<Activity> getAll();
- int id() const { return value("id").toInt(); }
- void setId(int id) { setValue("id", id); }
- QString name() const { return value("name").toString(); }
- void setName(const QString & type) { setValue("name", type); }
-public:
- static void updateActivityMap();
- static QString getActivityName(int id);
-};
-
-#endif /* ACTIVITY_H_ */
#include "delegate.h"
#include "eventmodel.h"
-#include <activity.h>
+#include <track.h>
#include <QDebug>
#include <QPainter>
fontBigB.setBold(true);
QFontMetrics fmBigB(fontBigB);
- int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width();
+ //int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width();
if(isLast(index))
{
painter->drawText(titlePointF,"Presenter(s): " + event->persons().join(" and "));
// track
titlePointF.setY(titlePointF.y()+fmSmall.height()-fmSmall.descent());
- painter->drawText(titlePointF,"Activity(s): " + Activity::getActivityName(event->activityId()));
+ painter->drawText(titlePointF,"Track: " + Track::getTrackName(event->trackId()));
}
else // doesn't have parent - time-groups' elements (top items)
{
QString const Event::sTable2Name = QString("virtual_event");
int const Event::sTable1ColCount = 9; // see 'toRecord()' for more details
int const Event::sTable2ColCount = 5; // see 'toRecord()' for more details
-const QString Event::XID_ACTIVITY = "xid_activity";
-const QString Event::START = "start";
-
-
QSqlRecord const Event::sColumns = Event::toRecord(QList<QSqlField>()
/* 'columns from Table 1 */
<< QSqlField("xid_conference", QVariant::Int)
<< QSqlField("start", QVariant::DateTime)
<< QSqlField("duration", QVariant::Int)
- << QSqlField("xid_activity", QVariant::Int)
+ << QSqlField("xid_track", QVariant::Int)
<< QSqlField("type", QVariant::String)
<< QSqlField("language", QVariant::String)
<< QSqlField("favourite", QVariant::Bool)
static const QString sTable2Name;
static const int sTable1ColCount;
static const int sTable2ColCount;
- static const QString XID_ACTIVITY;
- static const QString START;
public:
static Event getById(int id, int conferenceId);
static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
// Table 1
int id() const { return value("id").toInt(); }
int conferenceId() const { return value("xid_conference").toInt(); }
- QDateTime start() const { return value(START).toDateTime(); }
+ QDateTime start() const { return value("start").toDateTime(); }
int duration() const { return value("duration").toInt(); }
- int activityId() const { return value(XID_ACTIVITY).toInt(); }
+ int trackId() const { return value("xid_track").toInt(); }
QString type() const { return value("type").toString(); }
QString language() const { return value("language").toString(); }
bool isFavourite() const { return value("favourite").toBool(); }
// Table 1
void setId(int id) { setValue("id", id); }
void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
- void setStart(const QDateTime & start) { setValue(START, start); }
+ void setStart(const QDateTime & start) { setValue("start", start); }
void setDuration(int duration) { setValue("duration", duration); }
- void setActivityId(int activityId) { setValue(XID_ACTIVITY, activityId); }
+ void setTrackId(int trackId) { setValue("xid_track", trackId); }
void setType(const QString & type) { setValue("type", type); }
void setLanguage(const QString & language) { setValue("language", language); }
void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
#include "eventmodel.h"
#include <conference.h>
-#include <activity.h>
-
-const QString EventModel::COMMA_SEPARATOR = ", ";
+#include <track.h>
EventModel::EventModel()
{
mGroups.last().mChildCount = mEvents.count() - mGroups.last().mFirstEventIndex;
}
-void EventModel::createActivityGroups() {
+void EventModel::createTrackGroups() {
mGroups.clear();
mParents.clear();
if (mEvents.empty())
{
return;
}
- int activityId = mEvents.first().activityId();
+ int trackId = mEvents.first().trackId();
- mGroups << EventModel::Group(Activity::getActivityName(activityId), 0);
- int nextActivityId = activityId;
+ mGroups << EventModel::Group(Track::getTrackName(trackId), 0);
+ int nextTrackId = trackId;
for (int i=0; i<mEvents.count(); i++)
{
- activityId = mEvents.at(i).activityId();
- if (nextActivityId != activityId)
+ trackId = mEvents.at(i).trackId();
+ if (nextTrackId != trackId)
{
mGroups.last().mChildCount = i - mGroups.last().mFirstEventIndex;
- mGroups << EventModel::Group(Activity::getActivityName(activityId), i);
- nextActivityId = activityId;
+ mGroups << EventModel::Group(Track::getTrackName(trackId), i);
+ nextTrackId = trackId;
}
// add parent-child relation
mParents[mEvents.at(i).id()] = mGroups.count() - 1;
if(Conference::getAll().count())
{
qDebug() << "Loading Conference Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate;
- mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, Event::START);
+ mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start");
}
createTimeGroups();
}
createTimeGroups();
}
-void EventModel::loadEventsByActivities(const QDate &aDate, int aConferenceId)
+void EventModel::loadEventsByTrack(const QDate &aDate, int aConferenceId)
{
clearModel();
if(Conference::getAll().count())
{
- qDebug() << "Loading Conference Data (by Activities): [" << Conference::getById(aConferenceId).title() << "] " << aDate;
- mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, Event::XID_ACTIVITY + COMMA_SEPARATOR + Event::START);
+ qDebug() << "Loading Conference Data (by Track): [" << Conference::getById(aConferenceId).title() << "] " << aDate;
+ mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "xid_track, start");
}
- createActivityGroups();
+ createTrackGroups();
}
void EventModel::emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight)
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
- void loadEventsByActivities(const QDate &aDate, int aConferenceId); // loads Events grouped by Activities from the DB
+ void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Track from the DB
// a method to force 'EventModel' emit signal 'dataChanged()'
// a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes)
void emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight);
private:
void createTimeGroups();
- void createActivityGroups();
+ void createTrackGroups();
void clearModel();
private:
TARGETDEPS += $$DESTDIR/libqalarm.a
}
-HEADERS += activity.h \
- event.h \
+HEADERS += event.h \
conference.h \
+ track.h \
delegate.h \
eventmodel.h \
treeview.h
-SOURCES += activity.cpp \
- event.cpp \
+SOURCES += event.cpp \
conference.cpp \
+ track.cpp \
delegate.cpp \
eventmodel.cpp \
treeview.cpp
--- /dev/null
+/*
+ * track.cpp
+ *
+ * Created on: Dec 27, 2009
+ * Author: Pavol Korinek
+ */
+
+#include "track.h"
+
+QString const Track::sTableName = QString("track");
+int const Track::sTableColCount = 2;
+
+QSqlRecord const Track::sColumns = Track::toRecord(QList<QSqlField>()
+ << QSqlField("id", QVariant::Int)
+ << QSqlField("name", QVariant::String));
+
+QMap<int, Track> Track::mIdToTrack;
+
+QList<Track> Track::getAll()
+{
+ QSqlQuery query;
+ query.prepare(selectQuery());
+ return load(query);
+}
+
+void Track::updateTrackMap()
+{
+ mIdToTrack.clear();
+ QList<Track> trackList = Track::getAll();
+ Track track;
+ for (int id = 0; id < trackList.count(); ++id) {
+ track = trackList.at(id);
+ mIdToTrack.insert(track.id(), track);
+ }
+}
+
+QString Track::getTrackName(int id)
+{
+ QString name = mIdToTrack.value(id).name();
+ if (name == "") {
+ qDebug() << QString("Error: undefined track name for id %1").arg(id);
+ }
+ return name;
+}
--- /dev/null
+/*
+ * track.h
+ *
+ * Created on: Dec 27, 2009
+ * Author: Pavol Korinek
+ */
+
+#ifndef TRACK_H
+#define TRACK_H
+
+#include <ormrecord.h>
+
+class Track : public OrmRecord<Track>
+{
+public:
+ static const QSqlRecord sColumns;
+ static QString const sTableName;
+ static const int sTableColCount;
+public:
+ static QMap<int, Track> mIdToTrack;
+public:
+ static QList<Track> getAll();
+ int id() const { return value("id").toInt(); }
+ void setId(int id) { setValue("id", id); }
+ QString name() const { return value("name").toString(); }
+ void setName(const QString & type) { setValue("name", type); }
+public:
+ static void updateTrackMap();
+ static QString getTrackName(int id);
+};
+
+#endif /* TRACK_H */
+
if (db.isValid() && db.isOpen())
{
- // track/activity has to be handled as the first, since it is necessary to get
- // track ID from the ACTIVITY table, or to create new ACTIVITY record
+ // track has to be handled as the first, since it is necessary to get
+ // track ID from the TRACK table, or to create new TRACK record
// and get the ID from newly created record
- QString queryExist = QString("SELECT id FROM activity WHERE name='%1'").arg(aEvent["track"]);
+ QString queryExist = QString("SELECT id FROM track WHERE name='%1'").arg(aEvent["track"]);
QSqlQuery resultExist(queryExist,db);
- // now we have to check whether ACTIVITY record with 'name' exists or not,
- // - if it doesn't exist yet, then we have to add that record to 'ACTIVITY' table
- // and assign autoincremented 'id' to aActivity
- // - if it exists, then we need to get its 'id' and assign it to aRoom
+ // now we have to check whether TRACK record with 'name' exists or not,
+ // - if it doesn't exist yet, then we have to add that record to 'TRACK' table
+ // - if it exists, then we need to get its 'id'
int actId = -1;
- if(resultExist.next()) // ACTIVITY record with 'name' already exists: we need to get its 'id'
+ if(resultExist.next()) // TRACK record with 'name' already exists: we need to get its 'id'
{
actId = resultExist.value(0).toInt();
}
- else // ACTIVITY record doesn't exist yet, need to create it
+ else // TRACK record doesn't exist yet, need to create it
{
QString values = QString("'%1'").arg(aEvent["track"]);
- QString query = QString("INSERT INTO activity (name) VALUES (%1)").arg(values);
+ QString query = QString("INSERT INTO track (name) VALUES (%1)").arg(values);
QSqlQuery result (query, db);
actId = result.lastInsertId().toInt(); // 'id' is assigned automatically
}
.arg("0") \
.arg("0");
- QString query = QString("INSERT INTO EVENT (xid_conference, id, start, duration, xid_activity, type, language, favourite, alarm) VALUES (%1)").arg(values);
+ QString query = QString("INSERT INTO EVENT (xid_conference, id, start, duration, xid_track, type, language, favourite, alarm) VALUES (%1)").arg(values);
QSqlQuery result (query, db);
//LOG_AUTOTEST(query);
day_change INTEGER, \
timeslot_duration INTEGER)");
- query.exec("CREATE TABLE ACTIVITY ( \
+ query.exec("CREATE TABLE TRACK ( \
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , \
name VARCHAR NOT NULL )");
id INTEGER NOT NULL , \
start INTEGER NOT NULL , \
duration INTEGER NOT NULL , \
- xid_activity INTEGER NOT NULL REFERENCES ACTIVITY(id), \
+ xid_track INTEGER NOT NULL REFERENCES TRACK(id), \
type VARCHAR, \
language VARCHAR, \
favourite INTEGER DEFAULT 0, \
alarm INTEGER DEFAULT 0, \
PRIMARY KEY (xid_conference,id), \
FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id) \
- FOREIGN KEY(xid_activity) REFERENCES ACTIVITY(id))");
+ FOREIGN KEY(xid_track) REFERENCES TRACK(id))");
#ifdef MAEMO
// TBD: MAEMO Virtual tables compatibility (waiting for Marek).
QCOMPARE(event.id(), 500);
QCOMPARE(event.start(), QDateTime(QDate(2009, 2, 7), QTime(11, 30, 0), Qt::UTC));
- QCOMPARE(event.activityId(), 123);
+ QCOMPARE(event.trackId(), 123);
// !!! TODO: typeId and languageId
QCOMPARE(event.type(), QString("Podium"));
event.setConferenceId(20);
event.setStart(QDateTime::fromString("Sat Feb 7 11:30:00 2009"));
event.setDuration(30);
- event.setActivityId(40);
+ event.setTrackId(40);
event.setType(QString("type"));
event.setLanguage(QString("language"));
QCOMPARE(event.conferenceId(), 20);
QCOMPARE(event.start(), QDateTime::fromString("Sat Feb 7 11:30:00 2009"));
QCOMPARE(event.duration(), 30);
- QCOMPARE(event.activityId(), 40);
+ QCOMPARE(event.trackId(), 40);
QCOMPARE(event.type(), QString("type"));
QCOMPARE(event.language(), QString("language"));
}
void EventTest::columnsForSelect()
{
- QCOMPARE(Event::columnsForSelect(), QString("id,xid_conference,start,duration,xid_activity,type,language"));
+ QCOMPARE(Event::columnsForSelect(), QString("id,xid_conference,start,duration,xid_track,type,language"));
QCOMPARE(Event::columnsForSelect("t0"),
- QString("t0.id,t0.xid_conference,t0.start,t0.duration,t0.xid_activity,t0.type,t0.language"));
+ QString("t0.id,t0.xid_conference,t0.start,t0.duration,t0.xid_track,t0.type,t0.language"));
}
void EventTest::selectQuery()
{
- QCOMPARE(Event::selectQuery(), QString("SELECT id,xid_conference,start,duration,xid_activity,type,language FROM event "));
+ QCOMPARE(Event::selectQuery(), QString("SELECT id,xid_conference,start,duration,xid_track,type,language FROM event "));
}