IndicatorButtonPanel::IndicatorButtonPanel(QWidget *parent)
: QWidget(parent),
- m_isDraggable(false),
- m_distanceText("")
+ m_isDraggable(false)
{
qDebug() << __PRETTY_FUNCTION__;
QPoint(DIRECTION_INDICATOR_POSITION_X,
DIRECTION_INDICATOR_POSITION_Y)).toPoint();
- if(savedLocation.x() > DEFAULT_SCREEN_WIDTH || savedLocation.y() > DEFAULT_SCREEN_HEIGHT) {
+ if((savedLocation.x() > DEFAULT_SCREEN_WIDTH) || (savedLocation.y() > DEFAULT_SCREEN_HEIGHT)) {
savedLocation.rx() = DIRECTION_INDICATOR_POSITION_X;
savedLocation.ry() = DIRECTION_INDICATOR_POSITION_Y;
}
}
}
-void IndicatorButtonPanel::setDraggable(bool mode, QPoint eventPosition)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_isDraggable = mode;
-
- if(mode) {
- emit draggingModeTriggered();
- grabMouse();
- m_forceReleaseTimer->start();
- m_dragPosition = eventPosition;
- } else {
- releaseMouse();
- m_forceReleaseTimer->stop();
- m_indicatorButton->setDown(false);
- }
- update();
-}
-
void IndicatorButtonPanel::screenResized(const QSize &newSize)
{
qDebug() << __PRETTY_FUNCTION__;
move(resizedPosition);
}
+void IndicatorButtonPanel::setDraggable(bool mode, QPoint eventPosition)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_isDraggable = mode;
+
+ if(mode) {
+ emit draggingModeTriggered();
+ grabMouse();
+ m_forceReleaseTimer->start();
+ m_dragPosition = eventPosition;
+ } else {
+ releaseMouse();
+ m_forceReleaseTimer->stop();
+ m_indicatorButton->setDown(false);
+ }
+ update();
+}
+
void IndicatorButtonPanel::setIndicatorButtonEnabled(bool enabled)
{
m_indicatorButton->setChecked(enabled);
{
qDebug() << __PRETTY_FUNCTION__;
- const int MAX_TO_METERS = 1000 - 0.5;
- const int MAX_FOR_KM_WITH_DESIMAL = 100000 - 50;
- const int MIN_TO_METERS = 10.0;
- const qreal M_TO_KM = 1000.0; ///< Meters to kilometers conversion
+ const int MAX_TO_METERS = 999.5;
+ const int MAX_TO_KM_WITH_DESIMAL = 99950;
+ const int MIN_TO_METERS = 10;
+ const int M_TO_KM = 1000; ///< Meters to kilometers conversion
QString UNIT_KILOMETER = " km";
QString UNIT_METER = " m";
m_distanceText.setNum(m_distance, 0 , 0);
m_distanceText.append(UNIT_METER);
}
- else if(m_distance < MAX_FOR_KM_WITH_DESIMAL)
+ else if(m_distance < MAX_TO_KM_WITH_DESIMAL)
{
m_distanceText.setNum(m_distance / M_TO_KM, 1, 1);
m_distanceText.append(UNIT_KILOMETER);