Merge branch 'master' into new_panels
[situare] / src / ui / indicatorbutton.h
index f8e737c..b288344 100644 (file)
@@ -2,8 +2,9 @@
     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
@@ -31,8 +32,7 @@
  * @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
 {
@@ -56,14 +56,14 @@ public:
  ******************************************************************************/
 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
      */
@@ -94,27 +94,13 @@ public slots:
     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
@@ -127,16 +113,13 @@ 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
 
@@ -144,13 +127,8 @@ private:
 
     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