phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/inc/infowidget.h
changeset 22 6bb1b21d2484
child 27 2f8f8080a020
equal deleted inserted replaced
21:92ab7f8d0eab 22:6bb1b21d2484
       
     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 INFOWIDGET_H
       
    19 #define INFOWIDGET_H
       
    20 
       
    21 #include <hbwidget.h>
       
    22 #include <QGraphicsSceneMouseEvent>
       
    23 #include <QFlags>
       
    24 #include "infowidgetlayoutmanager.h"
       
    25 
       
    26 class QLabel;
       
    27 class QGraphicsLinearLayout; 
       
    28 class HbDialog;
       
    29 class HbIconItem; 
       
    30 class HbMarqueeItem;
       
    31 class HbLabel; 
       
    32 class HbCheckBox; 
       
    33 class HbPushButton; 
       
    34 class InfoWidgetEngine; 
       
    35 class InfoWidgetPreferences;
       
    36 
       
    37 class InfoWidget : public HbWidget
       
    38 {
       
    39     Q_OBJECT
       
    40 
       
    41 public:    
       
    42     InfoWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
       
    43     ~InfoWidget();
       
    44 
       
    45 public: // From QGraphicsItem.
       
    46     QRectF boundingRect() const;
       
    47     QPainterPath shape() const; 
       
    48     QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;  
       
    49     QSizePolicy sizePolicy () const;  
       
    50     
       
    51 public: // Property definitions with read and write functions
       
    52     Q_PROPERTY(QString homeZoneDisplay READ homeZoneDisplay WRITE setHomeZoneDisplay)
       
    53     Q_PROPERTY(QString mcnDisplay READ mcnDisplay WRITE setMcnDisplay)
       
    54     Q_PROPERTY(QString activeLineDisplay READ activeLineDisplay WRITE setActiveLineDisplay)
       
    55     Q_PROPERTY(QString satDisplay READ satDisplay WRITE setSatDisplay)
       
    56     QString homeZoneDisplay();
       
    57     void setHomeZoneDisplay(QString value);
       
    58     QString mcnDisplay();
       
    59     void setMcnDisplay(QString value);
       
    60     QString activeLineDisplay();
       
    61     void setActiveLineDisplay(QString value);
       
    62     QString satDisplay();
       
    63     void setSatDisplay(QString value);
       
    64     
       
    65 protected:
       
    66     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 
       
    67     void mousePressEvent(QGraphicsSceneMouseEvent *event);
       
    68     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); 
       
    69     void mouseMoveEvent(QGraphicsSceneMouseEvent *event); 
       
    70     
       
    71     void updateInfoDisplay();
       
    72     void initializePreferences(); 
       
    73     
       
    74     void changeEvent(QEvent *event);
       
    75     
       
    76 private: 
       
    77     void updateItemsVisibility();
       
    78     void layoutInfoDisplay(); 
       
    79     void layoutSettingsDisplay(); 
       
    80     
       
    81     void initializeInfoDisplayItems(); 
       
    82     void initializeSettingsDisplayItems(); 
       
    83      
       
    84     void startChanges(); 
       
    85     void endChanges(); 
       
    86     
       
    87 public slots: 
       
    88     // Slots from HsWidget
       
    89     void onInitialize();
       
    90     void onUninitialize();
       
    91     void onShow();
       
    92     void onHide();
       
    93 
       
    94     // Info widget specific slots 
       
    95     void readModel(); 
       
    96     void handleModelError(int operation,int errorCode);  
       
    97     void homeZoneDisplaySettingChanged(int state);
       
    98     void mcnDisplaySettingChanged(int state);
       
    99     void activeLineDisplaySettingChanged(int state);
       
   100     void satDisplaySettingChanged(int state);
       
   101 
       
   102     void settingsEditingFinished();
       
   103     
       
   104 signals: 
       
   105     void setPreferences(const QStringList &names);
       
   106 
       
   107 private:
       
   108     Q_DISABLE_COPY(InfoWidget)
       
   109     
       
   110     // Engine for widget      
       
   111     InfoWidgetEngine *m_engine;
       
   112     
       
   113     // Widget preference store  
       
   114     InfoWidgetPreferences *m_preferences;
       
   115 
       
   116     // Layout for widget
       
   117     InfoWidgetLayoutManager *m_layoutManager;    
       
   118     QGraphicsLinearLayout *m_layout; 
       
   119     
       
   120     bool m_layoutChanging; 
       
   121     bool m_isDragEvent; 
       
   122     QColor m_backGroundColor;
       
   123     
       
   124 };
       
   125 
       
   126 
       
   127 #endif // INFOWIDGET_H
       
   128