From ea638ef99d8ea29273c54b59f684287ce4362544 Mon Sep 17 00:00:00 2001 From: pavelpa Date: Wed, 27 Jan 2010 19:17:01 +0000 Subject: [PATCH] implemented 'conflicts' dialog - displays rooms instead of conflicts for now - needs to implement additional methods in Event, ... --- src/gui/conflictdialogcontainer.cpp | 26 ++++ src/gui/conflictdialogcontainer.h | 22 ++++ src/gui/conflictsdialog.cpp | 20 +++ src/gui/conflictsdialog.h | 18 +++ src/gui/conflictsdialog.ui | 89 +++++++++++++ src/gui/daynavigatorwidget.cpp | 1 - src/gui/gui.pro | 30 ++--- src/gui/mainwindow.ui | 193 ++++++++++++++-------------- src/gui/searchtabcontainer.cpp | 2 - src/gui/tabcontainer.cpp | 14 +- src/gui/tabcontainer.h | 2 +- src/mvc/treeview.cpp | 3 +- src/mvc/treeview.h | 2 +- src/orm/ormrecord.h | 4 +- 14 files changed, 296 insertions(+), 130 deletions(-) create mode 100644 src/gui/conflictdialogcontainer.cpp create mode 100644 src/gui/conflictdialogcontainer.h create mode 100644 src/gui/conflictsdialog.cpp create mode 100644 src/gui/conflictsdialog.h create mode 100644 src/gui/conflictsdialog.ui diff --git a/src/gui/conflictdialogcontainer.cpp b/src/gui/conflictdialogcontainer.cpp new file mode 100644 index 0000000..b09eda7 --- /dev/null +++ b/src/gui/conflictdialogcontainer.cpp @@ -0,0 +1,26 @@ + +#include "conflictdialogcontainer.h" + +ConflictDialogContainer::ConflictDialogContainer(QWidget *aParent) + : TabContainer( aParent ) +{ +} + +void ConflictDialogContainer::loadEvents( const QDate &aDate, const int aConferenceId ) +{ + static_cast(treeView->model())->loadEventsByRoom( aDate, aConferenceId ); + //treeView->setAllExpanded(true); +} + +void ConflictDialogContainer::updateTreeViewModel(int aEventId) +{ + // requires special handling + // we need to reload favourites, because some favourite could be deleted + //static_cast(favTreeView->model())->updateModel(aEventId); + int confId = Conference::activeConference(); + QDate startDate = Conference::getById(confId).start(); + QDate endDate = Conference::getById(confId).end(); + dayNavigator->setDates(startDate, endDate); + updateTreeView( Conference::getById(confId).start() ); +} + diff --git a/src/gui/conflictdialogcontainer.h b/src/gui/conflictdialogcontainer.h new file mode 100644 index 0000000..2f5c538 --- /dev/null +++ b/src/gui/conflictdialogcontainer.h @@ -0,0 +1,22 @@ + +#ifndef CONFLICTDIALOGCONTAINER_H +#define CONFLICTDIALOGCONTAINER_H + +#include "tabcontainer.h" + +class ConflictDialogContainer: public TabContainer +{ + Q_OBJECT +public: + ConflictDialogContainer(QWidget *aParent); + virtual ~ConflictDialogContainer(){} + +public slots: + virtual void updateTreeViewModel(int aEventId); + +protected: + virtual void loadEvents( const QDate &aDate, const int aConferenceId ); +}; + +#endif /* CONFLICTDIALOGCONTAINER_H */ + diff --git a/src/gui/conflictsdialog.cpp b/src/gui/conflictsdialog.cpp new file mode 100644 index 0000000..070dc9d --- /dev/null +++ b/src/gui/conflictsdialog.cpp @@ -0,0 +1,20 @@ +#include "conflictsdialog.h" + +ConflictsDialog::ConflictsDialog(QWidget *aParent) + : QDialog(aParent) +{ + setupUi(this); + connect(container, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int))); + connect(container, SIGNAL(eventHasChanged(int)), container, SLOT(updateTreeViewModel(int))); + + int confId = Conference::activeConference(); + QDate startDate = Conference::getById(confId).start(); + QDate endDate = Conference::getById(confId).end(); + container->setDates(startDate, endDate); +} + +ConflictsDialog::~ConflictsDialog() +{ + disconnect(container, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int))); +} + diff --git a/src/gui/conflictsdialog.h b/src/gui/conflictsdialog.h new file mode 100644 index 0000000..40114ab --- /dev/null +++ b/src/gui/conflictsdialog.h @@ -0,0 +1,18 @@ +#ifndef CONFLICTSDIALOG_H +#define CONFLICTSDIALOG_H + +#include "ui_conflictsdialog.h" +#include + +class ConflictsDialog : public QDialog, Ui::ConflictsDialog +{ + Q_OBJECT +public: + ConflictsDialog(QWidget *aParent = NULL); + ~ConflictsDialog(); +signals: + void eventHasChanged(int aEventId); +}; + +#endif /* CONFLICTSDIALOG_H */ + diff --git a/src/gui/conflictsdialog.ui b/src/gui/conflictsdialog.ui new file mode 100644 index 0000000..fd1de1a --- /dev/null +++ b/src/gui/conflictsdialog.ui @@ -0,0 +1,89 @@ + + ConflictsDialog + + + + 0 + 0 + 471 + 373 + + + + Dialog + + + + + + Selected Event is in conflict with the following event(s): + + + true + + + + + + + + 0 + 1 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + + + + ConflictDialogContainer + QWidget +
conflictdialogcontainer.h
+ 1 +
+
+ + + + okButton + clicked() + ConflictsDialog + close() + + + 301 + 156 + + + 175 + 89 + + + + +
diff --git a/src/gui/daynavigatorwidget.cpp b/src/gui/daynavigatorwidget.cpp index c554c1d..9a2a428 100644 --- a/src/gui/daynavigatorwidget.cpp +++ b/src/gui/daynavigatorwidget.cpp @@ -29,7 +29,6 @@ void DayNavigatorWidget::setDates(const QDate &aStartDate, const QDate &aEndDate mCurDate = aStartDate; QRect rect = mFontMetrics->boundingRect(mCurDate.toString("MMM dd yyyy")); - qDebug() << mCurDate.toString(); if(mStartDate==mEndDate) // only one day conference { diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 7fec1d3..ae85249 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -34,14 +34,17 @@ maemo { # 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). + FORMS += searchhead.ui \ mainwindow.ui \ daynavigatorwidget.ui \ importschedulewidget.ui \ about.ui \ eventdialog.ui \ + conflictsdialog.ui \ tabcontainer.ui \ mapwindow.ui + HEADERS += roomstabcontainer.h \ nowtabcontainer.h \ trackstabcontainer.h \ @@ -49,6 +52,8 @@ HEADERS += roomstabcontainer.h \ searchtabcontainer.h \ searchhead.h \ dayviewtabcontainer.h \ + conflictdialogcontainer.h \ + conflictsdialog.h \ mainwindow.h \ daynavigatorwidget.h \ importschedulewidget.h \ @@ -56,6 +61,7 @@ HEADERS += roomstabcontainer.h \ tabwidget.h \ tabcontainer.h \ mapwindow.h + SOURCES += roomstabcontainer.cpp \ nowtabcontainer.cpp \ trackstabcontainer.cpp \ @@ -63,6 +69,8 @@ SOURCES += roomstabcontainer.cpp \ searchtabcontainer.cpp \ searchhead.cpp \ dayviewtabcontainer.cpp \ + conflictdialogcontainer.cpp \ + conflictsdialog.cpp \ mainwindow.cpp \ daynavigatorwidget.cpp \ importschedulewidget.cpp \ @@ -70,23 +78,9 @@ SOURCES += roomstabcontainer.cpp \ tabwidget.cpp \ tabcontainer.cpp \ mapwindow.cpp + maemo { - FORMS += searchhead.ui \ - alarmdialog.ui - HEADERS += roomstabcontainer.h \ - nowtabcontainer.h \ - trackstabcontainer.h \ - favtabcontainer.h \ - searchtabcontainer.h \ - searchhead.h \ - dayviewtabcontainer.h \ - alarmdialog.h - SOURCES += roomstabcontainer.cpp \ - nowtabcontainer.cpp \ - trackstabcontainer.cpp \ - favtabcontainer.cpp \ - searchtabcontainer.cpp \ - searchhead.cpp \ - dayviewtabcontainer.cpp \ - alarmdialog.cpp + FORMS += alarmdialog.ui + HEADERS += alarmdialog.h + SOURCES += alarmdialog.cpp } diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 2ab2b7c..e36ef9d 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -1,8 +1,7 @@ - - + MainWindow - - + + 0 0 @@ -10,61 +9,61 @@ 498 - + 400 300 - + MainWindow - - - - - - 3 + + + + + + 0 - - + + Day View - - - + + + - - + + Favourites - - - + + + - - + + Tracks - - - + + + - - + + Search - + - - - + + + 0 0 @@ -73,126 +72,126 @@ - - + + Rooms - - - + + + - - + + Conference - - - + + + - - + + 75 true - + Conference Name - + Qt::AlignCenter - + true - - + + Conference Subtitle - + Qt::AlignCenter - + true - - + + Qt::Horizontal - - - - + + + + 75 true true - + When: - - - + + + 75 true true - + Where: - - - + + + DATE (FROM - TO) - - - + + + CITY, CAMPUS - - - + + + MAP - - + + :/icons/compassBig.png:/icons/compassBig.png - + true - - - + + + Qt::Horizontal - + 40 20 @@ -200,9 +199,9 @@ - - - + + + @@ -210,16 +209,16 @@ - - + + Qt::Horizontal - - - + + + 0 0 @@ -227,11 +226,11 @@ - - + + Qt::Vertical - + 20 40 @@ -243,13 +242,13 @@ - - + + Now - - - + + + @@ -257,7 +256,7 @@ - + @@ -304,7 +303,7 @@ - + diff --git a/src/gui/searchtabcontainer.cpp b/src/gui/searchtabcontainer.cpp index b0938a6..b69b664 100644 --- a/src/gui/searchtabcontainer.cpp +++ b/src/gui/searchtabcontainer.cpp @@ -45,8 +45,6 @@ SearchTabContainer::~SearchTabContainer() void SearchTabContainer::searchButtonClicked() { - qDebug() << "SearchTab::searchButtonClicked()"; - QHash columns; SearchHead *searchHeader = static_cast(header); diff --git a/src/gui/tabcontainer.cpp b/src/gui/tabcontainer.cpp index c03b2e1..a733824 100644 --- a/src/gui/tabcontainer.cpp +++ b/src/gui/tabcontainer.cpp @@ -10,6 +10,8 @@ #include "eventdialog.h" #include "mapwindow.h" +#include "conflictsdialog.h" + TabContainer::TabContainer(QWidget *aParent) : QWidget(aParent) { @@ -27,7 +29,7 @@ TabContainer::TabContainer(QWidget *aParent) connect(treeView, SIGNAL(eventHasChanged(int)), SIGNAL(eventHasChanged(int))); connect(treeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); connect(treeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); - connect(treeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); + connect(treeView, SIGNAL(requestForConflicts(const QModelIndex &)), SLOT(displayConflicts(const QModelIndex &))); if(!Conference::getAll().count()) // no conference(s) in the DB { @@ -81,14 +83,14 @@ void TabContainer::displayMap(const QModelIndex &aIndex) window.exec(); } -void TabContainer::displayWarning(const QModelIndex &aIndex) +void TabContainer::displayConflicts(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.") ); + ConflictsDialog dialog; + connect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int))); + dialog.exec(); + disconnect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int))); } void TabContainer::updateTreeViewModel(int aEventId) diff --git a/src/gui/tabcontainer.h b/src/gui/tabcontainer.h index 4959ce4..bcc26cf 100644 --- a/src/gui/tabcontainer.h +++ b/src/gui/tabcontainer.h @@ -35,7 +35,7 @@ protected slots: void updateTreeView(const QDate &aDate); void itemClicked(const QModelIndex &aIndex); void displayMap(const QModelIndex &aIndex); - void displayWarning(const QModelIndex &aIndex); + void displayConflicts(const QModelIndex &aIndex); }; #endif /* TABCONTAINER_H */ diff --git a/src/mvc/treeview.cpp b/src/mvc/treeview.cpp index e1dc9b7..ccc2703 100644 --- a/src/mvc/treeview.cpp +++ b/src/mvc/treeview.cpp @@ -106,8 +106,7 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP { qDebug() << "WARNING CLICKED: " << qVariantValue(aIndex.data()); - // TODO: implement - emit(requestForWarning(aIndex)); + emit(requestForConflicts(aIndex)); handled = true; } break; diff --git a/src/mvc/treeview.h b/src/mvc/treeview.h index e7cd52c..cbd4854 100644 --- a/src/mvc/treeview.h +++ b/src/mvc/treeview.h @@ -18,7 +18,7 @@ private slots: void handleItemClicked(const QModelIndex &index); signals: void requestForMap(const QModelIndex &aIndex); - void requestForWarning(const QModelIndex &aIndex); + void requestForConflicts(const QModelIndex &aIndex); void eventHasChanged(int aEventId); // emited when user changes some event details, eg. sets it Favourite }; diff --git a/src/orm/ormrecord.h b/src/orm/ormrecord.h index a815c8e..c834494 100644 --- a/src/orm/ormrecord.h +++ b/src/orm/ormrecord.h @@ -134,7 +134,7 @@ QList OrmRecord::load(QSqlQuery query) } else { - qDebug() << "SQL OK"; + /*qDebug() << "SQL OK";*/ } } @@ -143,7 +143,7 @@ QList OrmRecord::load(QSqlQuery query) { objects << hydrate(query.record()); } - qDebug() << "Fetch done"; + /*qDebug() << "Fetch done";*/ return objects; } -- 2.39.5