FORMS += mainwindow.ui \
daynavigatorwidget.ui \
about.ui \
- eventdialog.ui
+ eventdialog.ui \
+ mapwindow.ui
HEADERS += mainwindow.h \
daynavigatorwidget.h \
- eventdialog.h
+ eventdialog.h \
+ mapwindow.h
SOURCES += mainwindow.cpp \
daynavigatorwidget.cpp \
- eventdialog.cpp
+ eventdialog.cpp \
+ mapwindow.cpp
maemo {
FORMS += alarmdialog.ui
#include "ui_about.h"
#include "eventdialog.h"
#include "daynavigatorwidget.h"
+#include "mapwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
actTreeView->setModel(new EventModel());
actTreeView->setItemDelegate(new Delegate(actTreeView));
+ // event double clicked
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 &)));
+ // 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 &)));
+
// TESTING: load some 'fav' data
if(Conference::getAll().count()) // no conference(s) in the DB
QFile file("../schedule.en.xml");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
- QString currPath = QDir::currentPath();
- qDebug() << "current path: " << currPath;
qDebug() << "can't open " << file.fileName();
return;
}
dialog.exec();
}
+void MainWindow::displayMap(const QModelIndex &aIndex)
+{
+ QPixmap map(":/maps/rooms/janson.png");
+ MapWindow window(map,this);
+ window.exec();
+}
+
/*void updateFavViewComplete();*/
void updateActivitiesDayView(const QDate &aDate);
void itemDoubleClicked(const QModelIndex &aIndex);
+ void displayMap(const QModelIndex &aIndex);
private:
SqlEngine *mSqlEngine;
ScheduleXmlParser *mXmlParser;
--- /dev/null
+#include "mapwindow.h"
+
+MapWindow::MapWindow(const QPixmap &aImage, QWidget *aParent)
+ : QDialog(aParent)
+{
+ setupUi(this);
+ setMouseTracking(true); // to receive mouse events
+ map->setPixmap(aImage);
+}
+
+void MapWindow::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ close();
+}
+
--- /dev/null
+#ifndef MAPWINDOW_H
+#define MAPWINDOW_H
+
+#include <QDialog>
+#include <QPixmap>
+#include "ui_mapwindow.h"
+
+class MapWindow : public QDialog, Ui::MapWindow
+{
+public:
+ MapWindow(const QPixmap &aImage, QWidget *aParent = NULL);
+ ~MapWindow() {}
+protected:
+ virtual void mouseDoubleClickEvent(QMouseEvent *event);
+};
+
+#endif /* MAPWINDOW_H */
+
--- /dev/null
+<ui version="4.0" >
+ <class>MapWindow</class>
+ <widget class="QDialog" name="MapWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>298</width>
+ <height>179</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="map" >
+ <property name="text" >
+ <string>Map goes here</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>map</zorder>
+ <zorder>toolButton</zorder>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
{
mGroups.last().mChildCount = i - mGroups.last().mFirstEventIndex;
mGroups << EventModel::Group(QString("activity %1").arg(activityId), 0);
- int nextActivityId = activityId;
+ //int nextActivityId = activityId;
}
// add parent-child relation
mParents[mEvents.at(i).id()] = mGroups.count() - 1;
QModelIndex idx = index(i, 0);
Group group = mGroups[i];
beginRemoveRows(idx, 0, group.mChildCount - 1);
- bool ok = removeRows(0, group.mChildCount, idx);
+ /*bool ok =*/ removeRows(0, group.mChildCount, idx);
endRemoveRows();
//qDebug() << "removing " << group.mChildCount << " events from group:" << i << idx.data() << ":" << ok;
}
{
// handle Alarm Control clicked
qDebug() << "MAP CLICKED: " << qVariantValue<QString>(aIndex.data());
+ emit(requestForMap(aIndex));
}
break;
case Delegate::ControlNone:
#include <QTreeView>
-
class TreeView : public QTreeView
{
+ Q_OBJECT
public:
TreeView(QWidget *aParent = NULL);
~TreeView() {}
private:
void mouseReleaseEvent(QMouseEvent *aEvent);
void testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint);
+signals:
+ void requestForMap(const QModelIndex &aIndex);
};
#endif /* TREEVIEW_H */