diff -r 87476091b3f5 -r 1db7cc813a4e homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsiconsidleloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsiconsidleloader.cpp Fri Aug 06 13:36:36 2010 +0300 @@ -0,0 +1,59 @@ +/* + * 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: Menu All Applications state. + * + */ + +#include +#include +#include "hsmenuitemmodel.h" +#include "hsiconsidleloader.h" + +/*! + Constructor + \param model with defined icons + \param pointer to parent object + */ +HsIconsIdleLoader::HsIconsIdleLoader(HsMenuItemModel *model, QObject *parent): + QObject(parent), + mModel(model), + mTimer(NULL) +{ + mTimer = new QTimer(this); + connect(mTimer, SIGNAL(timeout()), this, SLOT(processWhenIdle())); + mTimer->start(0); // NOTE: zero for idle +} + +/*! + Destructor + */ +HsIconsIdleLoader::~HsIconsIdleLoader() +{ + mTimer->stop(); +} + +/*! + Preloading icons if idle + \retval void + */ +void HsIconsIdleLoader::processWhenIdle() +{ + const QSize iconSize(mModel->getIconSize()); + for (int i=0; irowCount(); i++) { + QModelIndex idx = mModel->index(i); + mModel->entry(idx)->makeIcon(iconSize); + } + mTimer->stop(); // No more timing +} +