Situare - A location system for Facebook
Copyright (C) 2010 Ixonos Plc. Authors:
- Kaj Wallin - kaj.wallin@ixonos.com
Katri Kaikkonen - katri.kaikkonen@ixonos.com
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Sami Rämö - sami.ramo@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
* @brief Indicator button class
*
* @author Katri Kaikkonen - katri.kaikkonen (at) ixonos.com
- *
- * @class IndicatorButton indicatorbutton.h "ui/indicatorbutton.h"
+ * @author Sami Rämö - sami.ramo (at) ixonos.com
*/
class IndicatorButton : public QToolButton
{
******************************************************************************/
protected:
/**
- * @brief Move event for the distance indicator button
+ * @brief Event handler for mouse move events
*
* @param event Mouse event
*/
void mouseMoveEvent(QMouseEvent *event);
/**
- * @brief Press event for the distance indicator button
+ * @brief Event handler for mouse press events
*
* @param event Mouse event
*/
const QPoint& eventPosition();
/**
- * @brief Slot to redraw the panel after window resize event
+ * @brief Sets direction information for the distance indicator button
*
- * @param size Size of the new screen
- */
- void screenResized(const QSize &size);
-
- /**
- * @brief Toggle distance indicator button draggability
- */
- void setDraggable(bool mode, QPoint eventPosition = QPoint(0,0));
-
-private slots:
- /**
- * @brief Safeguard slot to release mouse grab if something goes horribly wrong
- */
- void forceMouseRelease();
-
- /**
- * @brief Slot that handles drag initialization once timer has timed out
+ * Paints the button and its icon
+ * @param Direction to the GPS position (in degrees)
+ * @param Draw direction triangle
*/
- void timerExpired();
+ void setDirection(qreal direction, bool draw);
/*******************************************************************************
* SIGNALS
*/
void autoCenteringTriggered(bool enabled);
- /**
- * @brief Dragging mode triggered.
- */
- void draggingModeTriggered();
-
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
- bool m_isDraggable; ///< Boolean for tracking the draggability state
+ bool m_drawTriangle; ///< Should the direction triange be drawn
+
+ qreal m_direction; ///< Direction to the GPS position (in degrees)
QColor *m_normalColor; ///< Normal background color
QPixmap m_indicatorLeds[2]; ///< Placeholder for images
- QPoint m_dragPosition; ///< Location from where the widget is grabbed
- QPoint m_eventPosition; ///< Position of mousePressEvent
-
- QSize m_screenSize; ///< Store for the screen size
-
- QTimer *m_dragStartTimer; ///< Timer to init draggability of the distance indicator button
- QTimer *m_forceReleaseTimer; ///< Timer to run forceMouseRelease
+ QPoint m_dragPosition; ///< Location from where the widget is grabbed
+ QPoint m_eventPosition; ///< Position of mousePressEvent
};
#endif // INDICATORBUTTON_H