refactored Event 'details' dialog
authorpavelpa <pavelpa@localhost>
Wed, 27 Jan 2010 12:06:32 +0000 (12:06 +0000)
committerpavelpa <pavelpa@localhost>
Wed, 27 Jan 2010 12:06:32 +0000 (12:06 +0000)
 - TODO: implement 'links' method(s) in Event and use it in the dialog

src/gui/eventdialog.cpp
src/gui/eventdialog.h
src/gui/eventdialog.ui

index 5202663..6707101 100644 (file)
@@ -7,48 +7,6 @@
 #include <alarm.h>
 #endif
 
-DetailsContainer::DetailsContainer(QWidget *aParent)
-    : QWidget(aParent)
-{
-    mAbstract.setWordWrap(true);
-    mDescription.setWordWrap(true);
-
-    QFont f = QLabel().font();
-    f.setBold(true);
-    f.setItalic(true);
-    mMainLayout = new QVBoxLayout(this);
-    QLabel *persons = new QLabel("Persons:");
-    persons->setFont(f);
-    mMainLayout->addWidget(persons);
-    mMainLayout->addWidget(&mPersons);
-    mMainLayout->addWidget(new QLabel("")); // spacer
-    QLabel *abstract = new QLabel("Abstract:");
-    abstract->setFont(f);
-    mMainLayout->addWidget(abstract);
-    mMainLayout->addWidget(&mAbstract);
-    mMainLayout->addWidget(new QLabel("")); // spacer
-    QLabel *description = new QLabel("Description:");
-    description->setFont(f);
-    mMainLayout->addWidget(description);
-    mMainLayout->addWidget(&mDescription);
-    setLayout(mMainLayout);
-}
-
-void DetailsContainer::setPersons(const QStringList &aPersons)
-{
-    mPersons.setText(aPersons.join(" and "));
-}
-
-void DetailsContainer::setAbstract(const QString &aAbstract)
-{
-    mAbstract.setText(aAbstract);
-}
-
-void DetailsContainer::setDescription(const QString &aDescription)
-{
-    mDescription.setText(aDescription);
-}
-
 EventDialog::EventDialog(const int &aEventId, QWidget *aParent)
     : QDialog(aParent)
     , mEventId(aEventId)
@@ -62,10 +20,9 @@ EventDialog::EventDialog(const int &aEventId, QWidget *aParent)
     Event event = Event::getById(mEventId,AppSettings::confId());
 
     title->setText(event.title());
-    mDetails.setPersons(event.persons());
-    mDetails.setAbstract(event.abstract());
-    mDetails.setDescription(event.description());
-    scrollArea->setWidget(&mDetails);
+    persons->setText(event.persons().join(" and "));
+    abstract->setText(event.abstract());
+    description->setText(event.description());
 
     connect(favouriteButton, SIGNAL(clicked()), SLOT(favouriteClicked()));
     connect(alarmButton, SIGNAL(clicked()), SLOT(alarmClicked()));
index e9bb332..2f13f25 100644 (file)
@@ -5,20 +5,6 @@
 #include "ui_eventdialog.h"
 #include <event.h>
 
-class DetailsContainer : public QWidget
-{
-public:
-    DetailsContainer(QWidget *aParent = NULL);
-    void setPersons(const QStringList &aPersons);
-    void setAbstract(const QString &aAbstract);
-    void setDescription(const QString &aDescription);
-private:
-    QBoxLayout *mMainLayout;
-    QLabel mPersons;
-    QLabel mAbstract;
-    QLabel mDescription;
-};
-
 class EventDialog : public QDialog, Ui::EventDialog
 { 
     Q_OBJECT
@@ -32,7 +18,6 @@ signals:
     void eventHasChanged(int aEventId); // emited when user changes some event details, eg. sets it Favourite
 private:
     int mEventId;
-    DetailsContainer mDetails;
 };
 
 #endif /* EVENTDIALOG_H */
index fcc7f5c..5aceca0 100644 (file)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>442</width>
-    <height>380</height>
+    <height>391</height>
    </rect>
   </property>
   <property name="sizePolicy" >
           <x>0</x>
           <y>0</y>
           <width>418</width>
-          <height>294</height>
+          <height>305</height>
          </rect>
         </property>
+        <layout class="QGridLayout" name="gridLayout_2" >
+         <item row="0" column="0" >
+          <widget class="QWidget" native="1" name="content" >
+           <layout class="QVBoxLayout" name="verticalLayout_2" >
+            <item>
+             <widget class="QLabel" name="label" >
+              <property name="font" >
+               <font>
+                <weight>75</weight>
+                <italic>true</italic>
+                <bold>true</bold>
+               </font>
+              </property>
+              <property name="text" >
+               <string>Persons:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="persons" >
+              <property name="text" >
+               <string>PERSONS</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>true</bool>
+              </property>
+              <property name="openExternalLinks" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="spacer" >
+              <property name="text" >
+               <string/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_2" >
+              <property name="font" >
+               <font>
+                <weight>75</weight>
+                <italic>true</italic>
+                <bold>true</bold>
+               </font>
+              </property>
+              <property name="text" >
+               <string>Abstract:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="abstract" >
+              <property name="text" >
+               <string>ABSTRACT</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>true</bool>
+              </property>
+              <property name="openExternalLinks" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="spacer_2" >
+              <property name="text" >
+               <string/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_4" >
+              <property name="font" >
+               <font>
+                <weight>75</weight>
+                <italic>true</italic>
+                <bold>true</bold>
+               </font>
+              </property>
+              <property name="text" >
+               <string>Description:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="description" >
+              <property name="text" >
+               <string>DESCRIPTION</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>true</bool>
+              </property>
+              <property name="openExternalLinks" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="spacer_3" >
+              <property name="text" >
+               <string/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_3" >
+              <property name="font" >
+               <font>
+                <weight>75</weight>
+                <italic>true</italic>
+                <bold>true</bold>
+               </font>
+              </property>
+              <property name="text" >
+               <string>Links:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="links" >
+              <property name="text" >
+               <string>LINKS</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>true</bool>
+              </property>
+              <property name="openExternalLinks" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </item>
+         <item row="1" column="0" >
+          <spacer name="verticalSpacer" >
+           <property name="orientation" >
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
        </widget>
       </widget>
      </item>