conference tab header is hidden if there isn't active conference
authorpavelpa <pavelpa@localhost>
Thu, 28 Jan 2010 07:29:29 +0000 (07:29 +0000)
committerpavelpa <pavelpa@localhost>
Thu, 28 Jan 2010 07:29:29 +0000 (07:29 +0000)
 - handled some warnings

src/gui/daynavigatorwidget.cpp
src/gui/mainwindow.cpp
src/gui/mainwindow.h
src/gui/mainwindow.ui
src/gui/tabwidget.cpp

index 9a2a428..b799127 100644 (file)
@@ -96,6 +96,8 @@ QDate DayNavigatorWidget::getCurrentDate()
 
 void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent)
 {
+    Q_UNUSED(aEvent);
+
     QString selectedDateStr = mCurDate.toString("MMM dd yyyy");
 
     QPainter painter(this);
index d24d964..b5882d6 100644 (file)
@@ -28,12 +28,6 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
 
     int confId = Conference::activeConference();
 
-    QList<Conference> confs = Conference::getAll();
-    if(confs.count())
-    {
-        setWindowTitle(confs[0].title());
-    }
-
     connect(importScheduleWidget, SIGNAL(scheduleImported(int)), SLOT(scheduleImported(int)));
 
     // event details have changed
@@ -44,31 +38,20 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
     connect(nowTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
     connect(searchTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
 
-
     // event conference map button clicked
     connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
 
     connect(tabWidget, SIGNAL(infoIconClicked()), SLOT(aboutApp()));
 
-    if(Conference::getAll().count()) // no conference(s) in the DB
+    if(Conference::getAll().count())
+    {
+        initTabs();
+        fillAndShowConferenceHeader();
+        setWindowTitle(Conference::getById(confId).title());
+    }
+    else
     {
-        QDate startDate = Conference::getById(confId).start();
-        QDate endDate = Conference::getById(confId).end();
-        //
-        dayTabContainer->setDates(startDate, endDate);
-        tracksTabContainer->setDates(startDate, endDate);
-        roomsTabContainer->setDates(startDate, endDate);
-        favsTabContainer->setDates(startDate, endDate);
-        searchTabContainer->setDates(startDate, endDate);
-        nowTabContainer->updateTreeView(QDate::currentDate());
-        //
-        conferenceTitle->setText(Conference::getById(confId).title());
-        conferenceSubtitle->setText(Conference::getById(confId).subtitle());
-        conferenceWhere->setText(Conference::getById(confId).city() + ", " + Conference::getById(confId).venue());
-        conferenceWhen->setText(
-                Conference::getById(confId).start().toString("dd-MM-yyyy")
-                + ", " +
-                Conference::getById(confId).end().toString("dd-MM-yyyy"));
+        conferenceHeader->hide();
     }
 
     // open dialog for given Event ID
@@ -92,13 +75,9 @@ void MainWindow::scheduleImported(int aConfId)
     QList<Conference> confs = Conference::getAll();
     if(confs.count())
     {
-        // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates
-        QDate startDate = Conference::getById(Conference::activeConference()).start();
-        QDate endDate = Conference::getById(Conference::activeConference()).end();
-        dayTabContainer->setDates(startDate, endDate);
-        tracksTabContainer->setDates(startDate, endDate);
-        roomsTabContainer->setDates(startDate, endDate);
-        favsTabContainer->setDates(startDate, endDate);
+        initTabs();
+        fillAndShowConferenceHeader();
+        setWindowTitle(Conference::getById(Conference::activeConference()).title());
     }
 }
 
@@ -133,3 +112,31 @@ void MainWindow::eventHasChanged(int aEventId)
     searchTabContainer->updateTreeViewModel(aEventId);
 }
 
+void MainWindow::fillAndShowConferenceHeader()
+{
+    int confId = Conference::activeConference();
+    conferenceTitle->setText(Conference::getById(confId).title());
+    conferenceSubtitle->setText(Conference::getById(confId).subtitle());
+    conferenceWhere->setText(Conference::getById(confId).city() + ", " + Conference::getById(confId).venue());
+    conferenceWhen->setText(
+            Conference::getById(confId).start().toString("dd-MM-yyyy")
+            + ", " +
+            Conference::getById(confId).end().toString("dd-MM-yyyy"));
+    conferenceHeader->show();
+}
+
+void MainWindow::initTabs()
+{
+    int confId = Conference::activeConference();
+    QDate startDate = Conference::getById(confId).start();
+    QDate endDate = Conference::getById(confId).end();
+
+    // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates
+    dayTabContainer->setDates(startDate, endDate);
+    tracksTabContainer->setDates(startDate, endDate);
+    roomsTabContainer->setDates(startDate, endDate);
+    favsTabContainer->setDates(startDate, endDate);
+    searchTabContainer->setDates(startDate, endDate);
+    nowTabContainer->updateTreeView(QDate::currentDate());
+}
+
index 0c40681..e5678c3 100644 (file)
@@ -18,6 +18,9 @@ private slots:
     void aboutApp();
     void conferenceMapClicked();
     void eventHasChanged(int aEventId);
+private:
+    void fillAndShowConferenceHeader();
+    void initTabs();
 };
 
 #endif /* MAINWINDOW_H */
index 804516b..86ba5b8 100644 (file)
         <item row="0" column="0" >
          <layout class="QVBoxLayout" name="verticalLayout_4" >
           <item>
-           <widget class="QLabel" name="conferenceTitle" >
-            <property name="font" >
-             <font>
-              <weight>75</weight>
-              <bold>true</bold>
-             </font>
-            </property>
-            <property name="text" >
-             <string>Conference Name</string>
-            </property>
-            <property name="alignment" >
-             <set>Qt::AlignCenter</set>
-            </property>
-            <property name="wordWrap" >
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QLabel" name="conferenceSubtitle" >
-            <property name="text" >
-             <string>Conference Subtitle</string>
-            </property>
-            <property name="alignment" >
-             <set>Qt::AlignCenter</set>
-            </property>
-            <property name="wordWrap" >
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="Line" name="line" >
-            <property name="orientation" >
-             <enum>Qt::Horizontal</enum>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <layout class="QGridLayout" name="gridLayout_6" >
-            <item row="0" column="0" >
-             <widget class="QLabel" name="label" >
-              <property name="font" >
-               <font>
-                <weight>75</weight>
-                <italic>true</italic>
-                <bold>true</bold>
-               </font>
-              </property>
-              <property name="text" >
-               <string>When:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="0" >
-             <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>Where:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="2" >
-             <widget class="QLabel" name="conferenceWhen" >
-              <property name="text" >
-               <string>DATE (FROM - TO)</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="2" >
-             <widget class="QLabel" name="conferenceWhere" >
-              <property name="text" >
-               <string>CITY, CAMPUS</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="3" >
-             <widget class="QPushButton" name="showMapButton" >
-              <property name="text" >
-               <string>MAP</string>
-              </property>
-              <property name="icon" >
-               <iconset resource="../icons.qrc" >
-                <normaloff>:/icons/compassBig.png</normaloff>:/icons/compassBig.png</iconset>
-              </property>
-              <property name="flat" >
-               <bool>true</bool>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="4" >
-             <spacer name="horizontalSpacer_3" >
-              <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 row="0" column="1" >
-             <widget class="QLabel" name="spacer" >
-              <property name="text" >
-               <string/>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </item>
-          <item>
-           <widget class="Line" name="line_2" >
-            <property name="orientation" >
-             <enum>Qt::Horizontal</enum>
-            </property>
+           <widget class="QWidget" native="1" name="conferenceHeader" >
+            <layout class="QGridLayout" name="gridLayout_9" >
+             <item row="0" column="0" >
+              <widget class="QLabel" name="conferenceTitle" >
+               <property name="font" >
+                <font>
+                 <weight>75</weight>
+                 <bold>true</bold>
+                </font>
+               </property>
+               <property name="text" >
+                <string>Conference Name</string>
+               </property>
+               <property name="alignment" >
+                <set>Qt::AlignCenter</set>
+               </property>
+               <property name="wordWrap" >
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="0" >
+              <widget class="QLabel" name="conferenceSubtitle" >
+               <property name="text" >
+                <string>Conference Subtitle</string>
+               </property>
+               <property name="alignment" >
+                <set>Qt::AlignCenter</set>
+               </property>
+               <property name="wordWrap" >
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item row="2" column="0" >
+              <widget class="Line" name="line" >
+               <property name="orientation" >
+                <enum>Qt::Horizontal</enum>
+               </property>
+              </widget>
+             </item>
+             <item row="3" column="0" >
+              <layout class="QGridLayout" name="gridLayout_6" >
+               <item row="0" column="0" >
+                <widget class="QLabel" name="label" >
+                 <property name="font" >
+                  <font>
+                   <weight>75</weight>
+                   <italic>true</italic>
+                   <bold>true</bold>
+                  </font>
+                 </property>
+                 <property name="text" >
+                  <string>When:</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="0" >
+                <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>Where:</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="0" column="2" >
+                <widget class="QLabel" name="conferenceWhen" >
+                 <property name="text" >
+                  <string>DATE (FROM - TO)</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="2" >
+                <widget class="QLabel" name="conferenceWhere" >
+                 <property name="text" >
+                  <string>CITY, CAMPUS</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="3" >
+                <widget class="QPushButton" name="showMapButton" >
+                 <property name="text" >
+                  <string>MAP</string>
+                 </property>
+                 <property name="icon" >
+                  <iconset resource="../icons.qrc" >
+                   <normaloff>:/icons/compassBig.png</normaloff>:/icons/compassBig.png</iconset>
+                 </property>
+                 <property name="flat" >
+                  <bool>true</bool>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="4" >
+                <spacer name="horizontalSpacer_3" >
+                 <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 row="0" column="1" >
+                <widget class="QLabel" name="spacer" >
+                 <property name="text" >
+                  <string/>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </item>
+             <item row="4" column="0" >
+              <widget class="Line" name="line_2" >
+               <property name="orientation" >
+                <enum>Qt::Horizontal</enum>
+               </property>
+              </widget>
+             </item>
+            </layout>
            </widget>
           </item>
           <item>
index 08634e1..ddc3126 100644 (file)
@@ -13,6 +13,8 @@ TabWidget::TabWidget(QWidget *aParent)
 
 void TabWidget::paintEvent(QPaintEvent *event)
 {
+    Q_UNUSED(event);
+
     int height = tabBar()->tabRect(currentIndex()).height();
     QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
     QPainter painter(this);