--- /dev/null
+TEMPLATE = app
+TARGET = fosdem
+DESTDIR = ../bin
+
+# module dependencies
+LIBS += -L$$DESTDIR -lgui -lmodel
+INCLUDEPATH += ../gui
+DEPENDPATH += . ../gui
+TARGETDEPS += $$DESTDIR/libmodel.a $$DESTDIR/libgui.a
+
+SOURCES += main.cpp
+
--- /dev/null
+#include <mainwindow.h>
+
+#include <QtGui/QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ MainWindow w;
+ w.show();
+ return a.exec();
+}
--- /dev/null
+TEMPLATE = subdirs
+SUBDIRS = model gui app test
+CONFIG += ordered
+
--- /dev/null
+TEMPLATE = lib
+TARGET = gui
+DESTDIR = ../bin
+CONFIG += static
+
+# module dependencies
+LIBS += -L$$DESTDIR -lmodel
+INCLUDEPATH += ../model
+DEPENDPATH += . ../model
+TARGETDEPS += $$DESTDIR/libmodel.a
+
+
+# A shamelessly long list of sources, headers and forms.
+# Please note that resources MUST be added to the app module
+# (which means they need to be added to the test module as well,
+# but I am sure you can live with that for the time being).
+SOURCES += mainwindow.cpp
+HEADERS += mainwindow.h
+
--- /dev/null
+#include "mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+{
+}
--- /dev/null
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QtGui/QMainWindow>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+};
+
+#endif // MAINWINDOW_H
--- /dev/null
+#include "event.h"
+
+Event Event::getById(int id, int conferenceId)
+{
+ Event newEvent;
+ return newEvent;
+}
--- /dev/null
+#ifndef EVENT_H
+#define EVENT_H
+
+#include <QDateTime>
+
+class Event
+{
+public:
+ static Event getById(int id, int conferenceId);
+
+public:
+ int id() const { return mId; }
+ int conferenceId() const { return mConferenceId; }
+ QDateTime start() const { return mStart; }
+ int duration() const { return mDuration; }
+ int activityId() const { return mActivityId; }
+ int typeId() const { return mTypeId; }
+ int languageId() const { return mLanguageId; }
+
+private:
+ Event() {}; // private constructor, use static methods to access instances
+
+private:
+ int mId;
+ int mConferenceId;
+ QDateTime mStart;
+ int mDuration;
+ int mActivityId;
+ int mTypeId;
+ int mLanguageId;
+};
+
+#endif // EVENT_H
--- /dev/null
+TEMPLATE = lib
+TARGET = model
+DESTDIR = ../bin
+CONFIG += static
+
+# module dependencies
+DEPENDPATH += .
+
+HEADERS += event.h
+SOURCES += event.cpp
+
--- /dev/null
+#include <QtTest>
+
+#include "model/eventtest.h"
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ EventTest eventTest;
+ QTest::qExec(&eventTest, argc, argv);
+}
+
--- /dev/null
+#include "eventtest.h"
+
+#include <QtTest>
+#include <QSqlDatabase>
+
+#include <event.h>
+
+void EventTest::initTestCase()
+{
+ // Connect to the test database. Ask Mr. Pavelka to generate one for you :)
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
+ db.setDatabaseName("fostem-test.sqlite");
+ QVERIFY(db.open());
+}
+
+void EventTest::getById()
+{
+ Event event = Event::getById(500, 1);
+ QCOMPARE(event.id(), 500);
+ QCOMPARE(event.start(), QDateTime::fromString("Sat Feb 7 11:30:00 2009"));
+ QCOMPARE(event.activityId(), 123);
+
+ // !!! TODO: typeId and languageId
+ QCOMPARE(event.typeId(), 0);
+ QCOMPARE(event.languageId(), 0);
+}
--- /dev/null
+#ifndef EVENTTEST_H
+#define EVENTTEST_H
+
+#include <QObject>
+
+class EventTest : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+
+ void getById();
+};
+
+
+#endif // EVENTTEST_H
+
--- /dev/null
+TEMPLATE = app
+TARGET = test
+DESTDIR = ../bin
+CONFIG += qtestlib console
+QT += sql
+
+# module dependencies
+LIBS += -L$$DESTDIR -lgui -lmodel
+INCLUDEPATH += ../gui ../model
+DEPENDPATH += . ../gui ../model
+TARGETDEPS += $$DESTDIR/libmodel.a $$DESTDIR/libgui.a
+
+SOURCES += main.cpp \
+ model/EventTest.cpp
+
+HEADERS += \
+ model/EventTest.h
+