implemented 'Event' dialog to display relevant
authorpavelpa <pavelpa@localhost>
Mon, 18 Jan 2010 19:42:57 +0000 (19:42 +0000)
committerpavelpa <pavelpa@localhost>
Mon, 18 Jan 2010 19:42:57 +0000 (19:42 +0000)
'Event's info

src/gui/eventdialog.cpp [new file with mode: 0644]
src/gui/eventdialog.h [new file with mode: 0644]
src/gui/eventdialog.ui [new file with mode: 0644]
src/gui/gui.pro
src/gui/mainwindow.cpp
src/gui/mainwindow.h
src/gui/mainwindow.ui

diff --git a/src/gui/eventdialog.cpp b/src/gui/eventdialog.cpp
new file mode 100644 (file)
index 0000000..8dd8f79
--- /dev/null
@@ -0,0 +1,14 @@
+#include "eventdialog.h"
+
+EventDialog::EventDialog(const QModelIndex &aIndex, QWidget *aParent)
+    : QDialog(aParent)
+    , mIndex(aIndex)
+{
+    setupUi(this);
+    Event *event = static_cast<Event *>(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 (file)
index 0000000..ac99380
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef EVENTDIALOG_H
+#define EVENTDIALOG_H
+
+#include <QDialog>
+#include <QModelIndex>
+#include "ui_eventdialog.h"
+#include <event.h>
+
+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 (file)
index 0000000..33b00c0
--- /dev/null
@@ -0,0 +1,110 @@
+<ui version="4.0" >
+ <class>EventDialog</class>
+ <widget class="QDialog" name="EventDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>339</width>
+    <height>250</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Dialog</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" >
+   <item row="0" column="0" >
+    <layout class="QVBoxLayout" name="verticalLayout" >
+     <item>
+      <widget class="QLabel" name="title" >
+       <property name="text" >
+        <string>Here goes title</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <layout class="QGridLayout" name="gridLayout_2" >
+       <item row="1" column="1" >
+        <widget class="QLabel" name="label_2" >
+         <property name="text" >
+          <string>Presenter(s):</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="2" >
+        <widget class="QLabel" name="persons" >
+         <property name="text" >
+          <string>Here go persons</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1" >
+        <widget class="QLabel" name="label_3" >
+         <property name="text" >
+          <string>Abstract:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="2" >
+        <widget class="QPlainTextEdit" name="abstract" />
+       </item>
+       <item row="3" column="1" >
+        <widget class="QLabel" name="label" >
+         <property name="text" >
+          <string>Description:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="2" >
+        <widget class="QPlainTextEdit" name="description" />
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout" >
+       <item>
+        <spacer name="horizontalSpacer" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="okButton" >
+         <property name="text" >
+          <string>OK</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>okButton</sender>
+   <signal>clicked()</signal>
+   <receiver>EventDialog</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>287</x>
+     <y>84</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>169</x>
+     <y>53</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 65b569fd62d1d51c57b7fcb83cb6e00c834f2eda..1139109d7fc836335899c3da1a652ee4e96de78e 100644 (file)
@@ -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
index b527e4881842c33f1c3bb32abad5fae1dfc9c5ba..5aac872a58b9d3d71499107693a7517bc605d51b 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <QDialog>
 #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<EventModel*>(activityDayTreeView->model())->loadEventsByActivities(aDate,confId);
-    activityDayTreeView->reset();
+    static_cast<EventModel*>(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();
+}
+
index 20e72a8e3933fdafc3b134c2d69646f7b6502b75..d31957619913ad9129e857550b8a16e22f1a8d03 100644 (file)
@@ -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;
index b69b00bb59e0445cfd6dd86c46c13d915c364a8a..25b46e20fbd770cac616712c0aa29d465bfdfc64 100644 (file)
@@ -17,7 +17,7 @@
     <item row="0" column="0" >
      <widget class="QTabWidget" name="tabWidget" >
       <property name="currentIndex" >
-       <number>2</number>
+       <number>0</number>
       </property>
       <widget class="QWidget" name="dayViewTab" >
        <attribute name="title" >
@@ -64,7 +64,7 @@
            <widget class="DayNavigatorWidget" native="1" name="activityDayNavigator" />
           </item>
           <item>
-           <widget class="TreeView" name="activityDayTreeView" >
+           <widget class="TreeView" name="actTreeView" >
             <property name="maximumSize" >
              <size>
               <width>16777215</width>