screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/src/snsrindicatorwidget.cpp
changeset 86 e4f038c420f7
parent 62 341166945d65
equal deleted inserted replaced
81:7dd137878ff8 86:e4f038c420f7
    41 /*!
    41 /*!
    42     Constructs a new SnsrIndicatorWidget.
    42     Constructs a new SnsrIndicatorWidget.
    43     \param parent Parent object.
    43     \param parent Parent object.
    44  */
    44  */
    45 SnsrIndicatorWidget::SnsrIndicatorWidget(QGraphicsItem* parent):
    45 SnsrIndicatorWidget::SnsrIndicatorWidget(QGraphicsItem* parent):
    46     HbWidget(parent), mLayoutType(IndicatorsCentered)
    46     HbWidget(parent), mLayoutType(IndicatorsCentered), mPowerSaveModeColor(false)
    47 {
    47 {
    48     HbStyleLoader::registerFilePath(gIndicatorCssFilePath);
    48     HbStyleLoader::registerFilePath(gIndicatorCssFilePath);
    49     HbStyleLoader::registerFilePath(gIndicatorWidgetMLFilePath);
    49     HbStyleLoader::registerFilePath(gIndicatorWidgetMLFilePath);
    50     
    50     
    51     // TODO: will some color variables be added into hbcolorgroup.css so
    51     // TODO: will some color variables be added into hbcolorgroup.css so
    96         setSizePolicy(hSizePolicy,QSizePolicy::Preferred);
    96         setSizePolicy(hSizePolicy,QSizePolicy::Preferred);
    97     }
    97     }
    98 } 
    98 } 
    99 
    99 
   100 /*!
   100 /*!
       
   101     Set powersave mode status. If save mode is true then we use
       
   102     by default Qt::white as color. Otherwise we use themed color.
       
   103  */
       
   104 void SnsrIndicatorWidget::setPowerSaveModeColor(bool savemode)
       
   105 {
       
   106     mPowerSaveModeColor = savemode;
       
   107 }
       
   108 
       
   109 
       
   110 /*!
   101     This is called whenever indicators' status changes: parameter list
   111     This is called whenever indicators' status changes: parameter list
   102     tells which indicators should be shown at the given moment. All
   112     tells which indicators should be shown at the given moment. All
   103     previously shown indicators should be hidden and show only these
   113     previously shown indicators should be hidden and show only these
   104     indicators passed as a parameter. 
   114     indicators passed as a parameter. 
   105  */
   115  */
   113     removeAllIndicators();
   123     removeAllIndicators();
   114 
   124 
   115     // TODO: after wk18 color is lost after icon name is set again - bug or what?
   125     // TODO: after wk18 color is lost after icon name is set again - bug or what?
   116     // workaround: ask color from theme and set it again here
   126     // workaround: ask color from theme and set it again here
   117     // If this must be left here, then change back-up color to white?
   127     // If this must be left here, then change back-up color to white?
   118     QColor iconColor = HbColorScheme::color("snsrforeground"); // TODO: final variable name?
   128     QColor iconColor = HbColorScheme::color("qtc_screensaver");
   119     if (iconColor.spec() == QColor::Invalid ) {
   129     if (iconColor.spec() == QColor::Invalid ) {
   120         iconColor = Qt::magenta;
   130         iconColor = Qt::white;
   121     }
   131     }
       
   132 
       
   133     if ( mPowerSaveModeColor ) {        
       
   134         iconColor = Qt::white;
       
   135     }
       
   136     
   122     // update icon paths for items that are gonna be shown
   137     // update icon paths for items that are gonna be shown
   123     for (int i=0; i < indicatorAmount && i < mIcons.size(); ++i) {
   138     for (int i=0; i < indicatorAmount && i < mIcons.size(); ++i) {
   124         mIcons.at(i)->setIconName(indicators.at(i).iconPath);
   139         mIcons.at(i)->setIconName(indicators.at(i).iconPath);
   125         mIcons.at(i)->setFlags(HbIcon::Colorized);
   140         mIcons.at(i)->setFlags(HbIcon::Colorized);
   126         mIcons.at(i)->setColor(iconColor);        
   141         mIcons.at(i)->setColor(iconColor);