phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/inc/infowidgetengine.h
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 40 bab96b7ed1a4
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
     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 INFOWIDGETENGINE_H_
       
    19 #define INFOWIDGETENGINE_H_
       
    20 
       
    21 
       
    22 #include <QObject>
       
    23 #include <QString>
       
    24 
       
    25 class InfoWidgetNetworkHandler;
       
    26 class InfoWidgetSatHandler;
       
    27 class InfoWidgetLineHandler;
       
    28 
       
    29 class InfoWidgetEngine : public QObject 
       
    30     {
       
    31     Q_OBJECT
       
    32     
       
    33 public:     
       
    34     
       
    35     enum HandlerEntity {
       
    36         NotDefined = 0, 
       
    37         NetworkHandler, 
       
    38         SatHandler, 
       
    39         LineHandler
       
    40     };
       
    41     
       
    42     class ModelData {    
       
    43     public: 
       
    44         int mcnIndicatorType() const { return m_mcnIndicatorType; }; 
       
    45         void setMcnIndicatorType(const int type){ m_mcnIndicatorType = type; };
       
    46         
       
    47         int homeZoneIndicatorType() const { return m_homeZoneIndicatorType; }; 
       
    48         void setHomeZoneIndicatorType(const int type){ m_homeZoneIndicatorType = type; };
       
    49 
       
    50         int activeLine() const { return m_activeLine; }; 
       
    51         void setActiveLine(const int line){ m_activeLine = line; };
       
    52 
       
    53         const QString& mcnName() const { return m_mcnName; };
       
    54         void setMcnName(const QString& name){ m_mcnName = name; };
       
    55 
       
    56         const QString& serviceProviderName() const { return m_serviceProviderName; };
       
    57         void setServiceProviderName(const QString& name){ m_serviceProviderName = name; };
       
    58         
       
    59         bool serviceProviderNameDisplayRequired() const { 
       
    60             return m_serviceProviderNameDisplayRequired; };
       
    61         void setServiceProviderNameDisplayRequired(bool required){ 
       
    62             m_serviceProviderNameDisplayRequired = required; };
       
    63         
       
    64         const QString& homeZoneTextTag() const { return m_homeZoneTextTag; };
       
    65         void setHomeZoneTextTag(const QString& tag){ m_homeZoneTextTag = tag; };
       
    66 
       
    67         const QString& satDisplayText() const { return m_satDisplayText; };
       
    68         void setSatDisplayText(const QString& text){ m_satDisplayText = text; };
       
    69         
       
    70     private: 
       
    71         int m_mcnIndicatorType; 
       
    72         int m_homeZoneIndicatorType;
       
    73         int m_activeLine; 
       
    74         bool m_serviceProviderNameDisplayRequired; 
       
    75         
       
    76         QString m_mcnName;
       
    77         QString m_serviceProviderName;
       
    78         QString m_homeZoneTextTag;
       
    79         QString m_satDisplayText;
       
    80     }; 
       
    81     
       
    82 public:
       
    83     InfoWidgetEngine(QObject *parent = 0);
       
    84     ~InfoWidgetEngine();    
       
    85     
       
    86     const InfoWidgetEngine::ModelData &modelData() const;  
       
    87     
       
    88     void logModelData();
       
    89     
       
    90 signals:
       
    91     void modelError(int operation, int errorCode);
       
    92     void modelChanged(); 
       
    93     
       
    94 public slots: 
       
    95     void updateNetworkDataToModel();
       
    96     void updateSatDataToModel();
       
    97     void updateLineDataToModel();
       
    98 
       
    99     void handleNetworkError(int operation, int errorCode); 
       
   100     void handleSatError(int operation, int errorCode); 
       
   101     void handleLineError(int operation, int errorCode);
       
   102     
       
   103     void suspend(); 
       
   104     void resume();
       
   105     
       
   106     void preferenceChanged(int option, int displaySetting);
       
   107     
       
   108 private: 
       
   109     ModelData m_modelData;
       
   110     
       
   111     // Own
       
   112     QScopedPointer<InfoWidgetNetworkHandler> m_networkHandler;
       
   113     QScopedPointer<InfoWidgetSatHandler> m_satHandler;
       
   114     }; 
       
   115 
       
   116 #endif /* INFOWIDGETENGINE_H_ */
       
   117 
       
   118