<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>
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);
}
{
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");
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 *)
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__;
*/
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
******************************************************************************/
******************************************************************************/
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
* 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
void SidePanel::stateChangedToClosed()
{
qDebug() << __PRETTY_FUNCTION__;
-
+
m_isOpen = false;
emit panelClosed();
+
+ m_panelSlidingBar->changeDirection(PanelSliderBar::Closed);
}
void SidePanel::stateChangedToOpen()
m_isOpen = true;
emit panelOpened();
+
+ m_panelSlidingBar->changeDirection(PanelSliderBar::Open);
}
/******************************************************************************
* 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
*/
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