Merge branch 'master' into new_panels_with_context_buttons
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Fri, 20 Aug 2010 09:25:16 +0000 (12:25 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Fri, 20 Aug 2010 09:25:16 +0000 (12:25 +0300)
Conflicts:
src/ui/userinfo.cpp

28 files changed:
images.qrc
res/images/filtered.png [new file with mode: 0644]
res/images/filtered_s.png [new file with mode: 0644]
res/images/panel_context_button_bar_tile.png [new file with mode: 0644]
res/images/panel_context_button_bar_top.png [new file with mode: 0644]
res/images/route_to_friend.png [new file with mode: 0644]
res/images/route_to_friend_s.png [new file with mode: 0644]
res/images/route_to_location.png [new file with mode: 0644]
res/images/route_to_location_s.png [new file with mode: 0644]
res/images/search.png [new file with mode: 0644]
res/images/search_s.png [new file with mode: 0644]
res/images/show_position.png [deleted file]
res/images/show_position_s.png [deleted file]
src/src.pro
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/panelbase.cpp [new file with mode: 0644]
src/ui/panelbase.h [new file with mode: 0644]
src/ui/panelcontextbuttonbar.cpp [new file with mode: 0644]
src/ui/panelcontextbuttonbar.h [new file with mode: 0644]
src/ui/routingpanel.cpp
src/ui/routingpanel.h
src/ui/tabbedpanel.cpp
src/ui/tabbedpanel.h
src/ui/userinfo.cpp
src/ui/userinfo.h
src/ui/userinfopanel.cpp
src/ui/userinfopanel.h

index 01708f4..11917e1 100644 (file)
@@ -15,6 +15,8 @@
         <file>res/images/clock.png</file>
         <file>res/images/compass.png</file>
         <file>res/images/envelope.png</file>
+        <file>res/images/filtered.png</file>
+        <file>res/images/filtered_s.png</file>
         <file>res/images/friend_group.png</file>
         <file>res/images/friend_list.png</file>
         <file>res/images/gps_position.png</file>
         <file>res/images/menu_bar_drop_shadow.png</file>
         <file>res/images/own_location.png</file>
         <file>res/images/panel_bar_tile.png</file>
+        <file>res/images/panel_context_button_bar_tile.png</file>
+        <file>res/images/panel_context_button_bar_top.png</file>
         <file>res/images/profile_pic_border.png</file>
         <file>res/images/refresh.png</file>
         <file>res/images/refresh_s.png</file>
         <file>res/images/rocket_icon_gray.png</file>
         <file>res/images/routing.png</file>
+        <file>res/images/route_to_friend.png</file>
+        <file>res/images/route_to_friend_s.png</file>
+        <file>res/images/route_to_location.png</file>
+        <file>res/images/route_to_location_s.png</file>
         <file>res/images/ruler.png</file>
+        <file>res/images/search.png</file>
+        <file>res/images/search_s.png</file>
         <file>res/images/send_position.png</file>
         <file>res/images/send_position_s.png</file>
-        <file>res/images/show_position.png</file>
-        <file>res/images/show_position_s.png</file>
         <file>res/images/sight.png</file>
         <file>res/images/tab_active.png</file>
         <file>res/images/tab_inactive.png</file>
diff --git a/res/images/filtered.png b/res/images/filtered.png
new file mode 100644 (file)
index 0000000..ec3f00a
Binary files /dev/null and b/res/images/filtered.png differ
diff --git a/res/images/filtered_s.png b/res/images/filtered_s.png
new file mode 100644 (file)
index 0000000..ef663fb
Binary files /dev/null and b/res/images/filtered_s.png differ
diff --git a/res/images/panel_context_button_bar_tile.png b/res/images/panel_context_button_bar_tile.png
new file mode 100644 (file)
index 0000000..08c6de1
Binary files /dev/null and b/res/images/panel_context_button_bar_tile.png differ
diff --git a/res/images/panel_context_button_bar_top.png b/res/images/panel_context_button_bar_top.png
new file mode 100644 (file)
index 0000000..6cc4454
Binary files /dev/null and b/res/images/panel_context_button_bar_top.png differ
diff --git a/res/images/route_to_friend.png b/res/images/route_to_friend.png
new file mode 100644 (file)
index 0000000..be6ec9a
Binary files /dev/null and b/res/images/route_to_friend.png differ
diff --git a/res/images/route_to_friend_s.png b/res/images/route_to_friend_s.png
new file mode 100644 (file)
index 0000000..9db8f32
Binary files /dev/null and b/res/images/route_to_friend_s.png differ
diff --git a/res/images/route_to_location.png b/res/images/route_to_location.png
new file mode 100644 (file)
index 0000000..9a00779
Binary files /dev/null and b/res/images/route_to_location.png differ
diff --git a/res/images/route_to_location_s.png b/res/images/route_to_location_s.png
new file mode 100644 (file)
index 0000000..f319475
Binary files /dev/null and b/res/images/route_to_location_s.png differ
diff --git a/res/images/search.png b/res/images/search.png
new file mode 100644 (file)
index 0000000..e6f330f
Binary files /dev/null and b/res/images/search.png differ
diff --git a/res/images/search_s.png b/res/images/search_s.png
new file mode 100644 (file)
index 0000000..e571dff
Binary files /dev/null and b/res/images/search_s.png differ
diff --git a/res/images/show_position.png b/res/images/show_position.png
deleted file mode 100755 (executable)
index fcc4dcf..0000000
Binary files a/res/images/show_position.png and /dev/null differ
diff --git a/res/images/show_position_s.png b/res/images/show_position_s.png
deleted file mode 100755 (executable)
index 96a99f8..0000000
Binary files a/res/images/show_position_s.png and /dev/null differ
index 714164a..07de0ac 100644 (file)
@@ -71,7 +71,9 @@ SOURCES += main.cpp \
     ui/zoombuttonpanel.cpp \
     ui/searchdialog.cpp \
     ui/panelbar.cpp \
+    ui/panelbase.cpp \
     ui/panelcontentstack.cpp \
+    ui/panelcontextbuttonbar.cpp \
     ui/paneltab.cpp \
     ui/paneltabbar.cpp \
     ui/tabbedpanel.cpp \
@@ -146,8 +148,10 @@ HEADERS += application.h \
     ui/listitemdelegate.h \
     ui/searchdialog.h \
     ui/panelbar.h \
+    ui/panelbase.h \
     ui/panelcommon.h \
     ui/panelcontentstack.h \
+    ui/panelcontextbuttonbar.h \
     ui/paneltab.h \
     ui/paneltabbar.h \
     ui/tabbedpanel.h \
index b94329e..fe7acfa 100644 (file)
@@ -38,7 +38,7 @@
 #include "friendlistpanel.h"
 
 FriendListPanel::FriendListPanel(QWidget *parent)
-    : QWidget(parent),
+    : PanelBase(parent),
       m_mainWindowIsTopmost(false),
       m_somePanelIsOpen(false)
 {
index 2d3bfdc..e8fbda1 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef FRIENDLISTPANEL_H
 #define FRIENDLISTPANEL_H
 
-#include <QWidget>
+#include "panelbase.h"
 
 class QLabel;
 class QLineEdit;
@@ -46,7 +46,7 @@ class User;
  * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
  * @author Sami Rämö - sami.ramo (at) ixonos.com
  */
-class FriendListPanel : public QWidget
+class FriendListPanel : public PanelBase
 {
     Q_OBJECT
 
@@ -209,13 +209,6 @@ signals:
     */
     void routeToFriend(const GeoCoordinate &coordinates);
 
-    /**
-     * @brief Signal for requesting a panel to be opened
-     *
-     * @param widget Pointer to the widget that emitted the signal
-     */
-    void showPanelRequested(QWidget *widget);
-
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
diff --git a/src/ui/panelbase.cpp b/src/ui/panelbase.cpp
new file mode 100644 (file)
index 0000000..1eb2175
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Pekka Nissinen - pekka.nissinen@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+*/
+
+#include <QDebug>
+
+#include "panelbase.h"
+
+PanelBase::PanelBase(QWidget *parent)
+    : QWidget(parent)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+}
+
+const QList<ImageButton *>& PanelBase::contextButtons() const
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    return m_contextButtonList;
+}
diff --git a/src/ui/panelbase.h b/src/ui/panelbase.h
new file mode 100644 (file)
index 0000000..528dc29
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Pekka Nissinen - pekka.nissinen@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+*/
+
+#ifndef PANELBASE_H
+#define PANELBASE_H
+
+#include <QWidget>
+
+class ImageButton;
+
+/**
+ * @brief Base class for panels
+ *
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ */
+class PanelBase : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief Constructor
+     *
+     * @param parent Parent
+     */
+    PanelBase(QWidget *parent = 0);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+    /**
+     * @brief Get list of context buttons
+     *
+     * @returns Reference to list of context buttons
+     */
+    const QList<ImageButton *>& contextButtons() const;
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+    /**
+     * @brief Signal for requesting a panel to be opened
+     *
+     * @param widget Pointer to the widget that emitted the signal
+     */
+    void showPanelRequested(QWidget *widget);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+protected:
+    QList<ImageButton *> m_contextButtonList; ///< List of context buttons
+};
+#endif // PANELBASE_H
diff --git a/src/ui/panelcontextbuttonbar.cpp b/src/ui/panelcontextbuttonbar.cpp
new file mode 100644 (file)
index 0000000..11c4bbd
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Pekka Nissinen - pekka.nissinen@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+*/
+
+#include <QDebug>
+#include <QPainter>
+
+#include "imagebutton.h"
+
+#include "panelcontextbuttonbar.h"
+
+const int CONTEXT_BUTTON_BAR_WIDTH = 78;
+
+PanelContextButtonBar::PanelContextButtonBar(QWidget *parent)
+    : QWidget(parent)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_barTile.load(":/res/images/panel_context_button_bar_tile.png");
+    m_barTop.load(":/res/images/panel_context_button_bar_top.png");
+
+    setFixedWidth(CONTEXT_BUTTON_BAR_WIDTH);
+}
+
+void PanelContextButtonBar::paintEvent(QPaintEvent *event)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    Q_UNUSED(event);
+
+    const int CONTEXT_BUTTON_BAR_RECT_X = 0;
+
+    const int CONTEXT_BUTTON_BAR_TOP_HEIGHT = 32;
+    const int CONTEXT_BUTTON_BAR_TOP_X = 0;
+    const int CONTEXT_BUTTON_BAR_TOP_Y = 0;
+
+    QPainter painter(this);
+
+    m_barRect.setRect(CONTEXT_BUTTON_BAR_RECT_X, CONTEXT_BUTTON_BAR_TOP_HEIGHT,
+                      CONTEXT_BUTTON_BAR_WIDTH, height() - CONTEXT_BUTTON_BAR_TOP_HEIGHT);
+
+    painter.drawPixmap(CONTEXT_BUTTON_BAR_TOP_X, CONTEXT_BUTTON_BAR_TOP_Y, m_barTop);
+    painter.drawTiledPixmap(m_barRect, m_barTile);
+
+}
+
+void PanelContextButtonBar::setContextButtons(const QList<ImageButton *> &contextButtonList)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    const int CONTEXT_BUTTON_HEIGHT = 74;
+    const int CONTEXT_BUTTON_MARGIN_LEFT = 2;
+    const int CONTEXT_BUTTON_MARGIN_TOP = 10;
+
+    // Hide previous buttons (if any)
+    for (int i = 0; i < m_contextButtonList.size(); i ++) {
+        m_contextButtonList.at(i)->setParent(0);
+    }
+
+    m_contextButtonList = contextButtonList;
+
+    for (int i = 0; i < m_contextButtonList.size(); i ++) {
+        m_contextButtonList.at(i)->setParent(this);
+        m_contextButtonList.at(i)->setVisible(true);
+        m_contextButtonList.at(i)->move(CONTEXT_BUTTON_MARGIN_LEFT,
+                                        CONTEXT_BUTTON_MARGIN_TOP + (CONTEXT_BUTTON_HEIGHT * i));
+    }
+
+    setFixedHeight(CONTEXT_BUTTON_MARGIN_TOP + (CONTEXT_BUTTON_HEIGHT * contextButtonList.size()));
+
+    emit positionChangeRequested();
+}
diff --git a/src/ui/panelcontextbuttonbar.h b/src/ui/panelcontextbuttonbar.h
new file mode 100644 (file)
index 0000000..d2528ae
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Pekka Nissinen - pekka.nissinen@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+*/
+
+#ifndef PANELCONTEXTBUTTONBAR_H
+#define PANELCONTEXTBUTTONBAR_H
+
+#include <QWidget>
+
+class ImageButton;
+
+class PanelContextButtonBar : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief Constructor
+     *
+     * @param parent Parent
+     */
+    PanelContextButtonBar(QWidget *parent = 0);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+    /**
+     * @brief Draws the bar
+     *
+     * @param event Paint event
+     */
+    void paintEvent(QPaintEvent *event);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+    /**
+     * @brief Sets the context buttons to the context button bar
+     *
+     * @param contextButtonList List of context buttons
+     */
+    void setContextButtons(const QList<ImageButton *> &contextButtonList);
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+    /**
+     * @brief This signal is called when context button bar needs to be repositioned
+     */
+    void positionChangeRequested();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+    QList<ImageButton *> m_contextButtonList;
+
+    QPixmap m_barTile;  ///< Pixmap for button bar
+    QPixmap m_barTop;   ///< Pixmap for button bar top
+
+    QRect m_barRect;    ///< Rect for the button bar
+};
+
+#endif // PANELCONTEXTBUTTONBAR_H
index f730136..017c10e 100644 (file)
@@ -2,6 +2,7 @@
 #include "locationlistitem.h"
 #include "locationlistview.h"
 #include "extendedlistitemdelegate.h"
+#include "imagebutton.h"
 #include "routing/location.h"
 #include "routing/route.h"
 #include "routewaypointlistview.h"
@@ -11,7 +12,7 @@
 #include "routingpanel.h"
 
 RoutingPanel::RoutingPanel(QWidget *parent)
-    : QWidget(parent)
+    : PanelBase(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -28,7 +29,10 @@ RoutingPanel::RoutingPanel(QWidget *parent)
     listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
                                        PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
 
-    m_searchLocationButton = new QPushButton(tr("Search location"));
+    ImageButton *searchLocationButton = new ImageButton(0, ":/res/images/search.png",
+                                                             ":/res/images/search_s.png");
+
+    m_contextButtonList.append(searchLocationButton);
 
     m_routeButton = new QPushButton(tr("Route to location"));
     m_routeButton->setDisabled(true);
@@ -57,7 +61,6 @@ RoutingPanel::RoutingPanel(QWidget *parent)
     listViewLayout->addWidget(m_locationListView);
     listViewLayout->addWidget(m_routeWaypointListView);
 
-    routingLayout->addWidget(m_searchLocationButton);
     routingLayout->addWidget(m_routeButton);
     routingLayout->addWidget(m_locationListHeaderWidget);
     routingLayout->addLayout(listViewLayout);
@@ -76,7 +79,7 @@ RoutingPanel::RoutingPanel(QWidget *parent)
     connect(m_routeButton, SIGNAL(clicked()),
             this, SLOT(routeToSelectedLocation()));
 
-    connect(m_searchLocationButton, SIGNAL(clicked()),
+    connect(searchLocationButton, SIGNAL(clicked()),
             this, SIGNAL(requestSearchLocation()));
 }
 
index 1ba979c..55fe2a4 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <QtGui>
 
+#include "panelbase.h"
+
 class ExtendedListItemDelegate;
 class GeoCoordinate;
 class LocationListView;
@@ -36,7 +38,7 @@ class RouteWaypointListView;
  *
  * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
  */
-class RoutingPanel : public QWidget
+class RoutingPanel : public PanelBase
 {
     Q_OBJECT
 
index 7da73c4..11afa8d 100644 (file)
 #include <QStateMachine>
 
 #include "panelbar.h"
+#include "panelbase.h"
 #include "panelcontentstack.h"
+#include "panelcontextbuttonbar.h"
 #include "paneltabbar.h"
 
 #include "tabbedpanel.h"
 
+const int PANEL_CONTEXT_BUTTON_BAR_LEFT_X = 1;
+
 TabbedPanel::TabbedPanel(QWidget *parent)
     : QWidget(parent),
       m_isOpen(false)
@@ -40,14 +44,14 @@ TabbedPanel::TabbedPanel(QWidget *parent)
 
     const int PANEL_LEFT_X = 0;
     const int PANEL_TOP_Y = 0;
-    const int TAB_BAR_TOP_SPACING = 8;
+    const int PANEL_TAB_BAR_TOP_SPACING = 8;
 
     resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH, PANEL_HEIGHT);
     move(PANEL_CLOSED_X, PANEL_TOP_PADDING);
 
     // --- TABS ---
     m_panelTabBar = new PanelTabBar(this);
-    m_panelTabBar->move(PANEL_LEFT_X, TAB_BAR_TOP_SPACING);
+    m_panelTabBar->move(PANEL_LEFT_X, PANEL_TAB_BAR_TOP_SPACING);
 
     connect(m_panelTabBar, SIGNAL(currentChanged(int)),
             this, SLOT(setCurrentIndex(int)));
@@ -62,6 +66,15 @@ TabbedPanel::TabbedPanel(QWidget *parent)
     m_panelBar = new PanelBar(this);
     m_panelBar->move(PANEL_TAB_WIDTH, PANEL_TOP_Y);
 
+    // --- CONTEXT BUTTON BAR ---
+    m_panelContextButtonBar = new PanelContextButtonBar(this);
+    m_panelContextButtonBar->setVisible(false);
+    m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X,
+                                  PANEL_HEIGHT - m_panelContextButtonBar->height());
+
+    connect(m_panelContextButtonBar, SIGNAL(positionChangeRequested()),
+            this, SLOT(repositionContextButtonBar()));
+
     // --- PANEL CONTENT ---
     m_panelContentStack = new PanelContentStack(this);
     m_panelContentStack->move(PANEL_TAB_WIDTH + PANEL_BAR_WIDTH, PANEL_TOP_Y);
@@ -132,6 +145,14 @@ void TabbedPanel::removeTab(int index)
     }
 }
 
+void TabbedPanel::repositionContextButtonBar()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X,
+                                  height() - m_panelContextButtonBar->height());
+}
+
 void TabbedPanel::resizePanel(const QSize &size)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -146,6 +167,9 @@ void TabbedPanel::resizePanel(const QSize &size)
 
     m_panelBar->resizeBar(size);
 
+    m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X,
+                                  size.height() - m_panelContextButtonBar->height());
+
     m_panelContentStack->resizeContentStack(size);
 
     QPoint closedPosition(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING);
@@ -156,13 +180,6 @@ void TabbedPanel::resizePanel(const QSize &size)
     m_panelStateOpened->assignProperty(this, "pos", openedPosition);
 }
 
-void TabbedPanel::showPanel(QWidget *widget)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_panelTabBar->selectTab(m_panelContentStack->indexOf(widget));
-}
-
 void TabbedPanel::setCurrentIndex(int index)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -173,19 +190,31 @@ void TabbedPanel::setCurrentIndex(int index)
         if (!m_isOpen)
             emit toggleState();
 
+        m_panelContextButtonBar->setContextButtons(
+                static_cast<PanelBase *>(m_panelContentStack->widget(index))->contextButtons());
+
         emit currentChanged(index);
     }
 }
 
+void TabbedPanel::showPanel(QWidget *widget)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_panelTabBar->selectTab(m_panelContentStack->indexOf(widget));
+}
+
 void TabbedPanel::stateChanged()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
     if (!m_isOpen) {
         m_isOpen = true;
+        m_panelContextButtonBar->setVisible(true);
         emit panelOpened();
     } else {
         m_isOpen = false;
+        m_panelContextButtonBar->setVisible(false);
         emit panelClosed();
     }
 }
index 9f59572..58dbb17 100644 (file)
@@ -34,6 +34,7 @@ class QStateMachine;
 
 class PanelBar;
 class PanelContentStack;
+class PanelContextButtonBar;
 class PanelTabBar;
 
 /**
@@ -116,6 +117,11 @@ public slots:
 
 private slots:
     /**
+     * @brief Repositions context button bar
+     */
+    void repositionContextButtonBar();
+
+    /**
      * @brief Sets the panel at current index active
      *
      * @param index Index of the panel
@@ -168,19 +174,20 @@ signals:
 private:
     bool m_isOpen;      ///< Boolean used to track the current state of the statemachine
 
-    QPropertyAnimation *m_panelAnimation;       ///< Animation for panel state changes
+    QPropertyAnimation *m_panelAnimation;           ///< Animation for panel state changes
 
-    QSignalTransition *m_panelTransitionClose;  ///< Transition signal for closing the panel
-    QSignalTransition *m_panelTransitionOpen;   ///< Transition signal for opening the panel
+    QSignalTransition *m_panelTransitionClose;      ///< Transition signal for closing the panel
+    QSignalTransition *m_panelTransitionOpen;       ///< Transition signal for opening the panel
 
-    QState *m_panelStateClosed;                 ///< State of the closed panel
-    QState *m_panelStateOpened;                 ///< State of the opened panel
+    QState *m_panelStateClosed;                     ///< State of the closed panel
+    QState *m_panelStateOpened;                     ///< State of the opened panel
 
-    QStateMachine *m_panelStateMachine;         ///< State machine for sliding the panel
+    QStateMachine *m_panelStateMachine;             ///< State machine for sliding the panel
 
-    PanelBar *m_panelBar;                       ///< Widget for panel bar
-    PanelContentStack *m_panelContentStack;     ///< Stack for panel widgets
-    PanelTabBar *m_panelTabBar;                 ///< Widget for panel tab bar
+    PanelBar *m_panelBar;                           ///< Widget for panel bar
+    PanelContentStack *m_panelContentStack;         ///< Stack for panel widgets
+    PanelContextButtonBar * m_panelContextButtonBar;///< Widget for panel context button bar
+    PanelTabBar *m_panelTabBar;                     ///< Widget for panel tab bar
 };
 
 #endif // TABBEDPANEL_H
index a775b02..d7e8f33 100644 (file)
@@ -69,10 +69,6 @@ UserInfo::UserInfo(QWidget *parent)
     infoLayout->setMargin(0);
     infoLayout->setSpacing(0);
 
-    QHBoxLayout *buttonLayout = new QHBoxLayout();
-    buttonLayout->setMargin(0);
-    buttonLayout->setSpacing(0);
-
     QLabel *envelopeLabel = new QLabel();
     envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
     envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
@@ -98,16 +94,6 @@ UserInfo::UserInfo(QWidget *parent)
     m_updatedLabel = new QLabel();
     m_updatedLabel->setWordWrap(true);
 
-    ImageButton *updateFriendsButton = new ImageButton(":/res/images/refresh.png",
-                                                       ":/res/images/refresh_s.png",
-                                                       "", this);
-    ImageButton *updateStatusMessageButton = new ImageButton(":/res/images/send_position.png",
-                                                             ":/res/images/send_position_s.png",
-                                                             "", this);
-
-    buttonLayout->addWidget(updateFriendsButton);
-    buttonLayout->addWidget(updateStatusMessageButton);
-
     infoLayout->addRow(envelopeLabel, m_statusTextLabel);
     infoLayout->addRow(compassLabel, m_locationLabel);
     infoLayout->addRow(clockLabel, m_updatedLabel);
@@ -115,13 +101,6 @@ UserInfo::UserInfo(QWidget *parent)
     verticalLayout->addWidget(m_findButton, 0, Qt::AlignHCenter);
     verticalLayout->addWidget(m_nameLabel, 0, Qt::AlignHCenter);
     verticalLayout->addLayout(infoLayout);
-    verticalLayout->addLayout(buttonLayout);
-
-    connect(updateStatusMessageButton,SIGNAL(clicked()),
-            this,SLOT(messageUpdate()));
-
-    connect(updateFriendsButton,SIGNAL(clicked()),
-            this, SIGNAL(refreshUserData()));
 
     connect(m_findButton, SIGNAL(clicked()),
             this, SLOT(findButtonClicked()));
index de62847..7a90a64 100644 (file)
@@ -201,11 +201,6 @@ signals:
     void notificateUpdateFailing(const QString &message, bool modal);
 
     /**
-     * @brief Signal for refreshing user data.
-     */
-    void refreshUserData();
-
-    /**
      * @brief Signal for requesting reverseGeo from SituareEngine
      */
     void requestReverseGeo();
index e68f390..db35d46 100644 (file)
 #include <QScrollArea>
 #include <QVBoxLayout>
 
+#include "imagebutton.h"
 #include "panelcommon.h"
 #include "userinfo.h"
 
 #include "userinfopanel.h"
 
 UserInfoPanel::UserInfoPanel(QWidget *parent)
-    : QWidget(parent)
+    : PanelBase(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -66,20 +67,31 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     connect(m_userInfo,SIGNAL(requestReverseGeo()),
             this, SIGNAL(requestReverseGeo()));
 
-    connect(this, SIGNAL(reverseGeoReady(QString)),
-            m_userInfo, SIGNAL(reverseGeoReady(QString)));
-
     connect(m_userInfo, SIGNAL(statusUpdate(QString,bool)),
             this, SIGNAL(statusUpdate(QString,bool)));
 
-    connect(m_userInfo, SIGNAL(refreshUserData()),
-            this, SIGNAL(refreshUserData()));
+    connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
+             this, SIGNAL(notificateUpdateFailing(QString, bool)));
+
+    connect(this, SIGNAL(reverseGeoReady(QString)),
+            m_userInfo, SIGNAL(reverseGeoReady(QString)));
 
     connect(this, SIGNAL(clearUpdateLocationDialogData()),
             m_userInfo, SLOT(clearUpdateLocationDialogData()));
 
-    connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
-             this, SIGNAL(notificateUpdateFailing(QString, bool)));
+    ImageButton *updateFriendsButton = new ImageButton(this, ":/res/images/refresh.png",
+                                                             ":/res/images/refresh_s.png");
+    ImageButton *updateStatusMessageButton = new ImageButton(this, ":/res/images/send_position.png",
+                                                                   ":/res/images/send_position_s.png");
+
+    m_contextButtonList.append(updateFriendsButton);
+    m_contextButtonList.append(updateStatusMessageButton);
+
+    connect(updateFriendsButton, SIGNAL(clicked()),
+            this, SIGNAL(refreshUserData()));
+
+    connect(updateStatusMessageButton, SIGNAL(clicked()),
+            m_userInfo, SLOT(messageUpdate()));
 }
 
 void UserInfoPanel::userDataReceived(User *user)
index df38811..47bdfc9 100644 (file)
@@ -24,8 +24,7 @@
 #ifndef USERPANEL_H
 #define USERPANEL_H
 
-#include <QWidget>
-
+#include "panelbase.h"
 #include "user/user.h"
 
 class UserInfo;
@@ -37,7 +36,7 @@ class UserInfo;
  * @author Katri Kaikkonen - katri.kaikkonen (at) ixonos.com
  * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
  */
-class UserInfoPanel : public QWidget
+class UserInfoPanel : public PanelBase
 {
     Q_OBJECT