From 707cd31d92cf0842eefd991782f3df2fa7da57a1 Mon Sep 17 00:00:00 2001 From: pavelpa Date: Mon, 18 Jan 2010 19:42:57 +0000 Subject: [PATCH] implemented 'Event' dialog to display relevant 'Event's info --- src/gui/eventdialog.cpp | 14 +++++ src/gui/eventdialog.h | 19 +++++++ src/gui/eventdialog.ui | 110 ++++++++++++++++++++++++++++++++++++++++ src/gui/gui.pro | 9 ++-- src/gui/mainwindow.cpp | 32 +++++++++--- src/gui/mainwindow.h | 1 + src/gui/mainwindow.ui | 4 +- 7 files changed, 176 insertions(+), 13 deletions(-) create mode 100644 src/gui/eventdialog.cpp create mode 100644 src/gui/eventdialog.h create mode 100644 src/gui/eventdialog.ui diff --git a/src/gui/eventdialog.cpp b/src/gui/eventdialog.cpp new file mode 100644 index 0000000..8dd8f79 --- /dev/null +++ b/src/gui/eventdialog.cpp @@ -0,0 +1,14 @@ +#include "eventdialog.h" + +EventDialog::EventDialog(const QModelIndex &aIndex, QWidget *aParent) + : QDialog(aParent) + , mIndex(aIndex) +{ + setupUi(this); + Event *event = static_cast(mIndex.internalPointer()); + title->setText(event->title()); + persons->setText(QString::number(event->id())); + abstract->setPlainText(event->abstract()); + description->setPlainText(event->description()); +} + diff --git a/src/gui/eventdialog.h b/src/gui/eventdialog.h new file mode 100644 index 0000000..ac99380 --- /dev/null +++ b/src/gui/eventdialog.h @@ -0,0 +1,19 @@ +#ifndef EVENTDIALOG_H +#define EVENTDIALOG_H + +#include +#include +#include "ui_eventdialog.h" +#include + +class EventDialog : public QDialog, Ui::EventDialog +{ +public: + EventDialog(const QModelIndex &aIndex, QWidget *aParent = NULL); + ~EventDialog() {} +private: + QModelIndex mIndex; +}; + +#endif /* EVENTDIALOG_H */ + diff --git a/src/gui/eventdialog.ui b/src/gui/eventdialog.ui new file mode 100644 index 0000000..33b00c0 --- /dev/null +++ b/src/gui/eventdialog.ui @@ -0,0 +1,110 @@ + + EventDialog + + + + 0 + 0 + 339 + 250 + + + + Dialog + + + + + + + + Here goes title + + + + + + + + + Presenter(s): + + + + + + + Here go persons + + + + + + + Abstract: + + + + + + + + + + Description: + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + + + + + + + okButton + clicked() + EventDialog + close() + + + 287 + 84 + + + 169 + 53 + + + + + diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 65b569f..1139109 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -25,13 +25,16 @@ maemo { FORMS += mainwindow.ui \ daynavigatorwidget.ui \ - about.ui + about.ui \ + eventdialog.ui HEADERS += mainwindow.h \ - daynavigatorwidget.h + daynavigatorwidget.h \ + eventdialog.h SOURCES += mainwindow.cpp \ - daynavigatorwidget.cpp + daynavigatorwidget.cpp \ + eventdialog.cpp maemo { FORMS += alarmdialog.ui diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index b527e48..5aac872 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -13,6 +13,7 @@ #include #include "ui_about.h" +#include "eventdialog.h" #include "daynavigatorwidget.h" MainWindow::MainWindow(QWidget *parent) @@ -55,12 +56,16 @@ MainWindow::MainWindow(QWidget *parent) favTreeView->setItemDelegate(new Delegate(favTreeView)); //ACTIVITIES View - activityDayTreeView->setHeaderHidden(true); - activityDayTreeView->setRootIsDecorated(false); - activityDayTreeView->setIndentation(0); - activityDayTreeView->setAnimated(true); - activityDayTreeView->setModel(new EventModel()); - activityDayTreeView->setItemDelegate(new Delegate(activityDayTreeView)); + actTreeView->setHeaderHidden(true); + actTreeView->setRootIsDecorated(false); + actTreeView->setIndentation(0); + actTreeView->setAnimated(true); + actTreeView->setModel(new EventModel()); + actTreeView->setItemDelegate(new Delegate(actTreeView)); + + connect(dayTreeView, SIGNAL(doubleClicked(const QModelIndex &)), SLOT(itemDoubleClicked(const QModelIndex &))); + connect(favTreeView, SIGNAL(doubleClicked(const QModelIndex &)), SLOT(itemDoubleClicked(const QModelIndex &))); + connect(actTreeView, SIGNAL(doubleClicked(const QModelIndex &)), SLOT(itemDoubleClicked(const QModelIndex &))); // TESTING: load some 'fav' data if(Conference::getAll().count()) // no conference(s) in the DB @@ -171,7 +176,18 @@ void MainWindow::updateFavViewComplete() void MainWindow::updateActivitiesDayView(const QDate &aDate) { int confId = 1; - static_cast(activityDayTreeView->model())->loadEventsByActivities(aDate,confId); - activityDayTreeView->reset(); + static_cast(actTreeView->model())->loadEventsByActivities(aDate,confId); + actTreeView->reset(); activityDayNavigator->show(); } + +void MainWindow::itemDoubleClicked(const QModelIndex &aIndex) +{ + // have to handle only events, not time-groups + if(!aIndex.parent().isValid()) // time-group + return; + + EventDialog dialog(aIndex,this); + dialog.exec(); +} + diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 20e72a8..d319576 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -22,6 +22,7 @@ private slots: void updateFavView(); /*void updateFavViewComplete();*/ void updateActivitiesDayView(const QDate &aDate); + void itemDoubleClicked(const QModelIndex &aIndex); private: SqlEngine *mSqlEngine; ScheduleXmlParser *mXmlParser; diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index b69b00b..25b46e2 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -17,7 +17,7 @@ - 2 + 0 @@ -64,7 +64,7 @@ - + 16777215 -- 2.39.5