logsui/logsapp/src/logspageindicatoritem.cpp
changeset 4 e52d42f9500c
parent 0 4a5361db8937
child 6 41c0a814d878
equal deleted inserted replaced
2:7119b73b84d6 4:e52d42f9500c
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <QGraphicsColorizeEffect>
    18 #include <QGraphicsColorizeEffect>
    19 #include <QPropertyAnimation>
    19 #include <QPropertyAnimation>
       
    20 #include <hbcolorscheme.h>
       
    21 #include <hbevent.h>
       
    22 #include "logspageindicatoritem.h"
       
    23 #include "logslogger.h"
    20 
    24 
    21 #include "logspageindicatoritem.h"
    25 const char logsNormalIconName[]    = "qtg_mono_tab_passive";
    22 
    26 const char logsHighlightIconName[] = "qtg_mono_tab_active";
    23 
    27 const char logsIconColor[] = "qtc_button_normal";//"qtc_default_main_pane_normal");//
    24 const char logsNormalIconName[]    = "qtg_graf_hspage_normal";//"qtg_mono_tab_passive";//
       
    25 const char logsHighlightIconName[] = "qtg_graf_hspage_highlight";//"qtg_mono_tab_active";//
       
    26   
    28   
    27 const int logsEffectDurationInMs = 1000;
    29 const int logsEffectDurationInMs = 1000;
    28 
    30 
    29 // -----------------------------------------------------------------------------
    31 // -----------------------------------------------------------------------------
    30 //
    32 //
    38         setIcon(HbIcon(logsHighlightIconName));
    40         setIcon(HbIcon(logsHighlightIconName));
    39     } else {
    41     } else {
    40         setIcon(HbIcon(logsNormalIconName));
    42         setIcon(HbIcon(logsNormalIconName));
    41     }
    43     }
    42 
    44 
       
    45     setFlags(HbIcon::Colorized);
       
    46     updateColor();
       
    47      
    43     QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect;
    48     QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect;
    44     effect->setColor(Qt::white);
    49     effect->setColor(Qt::white);
    45     effect->setStrength(0);
    50     effect->setStrength(0);
    46     effect->setEnabled(false);
    51     effect->setEnabled(false);
    47     setGraphicsEffect(effect);
    52     setGraphicsEffect(effect);
    83 
    88 
    84 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    85 //
    90 //
    86 // -----------------------------------------------------------------------------
    91 // -----------------------------------------------------------------------------
    87 //
    92 //
       
    93 void LogsPageIndicatorItem::changeEvent(QEvent * event)
       
    94 {
       
    95     if (event->type() == HbEvent::ThemeChanged) {
       
    96         LOGS_QDEBUG( "logs [UI] LogsPageIndicatorItem::changeEvent(), themeChanged" );
       
    97         updateColor();
       
    98     }
       
    99     HbIconItem::changeEvent(event);
       
   100 }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 void LogsPageIndicatorItem::updateColor()
       
   107 {
       
   108     QColor col = HbColorScheme::color(logsIconColor);
       
   109     if (col.isValid() && (color() != col) ) {
       
   110         setColor(col);
       
   111         LOGS_QDEBUG_2( "logs [UI] LogsPageIndicatorItem::updateColor(), color: ", col );
       
   112     }
       
   113 }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 // -----------------------------------------------------------------------------
       
   118 //
    88 void LogsPageIndicatorItem::startAnimation()
   119 void LogsPageIndicatorItem::startAnimation()
    89 {
   120 {
    90     graphicsEffect()->setEnabled(true);
   121     graphicsEffect()->setEnabled(true);
    91     setTransformOriginPoint(rect().center());
   122     setTransformOriginPoint(rect().center());
    92     QPropertyAnimation *animation = 
   123     QPropertyAnimation *animation =