From: pavelpa Date: Thu, 21 Jan 2010 18:23:23 +0000 (+0000) Subject: added 'Conference' tab - to list conference details X-Git-Tag: 0.5.0~222 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/30e2bdf02be29e2180c10b817caa4e6679d6025c added 'Conference' tab - to list conference details - implemented AppSettings for storing Application settings - stored conference ID --- diff --git a/src/app/app.pro b/src/app/app.pro index 71f91d4..6b1ea4c 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -16,7 +16,10 @@ maemo { TARGETDEPS += $$DESTDIR/libqalarm.a } -SOURCES += main.cpp +SOURCES += main.cpp \ + appsettings.cpp + +HEADERS += appsettings.h RESOURCES += ../icons.qrc \ ../maps.qrc diff --git a/src/gui/alarmdialog.cpp b/src/gui/alarmdialog.cpp index 01595f5..a834225 100644 --- a/src/gui/alarmdialog.cpp +++ b/src/gui/alarmdialog.cpp @@ -1,4 +1,5 @@ #include "alarmdialog.h" +#include #include #include @@ -9,8 +10,6 @@ const int SNOOZE_TIME = 5; // in minutes -const int confId = 1; - AlarmDialog::AlarmDialog(int argc, char *argv[], QWidget *aParent) : QDialog(aParent) , mEventId(0) @@ -47,7 +46,7 @@ AlarmDialog::AlarmDialog(int argc, char *argv[], QWidget *aParent) QString roomStr; try { - Event event = Event::getById(mEventId,confId); + Event event = Event::getById(mEventId,AppSettings::confId()); titleStr = "Event alarm"; messageStr = event.title(); timeStr = event.start().toString("hh:mm") + "-" + event.start().addSecs(event.duration()).toString("hh:mm"); @@ -89,7 +88,7 @@ void AlarmDialog::closeDialog() // before closing the dialog, it is necessary to remove alarm flag from the DB try { - Event event = Event::getById(mEventId,confId); + Event event = Event::getById(mEventId,AppSettings::confId()); event.setHasAlarm(false); event.update("alarm"); } diff --git a/src/gui/eventdialog.cpp b/src/gui/eventdialog.cpp index 74d170c..df67695 100644 --- a/src/gui/eventdialog.cpp +++ b/src/gui/eventdialog.cpp @@ -1,4 +1,5 @@ #include "eventdialog.h" +#include #include @@ -12,8 +13,7 @@ EventDialog::EventDialog(const int &aEventId, QWidget *aParent) showFullScreen(); #endif - const int confId = 1; - Event event = Event::getById(aEventId,confId); + Event event = Event::getById(aEventId,AppSettings::confId()); //abstract->setStyleSheet("background-color : transparent;"); //description->setStyleSheet("background-color : transparent;"); diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 2f5abf9..12237c4 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -7,7 +7,7 @@ QT += sql xml # module dependencies LIBS += -L$$DESTDIR -lmvc -lorm -lsql -INCLUDEPATH += ../orm ../mvc ../sql +INCLUDEPATH += ../orm ../mvc ../sql ../app DEPENDPATH += . ../orm ../mvc ../sql TARGETDEPS += $$DESTDIR/liborm.a $$DESTDIR/libmvc.a $$DESTDIR/libsql.a maemo { diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 97f1716..7fa5c64 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1,4 +1,5 @@ #include "mainwindow.h" +#include #include #include @@ -19,14 +20,15 @@ #include "importscheduledialog.h" #include "mapwindow.h" - -const int confId = 1; - MainWindow::MainWindow(int aEventId, QWidget *aParent) : QMainWindow(aParent) { setupUi(this); + // TODO: conference ID should be assigned based on actual data in the DB + // for testing only + AppSettings::setConfId(1); + // connect Menu actions connect(actionImportSchedule, SIGNAL(triggered()), SLOT(importSchedule())); connect(actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); @@ -61,7 +63,7 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) favTreeView->setModel(new EventModel()); favTreeView->setItemDelegate(new Delegate(favTreeView)); - //ACTIVITIES View + // TRACKS View trackTreeView->setHeaderHidden(true); trackTreeView->setRootIsDecorated(false); trackTreeView->setIndentation(0); @@ -98,7 +100,7 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) // TESTING: load some 'fav' data if(Conference::getAll().count()) // no conference(s) in the DB { - static_cast(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId); + static_cast(favTreeView->model())->loadFavEvents(Conference::getById(AppSettings::confId()).start(),AppSettings::confId()); favTreeView->reset(); } @@ -109,12 +111,20 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) } else { - QDate aStartDate = Conference::getById(confId).start(); - QDate aEndDate = Conference::getById(confId).end(); + QDate aStartDate = Conference::getById(AppSettings::confId()).start(); + QDate aEndDate = Conference::getById(AppSettings::confId()).end(); dayNavigator->setDates(aStartDate, aEndDate); trackDayNavigator->setDates(aStartDate, aEndDate); favouriteDayNavigator->setDates(aStartDate, aEndDate); searchDayNavigator->setDates(aStartDate, aEndDate); + // + conferenceTitle->setText(Conference::getById(AppSettings::confId()).title()); + conferenceSubtitle->setText(Conference::getById(AppSettings::confId()).subtitle()); + conferenceWhere->setText(Conference::getById(AppSettings::confId()).city() + ", " + Conference::getById(AppSettings::confId()).venue()); + conferenceWhen->setText( + Conference::getById(AppSettings::confId()).start().toString("dd-MM-yyyy") + + ", " + + Conference::getById(AppSettings::confId()).end().toString("dd-MM-yyyy")); } connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int))); @@ -153,8 +163,8 @@ void MainWindow::importSchedule() if(Conference::getAll().count()) { // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates - QDate aStartDate = Conference::getById(confId).start(); - QDate aEndDate = Conference::getById(confId).end(); + QDate aStartDate = Conference::getById(AppSettings::confId()).start(); + QDate aEndDate = Conference::getById(AppSettings::confId()).end(); dayNavigator->setDates(aStartDate, aEndDate); //update activity map Track::updateTrackMap(); @@ -172,7 +182,7 @@ void MainWindow::aboutApp() void MainWindow::updateDayView(const QDate &aDate) { - static_cast(dayTreeView->model())->loadEvents(aDate,confId); + static_cast(dayTreeView->model())->loadEvents(aDate,AppSettings::confId()); dayTreeView->reset(); dayNavigator->show(); } @@ -210,14 +220,14 @@ void MainWindow::updateTab(const int aIndex) void MainWindow::updateTracksView(const QDate &aDate) { - static_cast(trackTreeView->model())->loadEventsByTrack(aDate, confId); + static_cast(trackTreeView->model())->loadEventsByTrack(aDate, AppSettings::confId()); trackTreeView->reset(); trackDayNavigator->show(); } void MainWindow::updateFavouritesView(const QDate &aDate) { - static_cast(favTreeView->model())->loadFavEvents(aDate,confId); + static_cast(favTreeView->model())->loadFavEvents(aDate,AppSettings::confId()); favTreeView->reset(); favouriteDayNavigator->show(); } @@ -225,7 +235,7 @@ void MainWindow::updateFavouritesView(const QDate &aDate) void MainWindow::updateSearchView(const QDate &aDate) { searchTreeView->reset(); - int eventsCount = static_cast(searchTreeView->model())->loadSearchResultEvents(aDate,confId); + int eventsCount = static_cast(searchTreeView->model())->loadSearchResultEvents(aDate,AppSettings::confId()); if( eventsCount ){ searchDayNavigator->show(); searchTreeView->show(); @@ -276,14 +286,17 @@ void MainWindow::searchClicked() if( searchAbstract->isChecked() ) columns.append( "abstract" ); - mSqlEngine->searchEvent( confId, columns, searchEdit->text() ); - updateSearchView( Conference::getById(confId).start() ); + mSqlEngine->searchEvent( AppSettings::confId(), columns, searchEdit->text() ); + updateSearchView( Conference::getById(AppSettings::confId()).start() ); } void MainWindow::displayWarning(const QModelIndex &aIndex) { + Q_UNUSED(aIndex); + QMessageBox::warning( this, tr("Time Conflict Warning"), tr("This event happens at the same time than another one of your favourites.") ); } + diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 4760cfa..548d021 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -23,7 +23,7 @@ - 0 + 5 @@ -66,7 +66,7 @@ - + Tracks @@ -90,59 +90,59 @@ - - + + Search - + - - + + QFormLayout::AllNonFixedFieldsGrow - - - + + + Title - - + + - - + + true - + type a keyword to search - - + + Search - + false - + false - + true - + false - - - + + + Abstract @@ -150,13 +150,13 @@ - + - - + + Qt::Horizontal - + 40 20 @@ -165,8 +165,8 @@ - - + + 16777215 16777215 @@ -175,11 +175,11 @@ - - + + Qt::Horizontal - + 40 20 @@ -190,8 +190,8 @@ - - + + 16777215 16777215 @@ -206,6 +206,121 @@ Map + + + Conference + + + + + + + + + 75 + true + + + + Conference Name + + + Qt::AlignCenter + + + true + + + + + + + Conference Subtitle + + + Qt::AlignCenter + + + true + + + + + + + Qt::Horizontal + + + + + + + + + When: + + + + + + + Where: + + + + + + + DATE (FROM - TO) + + + + + + + CITY, CAMPUS + + + + + + + MAP + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + diff --git a/src/sql/schedulexmlparser.cpp b/src/sql/schedulexmlparser.cpp index 6b7308f..db74630 100644 --- a/src/sql/schedulexmlparser.cpp +++ b/src/sql/schedulexmlparser.cpp @@ -1,96 +1,96 @@ - -#include -#include - -#include "schedulexmlparser.h" -#include "sqlengine.h" - -#include - -ScheduleXmlParser::ScheduleXmlParser(QObject *aParent) - : QObject(aParent) -{ -} - -void ScheduleXmlParser::parseData(const QByteArray &aData, SqlEngine *aDBEngine) -{ - Q_ASSERT(NULL != aDBEngine); - - QDomDocument document; - document.setContent (aData, false); - - QDomElement scheduleElement = document.firstChildElement("schedule"); - - if (!scheduleElement.isNull()) - { - // TODO: assign conferenceID based on eg. title - int conferenceID = 1; // HARD-WIRED for now to '1' - only one Conference - - QDomElement conferenceElement = scheduleElement.firstChildElement("conference"); - if (!conferenceElement.isNull()) - { - QHash conference; - conference["id"] = QString::number(conferenceID,10); - conference["title"] = conferenceElement.firstChildElement("title").text(); - conference["subtitle"] = conferenceElement.firstChildElement("subtitle").text(); - conference["venue"] = conferenceElement.firstChildElement("venue").text(); - conference["city"] = conferenceElement.firstChildElement("city").text(); - conference["start"] = conferenceElement.firstChildElement("start").text(); // date - conference["end"] = conferenceElement.firstChildElement("end").text(); // date - conference["days"] = conferenceElement.firstChildElement("days").text(); // int - conference["day_change"] = conferenceElement.firstChildElement("day_change").text(); // time - conference["timeslot_duration"] = conferenceElement.firstChildElement("timeslot_duration").text(); // time - aDBEngine->addConferenceToDB(conference); - } - - // we need to get count of all events in order to emit 'progressStatus' signal - int totalEventsCount = scheduleElement.elementsByTagName("event").count(); - - // parsing day elements - int currentEvent = 0; // hold global idx of processed event - QDomNodeList dayList = scheduleElement.elementsByTagName("day"); - for (int i=0; i room; - room["name"] = roomElement.attribute("name"); - room["event_id"] = eventElement.attribute("id"); - room["conference_id"] = QString::number(conferenceID,10); - room["picture"] = "NOT DEFINED YET"; // TODO: implement some mapping to assign correct picture to specified room_name - aDBEngine->addRoomToDB(room); - - // process event's nodes + +#include +#include + +#include "schedulexmlparser.h" +#include "sqlengine.h" + +#include + +ScheduleXmlParser::ScheduleXmlParser(QObject *aParent) + : QObject(aParent) +{ +} + +void ScheduleXmlParser::parseData(const QByteArray &aData, SqlEngine *aDBEngine) +{ + Q_ASSERT(NULL != aDBEngine); + + QDomDocument document; + document.setContent (aData, false); + + QDomElement scheduleElement = document.firstChildElement("schedule"); + + if (!scheduleElement.isNull()) + { + // TODO: assign conferenceID based on eg. title + int conferenceID = 1; // HARD-WIRED for now to '1' - only one Conference + + QDomElement conferenceElement = scheduleElement.firstChildElement("conference"); + if (!conferenceElement.isNull()) + { + QHash conference; + conference["id"] = QString::number(conferenceID,10); + conference["title"] = conferenceElement.firstChildElement("title").text(); + conference["subtitle"] = conferenceElement.firstChildElement("subtitle").text(); + conference["venue"] = conferenceElement.firstChildElement("venue").text(); + conference["city"] = conferenceElement.firstChildElement("city").text(); + conference["start"] = conferenceElement.firstChildElement("start").text(); // date + conference["end"] = conferenceElement.firstChildElement("end").text(); // date + conference["days"] = conferenceElement.firstChildElement("days").text(); // int + conference["day_change"] = conferenceElement.firstChildElement("day_change").text(); // time + conference["timeslot_duration"] = conferenceElement.firstChildElement("timeslot_duration").text(); // time + aDBEngine->addConferenceToDB(conference); + } + + // we need to get count of all events in order to emit 'progressStatus' signal + int totalEventsCount = scheduleElement.elementsByTagName("event").count(); + + // parsing day elements + int currentEvent = 0; // hold global idx of processed event + QDomNodeList dayList = scheduleElement.elementsByTagName("day"); + for (int i=0; i room; + room["name"] = roomElement.attribute("name"); + room["event_id"] = eventElement.attribute("id"); + room["conference_id"] = QString::number(conferenceID,10); + room["picture"] = "NOT DEFINED YET"; // TODO: implement some mapping to assign correct picture to specified room_name + aDBEngine->addRoomToDB(room); + + // process event's nodes QHash event; event["id"] = eventElement.attribute("id");; event["conference_id"] = QString::number(conferenceID, 10); - event["start"] = eventElement.firstChildElement("start").text(); // time eg. 10:00 + event["start"] = eventElement.firstChildElement("start").text(); // time eg. 10:00 event["date"] = dayElement.attribute("date"); // date eg. 2009-02-07 event["duration"] = eventElement.firstChildElement("duration").text(); // time eg. 00:30 event["room_name"] = eventElement.firstChildElement("room").text(); // string eg. "Janson" event["tag"] = eventElement.firstChildElement("tag").text(); // string eg. "welcome" event["title"] = eventElement.firstChildElement("title").text(); // string eg. "Welcome" event["subtitle"] = eventElement.firstChildElement("subtitle").text(); // string - event["track"] = eventElement.firstChildElement("track").text(); // string eg. "Keynotes" + event["track"] = eventElement.firstChildElement("track").text(); // string eg. "Keynotes" event["type"] = eventElement.firstChildElement("type").text(); // string eg. "Podium" event["language"] = eventElement.firstChildElement("language").text(); // language eg. "English" event["abstract"] = eventElement.firstChildElement("abstract").text(); // string @@ -122,11 +122,11 @@ void ScheduleXmlParser::parseData(const QByteArray &aData, SqlEngine *aDBEngine) } // emit signal to inform the user about the current status (how many events are parsed so far - expressed in %) int status = currentEvent * 100 / totalEventsCount; - progressStatus(status); - } // parsing event elements - } - } // parsing room elements - } // parsing day elements - } // schedule element -} - + progressStatus(status); + } // parsing event elements + } + } // parsing room elements + } // parsing day elements + } // schedule element +} +