diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/HgImageFader.cpp --- a/ganeswidgets/src/HgImageFader.cpp Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "HgImageFader.h" -#include "hgimage.h" - -HgImageFader::HgImageFader() -{ - QObject::connect(&mTimer, SIGNAL(timeout()), this, SLOT(doFading())); -} - -HgImageFader::~HgImageFader() -{ - if (mTimer.isActive()) - mTimer.stop(); -} - -void HgImageFader::addImage(HgImage* image) -{ - mImages.push_back(image); -} - -void HgImageFader::removeImage(HgImage* image) -{ - mImages.removeOne(image); -} - -void HgImageFader::fadeImages() -{ - if (!mImages.empty() && !mTimer.isActive()) - { - mTimer.start(10); - } -} - -void HgImageFader::doFading() -{ - QLinkedList::iterator i = mImages.begin(); - while (i != mImages.end()) - { - HgImage* image = (*i); - image->setAlpha(image->alpha() + 0.1f); - if (image->alpha() >= 1.0f) - { - image->setAlpha(1.0f); - i = mImages.erase(i); - } - else - { - i++; - } - } - - //emit doUpdate(); - - if (mImages.empty()) - { - mTimer.stop(); - } -}