event-dialog - displayed persons/presenters names
authorpavelpa <pavelpa@localhost>
Tue, 19 Jan 2010 19:44:23 +0000 (19:44 +0000)
committerpavelpa <pavelpa@localhost>
Tue, 19 Jan 2010 19:44:23 +0000 (19:44 +0000)
 - implemented Event::persons() method to get persons names
   associated with the given event ID

src/gui/eventdialog.cpp
src/gui/eventdialog.ui
src/gui/mainwindow.ui
src/mvc/event.cpp
src/mvc/event.h

index 8dd8f79..dbd277d 100644 (file)
@@ -1,13 +1,19 @@
 #include "eventdialog.h"
 
+#include <QDebug>
+
 EventDialog::EventDialog(const QModelIndex &aIndex, QWidget *aParent)
     : QDialog(aParent)
     , mIndex(aIndex)
 {
     setupUi(this);
+
+    abstract->setStyleSheet("background-color : transparent;");
+    description->setStyleSheet("background-color : transparent;");
+
     Event *event = static_cast<Event *>(mIndex.internalPointer());
     title->setText(event->title());
-    persons->setText(QString::number(event->id()));
+    persons->setText(event->persons().join(" and "));
     abstract->setPlainText(event->abstract());
     description->setPlainText(event->description());
 }
index 33b00c0..4955acb 100644 (file)
@@ -5,13 +5,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>339</width>
-    <height>250</height>
+    <width>445</width>
+    <height>298</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Dialog</string>
   </property>
+  <property name="autoFillBackground" >
+   <bool>false</bool>
+  </property>
   <layout class="QGridLayout" name="gridLayout" >
    <item row="0" column="0" >
     <layout class="QVBoxLayout" name="verticalLayout" >
@@ -34,7 +37,7 @@
        <item row="1" column="2" >
         <widget class="QLabel" name="persons" >
          <property name="text" >
-          <string>Here go persons</string>
+          <string>persons go here</string>
          </property>
         </widget>
        </item>
          <property name="text" >
           <string>Abstract:</string>
          </property>
+         <property name="alignment" >
+          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+         </property>
         </widget>
        </item>
        <item row="2" column="2" >
-        <widget class="QPlainTextEdit" name="abstract" />
+        <widget class="QPlainTextEdit" name="abstract" >
+         <property name="autoFillBackground" >
+          <bool>false</bool>
+         </property>
+         <property name="frameShape" >
+          <enum>QFrame::NoFrame</enum>
+         </property>
+         <property name="frameShadow" >
+          <enum>QFrame::Plain</enum>
+         </property>
+         <property name="lineWidth" >
+          <number>1</number>
+         </property>
+         <property name="readOnly" >
+          <bool>true</bool>
+         </property>
+         <property name="backgroundVisible" >
+          <bool>false</bool>
+         </property>
+         <property name="centerOnScroll" >
+          <bool>false</bool>
+         </property>
+        </widget>
        </item>
        <item row="3" column="1" >
         <widget class="QLabel" name="label" >
          <property name="text" >
           <string>Description:</string>
          </property>
+         <property name="alignment" >
+          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+         </property>
         </widget>
        </item>
        <item row="3" column="2" >
-        <widget class="QPlainTextEdit" name="description" />
+        <widget class="QPlainTextEdit" name="description" >
+         <property name="frameShape" >
+          <enum>QFrame::NoFrame</enum>
+         </property>
+         <property name="frameShadow" >
+          <enum>QFrame::Plain</enum>
+         </property>
+         <property name="readOnly" >
+          <bool>true</bool>
+         </property>
+        </widget>
        </item>
       </layout>
      </item>
index e9d255e..024a1a3 100644 (file)
@@ -1,8 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
+<ui version="4.0" >
  <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
+ <widget class="QMainWindow" name="MainWindow" >
+  <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
     <height>373</height>
    </rect>
   </property>
-  <property name="minimumSize">
+  <property name="minimumSize" >
    <size>
     <width>400</width>
     <height>300</height>
    </size>
   </property>
-  <property name="windowTitle">
+  <property name="windowTitle" >
    <string>MainWindow</string>
   </property>
-  <widget class="QWidget" name="centralwidget">
-   <layout class="QGridLayout" name="gridLayout">
-    <item row="0" column="0">
-     <widget class="QTabWidget" name="tabWidget">
-      <property name="currentIndex">
-       <number>1</number>
+  <widget class="QWidget" name="centralwidget" >
+   <layout class="QGridLayout" name="gridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget" >
+      <property name="currentIndex" >
+       <number>0</number>
       </property>
-      <widget class="QWidget" name="dayViewTab">
-       <attribute name="title">
+      <widget class="QWidget" name="dayViewTab" >
+       <attribute name="title" >
         <string>Day View</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_2">
-        <item row="0" column="0">
-         <layout class="QVBoxLayout" name="verticalLayout">
+       <layout class="QGridLayout" name="gridLayout_2" >
+        <item row="0" column="0" >
+         <layout class="QVBoxLayout" name="verticalLayout" >
           <item>
-           <widget class="DayNavigatorWidget" name="dayNavigator" native="true"/>
+           <widget class="DayNavigatorWidget" native="1" name="dayNavigator" />
           </item>
           <item>
-           <widget class="TreeView" name="dayTreeView">
-            <property name="maximumSize">
+           <widget class="TreeView" name="dayTreeView" >
+            <property name="maximumSize" >
              <size>
               <width>16777215</width>
               <height>16777215</height>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="favouritesTab">
-       <attribute name="title">
+      <widget class="QWidget" name="favouritesTab" >
+       <attribute name="title" >
         <string>Favourites</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_3">
-        <item row="0" column="0">
-         <layout class="QVBoxLayout" name="verticalLayout_2">
+       <layout class="QGridLayout" name="gridLayout_3" >
+        <item row="0" column="0" >
+         <layout class="QVBoxLayout" name="verticalLayout_2" >
           <item>
-           <widget class="DayNavigatorWidget" name="favouriteDayNavigator" native="true"/>
+           <widget class="DayNavigatorWidget" native="1" name="favouriteDayNavigator" />
           </item>
           <item>
-           <widget class="TreeView" name="favTreeView"/>
+           <widget class="TreeView" name="favTreeView" />
           </item>
          </layout>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="activitiesTab">
-       <attribute name="title">
+      <widget class="QWidget" name="activitiesTab" >
+       <attribute name="title" >
         <string>Activities</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_4">
-        <item row="0" column="0">
-         <layout class="QVBoxLayout" name="activitiesVerticalLayout">
+       <layout class="QGridLayout" name="gridLayout_4" >
+        <item row="0" column="0" >
+         <layout class="QVBoxLayout" name="activitiesVerticalLayout" >
           <item>
-           <widget class="DayNavigatorWidget" name="activityDayNavigator" native="true"/>
+           <widget class="DayNavigatorWidget" native="1" name="activityDayNavigator" />
           </item>
           <item>
-           <widget class="TreeView" name="actTreeView">
-            <property name="maximumSize">
+           <widget class="TreeView" name="actTreeView" >
+            <property name="maximumSize" >
              <size>
               <width>16777215</width>
               <height>16777215</height>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="searchTab">
-       <attribute name="title">
+      <widget class="QWidget" name="searchTab" >
+       <attribute name="title" >
         <string>Search</string>
        </attribute>
       </widget>
-      <widget class="QWidget" name="mapTab">
-       <attribute name="title">
+      <widget class="QWidget" name="mapTab" >
+       <attribute name="title" >
         <string>Map</string>
        </attribute>
       </widget>
     </item>
    </layout>
   </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
+  <widget class="QMenuBar" name="menubar" >
+   <property name="geometry" >
     <rect>
      <x>0</x>
      <y>0</y>
      <width>531</width>
-     <height>24</height>
+     <height>22</height>
     </rect>
    </property>
-   <widget class="QMenu" name="menuFile">
-    <property name="title">
+   <widget class="QMenu" name="menuFile" >
+    <property name="title" >
      <string>File</string>
     </property>
-    <addaction name="actionImportSchedule"/>
-    <addaction name="actionQuit"/>
+    <addaction name="actionImportSchedule" />
+    <addaction name="actionQuit" />
    </widget>
-   <widget class="QMenu" name="menuAbout">
-    <property name="title">
+   <widget class="QMenu" name="menuAbout" >
+    <property name="title" >
      <string>Help</string>
     </property>
-    <addaction name="actionAboutQt"/>
-    <addaction name="actionAboutApplication"/>
+    <addaction name="actionAboutQt" />
+    <addaction name="actionAboutApplication" />
    </widget>
-   <addaction name="menuAbout"/>
-   <addaction name="menuFile"/>
+   <addaction name="menuAbout" />
+   <addaction name="menuFile" />
   </widget>
-  <widget class="QStatusBar" name="statusbar"/>
-  <action name="actionImportSchedule">
-   <property name="text">
+  <widget class="QStatusBar" name="statusbar" />
+  <action name="actionImportSchedule" >
+   <property name="text" >
     <string>Import Schedule</string>
    </property>
   </action>
-  <action name="actionAboutQt">
-   <property name="text">
+  <action name="actionAboutQt" >
+   <property name="text" >
     <string>About Qt</string>
    </property>
   </action>
-  <action name="actionAboutApplication">
-   <property name="text">
+  <action name="actionAboutApplication" >
+   <property name="text" >
     <string>About application</string>
    </property>
   </action>
-  <action name="actionQuit">
-   <property name="text">
+  <action name="actionQuit" >
+   <property name="text" >
     <string>Quit</string>
    </property>
   </action>
    <receiver>MainWindow</receiver>
    <slot>close()</slot>
    <hints>
-    <hint type="sourcelabel">
+    <hint type="sourcelabel" >
      <x>-1</x>
      <y>-1</y>
     </hint>
-    <hint type="destinationlabel">
+    <hint type="destinationlabel" >
      <x>266</x>
      <y>187</y>
     </hint>
index d2c31c4..18b6e33 100644 (file)
@@ -72,6 +72,7 @@ QList<Event> Event::getFavByDate(const QDate& date, int conferenceId)
 QString Event::room() const
 {
     QSqlQuery query;
+    // TODO: conference ID isn't used here
     query.prepare("SELECT name FROM room WHERE id = (SELECT xid_room FROM event_room WHERE xid_event = :id)");
     query.bindValue(":id", id());
     query.exec();
@@ -83,9 +84,36 @@ QString Event::room() const
         return QString("not-available");
 }
 
+QStringList Event::persons() const
+{
+    QSqlQuery query;
+    // TODO: conference ID isn't used here
+    query.prepare("SELECT person.name FROM person INNER JOIN event_person ON person.id = event_person.xid_person AND event_person.xid_event = :id");
+    query.bindValue(":id", id());
+    query.exec();
+    // TODO: handle qeury error
+    //qDebug() << query.lastError();
+
+    QStringList persons;
+    while(query.next())
+        persons.append(query.record().value("name").toString());
+
+    return persons;
+}
+
 void Event::setRoom(const QString &room)
 {
+    Q_UNUSED(room);
+
     qWarning("WARINING: setRoom() is NOT IMPLEMENTED YET");
     // TODO: implement
 }
 
+void Event::setPersons(const QStringList &persons)
+{
+    Q_UNUSED(persons);
+
+    qWarning("WARINING: setPersons() is NOT IMPLEMENTED YET");
+    // TODO: implement
+}
+
index 781345d..97d97a7 100644 (file)
@@ -48,6 +48,7 @@ public:
     QString description() const { return value("description").toString(); }
     // records from other tables associated with 'id'
     QString room() const;
+    QStringList persons() const;
 
     // Table 1
     void setId(int id) { setValue("id", id); }
@@ -67,6 +68,7 @@ public:
     void setDescription(const QString& description) { setValue("description", description); }
     // records from other tables associated with 'id'
     void setRoom(const QString& room);
+    void setPersons(const QStringList &persons);
 
 friend class EventTest;
 };