equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 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: Menu All Applications state. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QSize> |
|
19 #include <QTimer> |
|
20 #include "hsmenuitemmodel.h" |
|
21 #include "hsiconsidleloader.h" |
|
22 |
|
23 /*! |
|
24 Constructor |
|
25 \param model with defined icons |
|
26 \param pointer to parent object |
|
27 */ |
|
28 HsIconsIdleLoader::HsIconsIdleLoader(HsMenuItemModel *model, QObject *parent): |
|
29 QObject(parent), |
|
30 mModel(model), |
|
31 mTimer(NULL) |
|
32 { |
|
33 mTimer = new QTimer(this); |
|
34 connect(mTimer, SIGNAL(timeout()), this, SLOT(processWhenIdle())); |
|
35 mTimer->start(0); // NOTE: zero for idle |
|
36 } |
|
37 |
|
38 /*! |
|
39 Destructor |
|
40 */ |
|
41 HsIconsIdleLoader::~HsIconsIdleLoader() |
|
42 { |
|
43 mTimer->stop(); |
|
44 } |
|
45 |
|
46 /*! |
|
47 Preloading icons if idle |
|
48 \retval void |
|
49 */ |
|
50 void HsIconsIdleLoader::processWhenIdle() |
|
51 { |
|
52 const QSize iconSize(mModel->getIconSize()); |
|
53 for (int i=0; i<mModel->rowCount(); i++) { |
|
54 QModelIndex idx = mModel->index(i); |
|
55 mModel->entry(idx)->makeIcon(iconSize); |
|
56 } |
|
57 mTimer->stop(); // No more timing |
|
58 } |
|
59 |