GUI work on Event Details dialog
authorpavelpa <pavelpa@localhost>
Mon, 25 Jan 2010 11:07:00 +0000 (11:07 +0000)
committerpavelpa <pavelpa@localhost>
Mon, 25 Jan 2010 11:07:00 +0000 (11:07 +0000)
src/gui/eventdialog.cpp
src/gui/eventdialog.h
src/gui/eventdialog.ui

index df67695..8d11d15 100644 (file)
@@ -3,6 +3,48 @@
 
 #include <QScrollBar>
 
+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)
@@ -15,28 +57,10 @@ EventDialog::EventDialog(const int &aEventId, QWidget *aParent)
 
     Event event = Event::getById(aEventId,AppSettings::confId());
 
-    //abstract->setStyleSheet("background-color : transparent;");
-    //description->setStyleSheet("background-color : transparent;");
-
-    // use text color from 'title' QLabel
-    QColor color = title->palette().color(QPalette::Active, QPalette::WindowText);
-    QColor bkgrColor = this->palette().color(QPalette::Active, QPalette::Background);
-    QPalette p = abstract->palette();
-    p.setColor(QPalette::Active, QPalette::Text, color);
-    p.setColor(QPalette::Active, QPalette::Base, bkgrColor);
-    abstract->setPalette(p);
-    description->setPalette(p);
-
-    // set scrollbars color
-    //QPalette p2 = description->verticalScrollBar()->palette();
-    //p2.setColor(QPalette::Active, QPalette::Background, color);
-    ////description->verticalScrollBar()->setStyleSheet("background-color : blue;");
-    //abstract->verticalScrollBar()->setPalette(p2);
-    //description->verticalScrollBar()->setPalette(p2);
-
     title->setText(event.title());
-    persons->setText(event.persons().join(" and "));
-    abstract->setPlainText(event.abstract());
-    description->setPlainText(event.description());
+    mDetails.setPersons(event.persons());
+    mDetails.setAbstract(event.abstract());
+    mDetails.setDescription(event.description());
+    scrollArea->setWidget(&mDetails);
 }
 
index e8aaab2..0616fda 100644 (file)
@@ -5,6 +5,21 @@
 #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
 { 
 public:
@@ -12,6 +27,7 @@ public:
     ~EventDialog() {}
 private:
     int mEventId;
+    DetailsContainer mDetails;
 };
 
 #endif /* EVENTDIALOG_H */
index beff0a1..3610861 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>468</width>
-    <height>496</height>
+    <width>442</width>
+    <height>380</height>
    </rect>
   </property>
   <property name="sizePolicy" >
@@ -27,7 +27,7 @@
      <item>
       <widget class="QLabel" name="title" >
        <property name="sizePolicy" >
-        <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
+        <sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -36,6 +36,7 @@
         <font>
          <weight>75</weight>
          <bold>true</bold>
+         <underline>true</underline>
         </font>
        </property>
        <property name="text" >
       </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>persons go here</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1" >
-        <widget class="QLabel" name="label_3" >
-         <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" >
-         <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" >
-         <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>
+      <widget class="QScrollArea" name="scrollArea" >
+       <property name="widgetResizable" >
+        <bool>true</bool>
+       </property>
+       <widget class="QWidget" name="scrollAreaWidgetContents" >
+        <property name="geometry" >
+         <rect>
+          <x>0</x>
+          <y>0</y>
+          <width>418</width>
+          <height>296</height>
+         </rect>
+        </property>
+       </widget>
+      </widget>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout" >