homescreenapp/hsutils/src/hssnapline.cpp
changeset 69 87476091b3f5
parent 62 341166945d65
child 81 7dd137878ff8
equal deleted inserted replaced
67:474929a40a0f 69:87476091b3f5
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <QGraphicsOpacityEffect>
    18 #include <QGraphicsOpacityEffect>
    19 #include <QPropertyAnimation>
    19 #include <QPropertyAnimation>
       
    20 #include <hbcolorscheme.h>
    20 
    21 
    21 #include "hsapp_defs.h"
    22 #include "hsapp_defs.h"
    22 #include "HsSnapLine.h"
    23 #include "hssnapline.h"
    23 
    24 
    24 /*!
    25 /*!
    25     Constructor.
    26     Constructor.
    26     
    27     
    27     \a parent Owner.
    28     \a parent Owner.
    42     mFadeInAnimation = new QPropertyAnimation(graphicsEffect(), "opacity", this);
    43     mFadeInAnimation = new QPropertyAnimation(graphicsEffect(), "opacity", this);
    43     connect(mFadeInAnimation, SIGNAL(finished()), SLOT(fadeInAnimationFinished()));
    44     connect(mFadeInAnimation, SIGNAL(finished()), SLOT(fadeInAnimationFinished()));
    44 
    45 
    45     mFadeOutAnimation = new QPropertyAnimation(graphicsEffect(), "opacity", this);
    46     mFadeOutAnimation = new QPropertyAnimation(graphicsEffect(), "opacity", this);
    46     connect(mFadeOutAnimation, SIGNAL(finished()), SLOT(fadeOutAnimationFinished()));
    47     connect(mFadeOutAnimation, SIGNAL(finished()), SLOT(fadeOutAnimationFinished()));
    47 
       
    48     QPen pen;
       
    49     pen.setWidth(3);
       
    50     pen.setColor(Qt::darkCyan); //TODO: Change the color to the Theme element
       
    51     setPen(pen);
       
    52 }
    48 }
    53  
    49  
    54 /*!
    50 /*!
    55     Destructor.
    51     Destructor.
    56 */
    52 */
   109             }
   105             }
   110         }
   106         }
   111         displayLine.translate(-1.0, 0.0);
   107         displayLine.translate(-1.0, 0.0);
   112     }
   108     }
   113 
   109 
       
   110     QLinearGradient gradient(displayLine.p1(), displayLine.p2());
       
   111     gradient.setColorAt(0.0, Qt::white);
       
   112     QColor snapLineColor = HbColorScheme::color("qtc_hs_snapguide");
       
   113     if (!snapLineColor.isValid()) {
       
   114         //if valid color is not loaded from the theme, the darkCyan color is used as a backup.color
       
   115         snapLineColor = Qt::darkCyan;
       
   116     }
       
   117     gradient.setColorAt(0.4, snapLineColor);
       
   118     gradient.setColorAt(0.6, snapLineColor);
       
   119     gradient.setColorAt(1.0, Qt::white);
       
   120     QBrush brush(gradient);
       
   121     QPen pen;
       
   122     pen.setWidth(3);
       
   123     pen.setCapStyle(Qt::RoundCap);
       
   124     pen.setBrush(brush);
       
   125     setPen(pen);
       
   126 
   114     setLine(displayLine);
   127     setLine(displayLine);
   115     show();
   128     show();
   116 }
   129 }
   117 
   130 
   118 /*!
   131 /*!