radioapp/radiouiengine/inc/radiotimerpool.h
changeset 57 21be958eb3ce
equal deleted inserted replaced
56:04837bf3a628 57:21be958eb3ce
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef RADIOTIMERPOOL_H
       
    19 #define RADIOTIMERPOOL_H
       
    20 
       
    21 // System includes
       
    22 #include <QObject>
       
    23 #include <QVariant>
       
    24 #include <QScopedPointer>
       
    25 
       
    26 // User includes
       
    27 
       
    28 // Forward declarations
       
    29 class QTimer;
       
    30 
       
    31 class RadioTimerPool : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35     class RadioTimerItem
       
    36     {
       
    37     public:
       
    38 
       
    39         RadioTimerItem( RadioTimerPool* parent );
       
    40         ~RadioTimerItem();
       
    41         void reset();
       
    42 
       
    43         QScopedPointer<QTimer>  mTimer;
       
    44         QObject*                mReceiver;
       
    45         QString                 mReceiverMember;
       
    46         int                     mId;
       
    47         QVariant                mParam;
       
    48     };
       
    49 
       
    50 public:
       
    51 
       
    52     RadioTimerPool( QObject* parent = 0 );
       
    53     ~RadioTimerPool();
       
    54 
       
    55     void startTimer( int msec, int id, QObject* receiver, const char* member, QVariant param );
       
    56     void cancelTimer( int id, const QObject* receiver );
       
    57     bool isTimerActive( int id, const QObject* receiver ) const;
       
    58 
       
    59     void freeUnusedTimers();
       
    60 
       
    61 private Q_SLOTS:
       
    62 
       
    63     void timerFired();
       
    64 
       
    65 private:
       
    66 
       
    67     RadioTimerPool::RadioTimerItem* createItem();
       
    68 
       
    69 private: // data
       
    70 
       
    71     QMap<QTimer*,RadioTimerItem*>   mTimerMap;
       
    72 
       
    73 };
       
    74 
       
    75 
       
    76 #endif // RADIOTIMERPOOL_H