Merge branch 'master' into new_panels
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Mon, 16 Aug 2010 12:08:15 +0000 (15:08 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Mon, 16 Aug 2010 12:08:15 +0000 (15:08 +0300)
1  2 
src/ui/indicatorbuttonpanel.cpp

@@@ -39,7 -39,7 +39,7 @@@ IndicatorButtonPanel::IndicatorButtonPa
  {
      qDebug() << __PRETTY_FUNCTION__;
  
 -    const int DIRECTION_INDICATOR_POSITION_X = 10 + PANEL_PEEK_AMOUNT;
 +    const int DIRECTION_INDICATOR_POSITION_X = 10;
      const int DIRECTION_INDICATOR_POSITION_Y = 290;
  
      const int INDICATOR_BUTTON_PANEL_SPACING = 5;
@@@ -81,7 -81,7 +81,7 @@@
                                            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;
      }
              this, SIGNAL(autoCenteringTriggered(bool)));
  }
  
+ IndicatorButtonPanel::~IndicatorButtonPanel()
+ {
+     qDebug() << __PRETTY_FUNCTION__;
+     delete m_normalColor;
+ }
  void IndicatorButtonPanel::forceMouseRelease()
  {
      qDebug() << __PRETTY_FUNCTION__;
@@@ -121,24 -128,24 +128,24 @@@ void IndicatorButtonPanel::mouseMoveEve
  {
      qDebug() << __PRETTY_FUNCTION__;
  
 -    if(m_isDraggable) {
 +    if (m_isDraggable) {
          if (event->buttons() & Qt::LeftButton) {
              QPoint newLocation = mapToParent(event->pos()) - m_dragPosition;
  
 -            if (newLocation.x() < SIDEBAR_WIDTH)
 -                newLocation.rx() = SIDEBAR_WIDTH;
 -            else if (newLocation.x() > m_screenSize.width() - width() - SIDEBAR_WIDTH)
 -                newLocation.rx() =  m_screenSize.width() - width() - SIDEBAR_WIDTH;
 +            if (newLocation.x() < 0)
 +                newLocation.rx() = 0;
 +            else if (newLocation.x() > (m_screenSize.width() - width() - PANEL_BAR_WIDTH))
 +                newLocation.rx() =  m_screenSize.width() - width() - PANEL_BAR_WIDTH;
  
              if (newLocation.y() < 0)
                  newLocation.ry() = 0;
 -            else if (newLocation.y() > m_screenSize.height() - height())
 +            else if (newLocation.y() > (m_screenSize.height() - height()))
                  newLocation.ry() = m_screenSize.height() - height();
  
              move(newLocation);
          }
      } else {
 -        if(!rect().contains(event->pos()))
 +        if (!rect().contains(event->pos()))
              m_dragStartTimer->stop();
      }
  }
@@@ -158,7 -165,7 +165,7 @@@ void IndicatorButtonPanel::mouseRelease
      m_dragStartTimer->stop();
  
      Q_UNUSED(event);
 -    if(m_isDraggable) {
 +    if (m_isDraggable) {
          setDraggable(false);
  
          QSettings settings(DIRECTORY_NAME, FILE_NAME);
@@@ -194,7 -201,7 +201,7 @@@ void IndicatorButtonPanel::paintEvent(Q
          painter.fillPath(backgroundPath, QBrush(*m_normalColor));
      }
  
 -    if(m_isDraggable) {
 +    if (m_isDraggable) {
          const int ROUNDING_RADIUS = 9;
  
          QPainterPath backgroundPath;
@@@ -211,12 -218,12 +218,12 @@@ void IndicatorButtonPanel::screenResize
      int oldHeight = 0;
      int oldWidth = 0;
  
 -    if(m_screenSize.height() < 0)
 +    if (m_screenSize.height() < 0)
          oldHeight = DEFAULT_NON_FULLSCREEN_HEIGHT;
      else
          oldHeight = m_screenSize.height();
  
 -    if(m_screenSize.width() < 0)
 +    if (m_screenSize.width() < 0)
          oldWidth = DEFAULT_SCREEN_WIDTH;
      else
          oldWidth = m_screenSize.width();
      m_screenSize = newSize;
  
      QPoint resizedPosition = pos();
 -    if(resizedPosition.x() > (newSize.width() - rect().width()))
 -        resizedPosition.rx() = newSize.width() - rect().width();
 -    else if (resizedPosition.x() < SIDEBAR_WIDTH)
 -        resizedPosition.rx() = SIDEBAR_WIDTH;
 -    if(resizedPosition.y() > (newSize.height() - rect().height()))
 -        resizedPosition.ry() = newSize.height() - rect().height();
 -    else if (resizedPosition.y() < 0)
 +
 +    if (resizedPosition.x() < 0)
 +        resizedPosition.rx() = 0;
 +    else if (resizedPosition.x() > (newSize.width() - rect().width() - PANEL_BAR_WIDTH))
 +        resizedPosition.rx() = newSize.width() - rect().width() - PANEL_BAR_WIDTH;
 +
 +    if (resizedPosition.y() < 0)
          resizedPosition.ry() = 0;
 +    else if (resizedPosition.y() > (newSize.height() - rect().height()))
 +        resizedPosition.ry() = newSize.height() - rect().height();
  
 -    if((pos().y() + rect().center().y()) > (oldHeight/2))
 +    if ((pos().y() + rect().center().y()) > (oldHeight / 2))
          resizedPosition.ry() = newSize.height() - (oldHeight - pos().y());
  
 -    if((pos().x() + rect().center().x()) > (oldWidth/2))
 +    if ((pos().x() + rect().center().x()) > (oldWidth / 2))
          resizedPosition.rx() = newSize.width() - (oldWidth - pos().x());
  
      move(resizedPosition);
@@@ -250,7 -255,7 +257,7 @@@ void IndicatorButtonPanel::setDraggable
  
      m_isDraggable = mode;
  
 -    if(mode) {
 +    if (mode) {
          emit draggingModeTriggered();
          grabMouse();
          m_forceReleaseTimer->start();
@@@ -296,17 -301,23 +303,17 @@@ void IndicatorButtonPanel::updateValues
  
      m_distance = distance;
  
 -    if(m_distance < MIN_TO_METERS)
 -    {
 +    if (m_distance < MIN_TO_METERS) {
          m_distanceText.setNum(10);
          m_distanceText.prepend("< ");
          m_distanceText.append(UNIT_METER);
 -    }
 -    else if(m_distance < MAX_TO_METERS)
 -    {
 +    } else if (m_distance < MAX_TO_METERS) {
          m_distanceText.setNum(m_distance, 'f', 0);
          m_distanceText.append(UNIT_METER);
 -    }
 -    else if(m_distance < MAX_TO_KM_WITH_DESIMAL)
 -    {
 +    } else if (m_distance < MAX_TO_KM_WITH_DESIMAL) {
          m_distanceText.setNum(m_distance / M_TO_KM, 'f', 1);
          m_distanceText.append(UNIT_KILOMETER);
 -    }
 -    else {
 +    } else {
          m_distanceText.setNum(m_distance / M_TO_KM, 'f', 0);
          m_distanceText.append(UNIT_KILOMETER);
      }
  
      update();
  }
 -