ginebra2/animators/FadeAnimator.cpp
changeset 0 1450b09d0cfd
child 3 0954f5dd2cd0
child 5 0f2326c2a325
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "FadeAnimator.h"
       
    20 #include "../ChromeSnippet.h"
       
    21 #include <QList>
       
    22 #include <QDebug>
       
    23 
       
    24 namespace GVA {
       
    25 
       
    26 FadeAnimator::FadeAnimator(ChromeSnippet* m_snippet) 
       
    27   : VisibilityAnimator(m_snippet),
       
    28     m_minOpacity(0.1)
       
    29 {
       
    30   // If the snippet is currently hidden, it will be shown
       
    31   // before the animator starts. It should therefore show
       
    32   // with minimum opacity.
       
    33 
       
    34   if(m_snippet->widget() && !m_snippet->widget()->isVisible())
       
    35     m_snippet->widget()->setOpacity(m_minOpacity);
       
    36 }
       
    37 
       
    38 FadeAnimator::~FadeAnimator()
       
    39 {
       
    40 }
       
    41 
       
    42 void FadeAnimator::updateVisibility(qreal step)
       
    43 {
       
    44   qreal o = 1.0 - step;
       
    45   m_snippet->widget()->setOpacity((o > m_minOpacity)?o:m_minOpacity);
       
    46       
       
    47   qDebug() << step;
       
    48 }
       
    49 
       
    50 }