Added search results header to RoutingPanel.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Wed, 11 Aug 2010 11:05:02 +0000 (14:05 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Wed, 11 Aug 2010 11:05:02 +0000 (14:05 +0300)
src/ui/friendlistpanel.cpp
src/ui/routingpanel.cpp
src/ui/routingpanel.h

index 5aeec03..8fcbc57 100644 (file)
@@ -38,7 +38,6 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     QVBoxLayout *friendListPanelLayout = new QVBoxLayout();
     friendListPanelLayout->setMargin(0);
     friendListPanelLayout->setSpacing(0);
-    friendListPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
     setLayout(friendListPanelLayout);
 
     QHBoxLayout *filterLayout = new QHBoxLayout();
@@ -63,8 +62,12 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     m_friendListView = new FriendListView(this);
     m_friendListView->setItemDelegate(new FriendListItemDelegate(this));
 
+    QVBoxLayout *listViewLayout = new QVBoxLayout;
+    listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+    listViewLayout->addWidget(m_friendListView);
+
     friendListPanelLayout->addWidget(m_friendListHeaderWidget);
-    friendListPanelLayout->addWidget(m_friendListView);
+    friendListPanelLayout->addLayout(listViewLayout);
 
     connect(m_friendListView, SIGNAL(friendItemClicked(GeoCoordinate)),
             this, SIGNAL(findFriend(GeoCoordinate)));
index 1144145..6479f5f 100644 (file)
@@ -13,12 +13,36 @@ RoutingPanel::RoutingPanel(QWidget *parent)
     qDebug() << __PRETTY_FUNCTION__;
 
     QVBoxLayout *routingLayout = new QVBoxLayout;
-    routingLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+    routingLayout->setMargin(0);
+    routingLayout->setSpacing(0);
     setLayout(routingLayout);
 
+    QHBoxLayout *headerLayout = new QHBoxLayout();
+    headerLayout->setContentsMargins(FRIENDPANEL_FILTER_MARGIN_LEFT, 0,
+                                     FRIENDPANEL_FILTER_MARGIN_RIGHT, 0);
+
+    QVBoxLayout *listViewLayout = new QVBoxLayout;
+    listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+
+    m_locationListHeaderWidget = new QWidget();
+    m_locationListHeaderWidget->setLayout(headerLayout);
+    m_locationListHeaderWidget->setAutoFillBackground(true);
+    QPalette labelPalette = m_locationListHeaderWidget->palette();
+    labelPalette.setColor(QPalette::Background, Qt::black);
+    m_locationListHeaderWidget->setPalette(labelPalette);
+    m_locationListHeaderWidget->hide();
+
+    m_locationListLabel = new QLabel(this);
+
     m_locationListView = new LocationListView(this);
     m_locationListView->setItemDelegate(new ExtendedListItemDelegate(this));
-    routingLayout->addWidget(m_locationListView);
+
+    headerLayout->addWidget(m_locationListLabel, 0, Qt::AlignCenter);
+
+    listViewLayout->addWidget(m_locationListView);
+
+    routingLayout->addWidget(m_locationListHeaderWidget);
+    routingLayout->addLayout(listViewLayout);
 
     connect(m_locationListView, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)),
             this, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)));
@@ -28,6 +52,9 @@ void RoutingPanel::populateLocationListView(QList<Location> &locations)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    m_locationListHeaderWidget->show();
+    m_locationListLabel->setText(tr("Search results: %1").arg(locations.count()));
+
     m_locationListView->clearList();
 
     for (int i = 0; i < locations.size(); ++i) {
index 73cb03f..66bbcfa 100644 (file)
@@ -73,6 +73,9 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
+    QLabel *m_locationListLabel;          ///< Location list label
+    QWidget *m_locationListHeaderWidget;  ///< Location list header widget
+
     LocationListView *m_locationListView;   ///< Location list view
 };