alarm dialog changes
authorpavelpa <pavelpa@localhost>
Wed, 20 Jan 2010 19:29:00 +0000 (19:29 +0000)
committerpavelpa <pavelpa@localhost>
Wed, 20 Jan 2010 19:29:00 +0000 (19:29 +0000)
 - displayed additional Event's details
 - autoresizing title (if it doesn't fit in one line)

src/gui/alarmdialog.cpp
src/gui/alarmdialog.ui

index e54bc6f..da494e2 100644 (file)
@@ -40,25 +40,38 @@ AlarmDialog::AlarmDialog(int argc, char *argv[], QWidget *aParent)
     database.setDatabaseName(QDir::homePath() + "/.fosdem/fosdem.sqlite");
     database.open();
 
+    QString titleStr;
+    QString messageStr;
+    QString timeStr;
+    QString personsStr;
+    QString roomStr;
     try
     {
         Event event = Event::getById(mEventId,confId);
-        message->setText(event.title());
-        setWindowTitle(event.title());
+        titleStr = "Event alarm";
+        messageStr = event.title();
+        timeStr = event.start().toString("hh:mm") + "-" + event.start().addSecs(event.duration()).toString("hh:mm");
+        personsStr = event.persons().join(" and ");
+        roomStr = event.room();
     }
     catch(OrmNoObjectException*)
     {
-        message->setText(QString("No such event in the DB: %1").arg(QString::number(mEventId)));
-        setWindowTitle("ERROR");
+        titleStr = QString("ERROR");
+        messageStr = QString("No such event in the DB: %1").arg(QString::number(mEventId));
     }
     catch(...) {} // TODO: implement
+    message->setText(messageStr);
+    setWindowTitle(titleStr);
+    time->setText(timeStr);
+    persons->setText(personsStr);
+    room->setText(roomStr);
 }
 
 void AlarmDialog::runApp()
 {
     QString program = QDir::currentPath() + "/" + *qApp->argv();
     QProcess::startDetached(program,QStringList()<<QString::number(mEventId));
-    qApp->quit();
+    closeDialog();
 }
 
 void AlarmDialog::snooze()
index eabdbd7..d0bd806 100644 (file)
@@ -5,10 +5,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>337</width>
-    <height>151</height>
+    <width>406</width>
+    <height>176</height>
    </rect>
   </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle" >
    <string>Dialog</string>
   </property>
     <layout class="QVBoxLayout" name="verticalLayout" >
      <item>
       <widget class="QLabel" name="message" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
        <property name="text" >
         <string>Alarm message goes here</string>
        </property>
            </property>
           </widget>
          </item>
-         <item row="1" column="2" >
+         <item row="1" column="3" >
           <widget class="QLabel" name="persons" >
            <property name="text" >
             <string>PRESETNER(S)</string>
            </property>
           </widget>
          </item>
-         <item row="0" column="2" >
+         <item row="0" column="3" >
           <widget class="QLabel" name="time" >
            <property name="text" >
             <string>TIME</string>
            </property>
           </widget>
          </item>
-         <item row="2" column="2" >
+         <item row="2" column="3" >
           <widget class="QLabel" name="room" >
            <property name="text" >
             <string>ROOM</string>
            </property>
           </widget>
          </item>
+         <item row="1" column="0" >
+          <widget class="QLabel" name="label_5" >
+           <property name="text" >
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="2" >
+          <widget class="QLabel" name="label_6" >
+           <property name="text" >
+            <string/>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>