Added new icon for own location position, changed panel slider button arrow direction...
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Tue, 15 Jun 2010 08:48:27 +0000 (11:48 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Tue, 15 Jun 2010 08:48:27 +0000 (11:48 +0300)
Reviewed by: Kaj Wallin

images.qrc
src/map/ownlocationitem.cpp
src/ui/panelsliderbar.cpp
src/ui/panelsliderbar.h
src/ui/sidepanel.cpp
src/ui/sidepanel.h

index 5d1b74f..e03e4c8 100644 (file)
@@ -40,5 +40,6 @@
         <file>res/images/side_bar_tile_right.png</file>
         <file>res/images/sliding_bar_button.png</file>
         <file>res/images/sliding_bar_tile.png</file>
+        <file>res/images/own_location.png</file>
     </qresource>
 </RCC>
index 804ee1b..1f7e524 100644 (file)
 OwnLocationItem::OwnLocationItem()
 {
     qDebug() << __PRETTY_FUNCTION__;
-    QPixmap ownLocationIcon(":/res/images/led_red.png");
+    QPixmap ownLocationIcon(":/res/images/own_location.png");
     setPixmap(ownLocationIcon);
 
     setPos(QPoint(UNDEFINED, UNDEFINED));
     setZValue(OWN_LOCATION_ICON_Z_LEVEL);
-    setOffset(-ownLocationIcon.width()/2, -ownLocationIcon.height()/2);
+    setOffset(-ownLocationIcon.width() / 2, -41);
 }
index fd42ce8..fd6bf0b 100644 (file)
@@ -31,12 +31,18 @@ PanelSliderBar::PanelSliderBar(QWidget *parent, Side side)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    if (side == LEFT)
-        m_sliderButtonArrow.load(":res/images/arrow_right.png");
-    else if (side == RIGHT)
-        m_sliderButtonArrow.load(":res/images/arrow_left.png");
-    else
+    m_sliderButtonArrows[LEFT].load(":res/images/arrow_left.png");
+    m_sliderButtonArrows[RIGHT].load(":res/images/arrow_right.png");
+
+    if (side == LEFT) {
+        m_sliderSide = side;
+        m_sliderDirection = RIGHT;
+    } else if (side == RIGHT) {
+        m_sliderSide = side;
+        m_sliderDirection = LEFT;
+    } else {
         qFatal("Illegal PanelSliderBar 2nd argument");
+    }
 
     m_sliderTile.load(":res/images/sliding_bar_tile.png");
     m_sliderButton.load(":res/images/sliding_bar_button.png");
@@ -65,9 +71,9 @@ void PanelSliderBar::paintEvent(QPaintEvent *)
     painter.drawTiledPixmap(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_menuDropShadowTile.height(),
                             m_menuDropShadowTile);
     painter.drawPixmap(m_buttonRect, m_sliderButton);
-    painter.drawPixmap((this->width() / 2) - (m_sliderButtonArrow.width() / 2),
-                       (this->height() / 2) - (m_sliderButtonArrow.height() / 2),
-                       m_sliderButtonArrow);
+    painter.drawPixmap((this->width() / 2) - (m_sliderButtonArrows[m_sliderDirection].width() / 2),
+                       (this->height() / 2) - (m_sliderButtonArrows[m_sliderDirection].height() / 2),
+                       m_sliderButtonArrows[m_sliderDirection]);
 }
 
 void PanelSliderBar::mouseReleaseEvent(QMouseEvent *)
@@ -77,6 +83,23 @@ void PanelSliderBar::mouseReleaseEvent(QMouseEvent *)
     emit clicked();
 }
 
+void PanelSliderBar::changeDirection(SliderBarState state)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if (state == PanelSliderBar::Open) {
+        if (m_sliderSide == LEFT)
+            m_sliderDirection = LEFT;
+        else
+            m_sliderDirection = RIGHT;
+    } else {
+        if (m_sliderSide == LEFT)
+            m_sliderDirection = RIGHT;
+        else
+            m_sliderDirection = LEFT;
+    }
+}
+
 void PanelSliderBar::resizeSliderBar(const QSize &size)
 {
     qDebug() << __PRETTY_FUNCTION__;
index 46e980a..7ead7b1 100644 (file)
@@ -52,6 +52,14 @@ public:
      */
     PanelSliderBar(QWidget *parent, Side side);
 
+    /**
+     * @brief Enumerator for the slider bar state
+     * Defines values: Open, Closed
+     *
+     * @sa changeDirection
+     */
+    enum SliderBarState {Open, Closed};
+
 /*******************************************************************************
  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
  ******************************************************************************/
@@ -77,6 +85,13 @@ protected:
  ******************************************************************************/
 public slots:
     /**
+     * @brief Slot to change sliderbar direction
+     *
+     * @param state Current state of the panel
+     */
+    void changeDirection(SliderBarState state);
+
+    /**
      * @brief Slot to redraw the slider bar after window resize event
      *
      * @param size Size of the new window
@@ -98,13 +113,17 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    QPixmap m_menuDropShadowTile;   ///< Pixmap for menu drop shadow
-    QPixmap m_sliderButton;         ///< Pixmap for panel sliding bar button
-    QPixmap m_sliderButtonArrow;    ///< Pixmap for panel sliding bar button arrow
-    QPixmap m_sliderTile;           ///< Pixmap for panel sliding bar
-    QRect m_bottomRect;             ///< Rect for slider bar bottom
-    QRect m_buttonRect;             ///< Rect for slider bar button
-    QRect m_topRect;                ///< Rect for slider bar top
-    QRegion m_sliderRegion;         ///< Region of the slider bar
+    int m_sliderDirection;              ///< Direction of the slider bar
+
+    QPixmap m_menuDropShadowTile;       ///< Pixmap for menu drop shadow
+    QPixmap m_sliderButton;             ///< Pixmap for panel sliding bar button
+    QPixmap m_sliderButtonArrows[2];    ///< Pixmap array for panel sliding bar button arrows
+    QPixmap m_sliderTile;               ///< Pixmap for panel sliding bar
+    QRect m_bottomRect;                 ///< Rect for slider bar bottom
+    QRect m_buttonRect;                 ///< Rect for slider bar button
+    QRect m_topRect;                    ///< Rect for slider bar top
+    QRegion m_sliderRegion;             ///< Region of the slider bar
+
+    Side m_sliderSide;                  ///< Slider side
 };
 #endif // PANELSLIDERBAR_H
index 064c547..e3c5898 100644 (file)
@@ -177,9 +177,11 @@ void SidePanel::setType(SidePanel::PanelType type)
 void SidePanel::stateChangedToClosed()
 {
     qDebug() << __PRETTY_FUNCTION__;
-    
+
     m_isOpen = false;
     emit panelClosed();
+
+    m_panelSlidingBar->changeDirection(PanelSliderBar::Closed);
 }
 
 void SidePanel::stateChangedToOpen()
@@ -188,4 +190,6 @@ void SidePanel::stateChangedToOpen()
     
     m_isOpen = true;
     emit panelOpened();
+
+    m_panelSlidingBar->changeDirection(PanelSliderBar::Open);
 }
index 48646df..072deb5 100644 (file)
@@ -60,6 +60,20 @@ public:
 /******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
+public:
+    /**
+     * @brief Type setter for the panel. Also sets panel visible
+     *
+     * Use to set panel type as UserPanel or FriendPanel. Panel type determines
+     * which side the panel will be rendered. UserPanel will always be rendered
+     * on the left side of the screen and FriendPanel on the right side. Type
+     * cannot be set twice.
+     *
+     * @param type Type of the panel, either UserPanel or FriendPanel
+     * @sa PanelType
+     */
+    void setType(SidePanel::PanelType type);
+
 public slots:
     /**
      * @brief Public slot that will open the panel unless already open
@@ -78,19 +92,6 @@ public slots:
      */
     void resizePanel(const QSize &size);
 
-    /**
-     * @brief Type setter for the panel. Also sets panel visible
-     *
-     * Use to set panel type as UserPanel or FriendPanel. Panel type determines
-     * which side the panel will be rendered. UserPanel will always be rendered
-     * on the left side of the screen and FriendPanel on the right side. Type
-     * cannot be set twice.
-     *
-     * @param type Type of the panel, either UserPanel or FriendPanel
-     * @sa PanelType
-     */
-    void setType(SidePanel::PanelType type);
-
 private slots:
     /**
      * @brief Internal slot used to track statemachine state