phoneuis/bubblemanager2/bubblecore/src/bubbleutils.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 30 ebdbd102c78a
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    88         }
    88         }
    89         break;
    89         break;
    90     }
    90     }
    91 
    91 
    92     case BubbleManager::OnHold:
    92     case BubbleManager::OnHold:
       
    93     {
       
    94         if ( header.secondaryCli().length() ) {
       
    95             setText(textLine1, header.cli(), header.cliClipDirection());
       
    96             setText(textLine2, header.secondaryCli(),
       
    97                     header.secondaryCliClipDirection());
       
    98             setText(textLine3, header.text(), header.textClipDirection());
       
    99             cliLineNumber = 1;
       
   100         } else {
       
   101             setText(textLine1, header.cli(), header.cliClipDirection());
       
   102             setText(textLine2, header.text(), header.textClipDirection());
       
   103             cliLineNumber = 1;
       
   104         }
       
   105         break;
       
   106     }
       
   107 
    93     case BubbleManager::Disconnected:
   108     case BubbleManager::Disconnected:
    94     {
   109     {
    95         if ( header.secondaryCli().length() ) {
   110         if ( header.timerCost().length() ) {
    96             setText(textLine1, header.cli(), header.cliClipDirection());
       
    97             setText(textLine2, header.secondaryCli(),
       
    98                     header.secondaryCliClipDirection());
       
    99             setText(textLine3, header.text(), header.textClipDirection());
       
   100             cliLineNumber = 1;
       
   101         } else {
       
   102             setText(textLine1, header.cli(), header.cliClipDirection());
   111             setText(textLine1, header.cli(), header.cliClipDirection());
   103             setText(textLine2, header.text(), header.textClipDirection());
   112             setText(textLine2, header.text(), header.textClipDirection());
   104             cliLineNumber = 1;
   113             setText(textLine3, header.timerCost(), Qt::ElideRight);
   105         }
   114             cliLineNumber = 1;
   106         break;
   115             timerLineNumber = 3;
   107     }
   116         } else {
       
   117             if ( header.secondaryCli().length() ) {
       
   118                 setText(textLine1, header.cli(), header.cliClipDirection());
       
   119                 setText(textLine2, header.secondaryCli(),
       
   120                         header.secondaryCliClipDirection());
       
   121                 setText(textLine3, header.text(), header.textClipDirection());
       
   122                 cliLineNumber = 1;
       
   123             } else {
       
   124                 setText(textLine1, header.cli(), header.cliClipDirection());
       
   125                 setText(textLine2, header.text(), header.textClipDirection());
       
   126                 cliLineNumber = 1;
       
   127             }
       
   128         }
       
   129         break;
       
   130     }
       
   131 
   108 
   132 
   109     default:
   133     default:
   110         // do nothing
   134         // do nothing
   111         break;
   135         break;
   112     } // switch
   136     } // switch
   196     }
   220     }
   197 
   221 
   198     button.updatePrimitives();
   222     button.updatePrimitives();
   199 }
   223 }
   200 
   224 
   201 void BubbleUtils::setCallStatusIcon(
   225 void BubbleUtils::setIndicators(
   202     int callState,
   226     int callState,
   203     int callFlags,
   227     int callFlags,
   204     HbIconItem& icon)
   228     HbIconItem& indicator1,
   205 {
   229     HbIconItem& indicator2 )
   206     bool showIcon = true;
   230 {
   207 
   231     bool divertIndicator = (( callState == BubbleManagerIF::Incoming ) ||
   208     switch(callState) {
   232                             ( callState == BubbleManagerIF::Waiting )) &&
   209     case BubbleManagerIF::Incoming:
   233                            (callFlags & BubbleManagerIF::Diverted);
   210     case BubbleManagerIF::Alerting:
   234 
   211     case BubbleManagerIF::Waiting:
   235     bool cipheringIndicator = (callFlags & BubbleManagerIF::NoCiphering);
   212         // from bubble_icon_anim.axml
   236 
   213         if ( callFlags & BubbleManagerIF::VoIPCall ) {
   237     if (divertIndicator && cipheringIndicator) {
   214             icon.setIconName("voip_call_waiting_anim");
   238         indicator1.setIcon(HbIcon(QLatin1String("qtg_mono_ciphering_off")));
   215         } else if ( callFlags & BubbleManagerIF::Video ) {
   239         indicator1.show();
   216             icon.setIconName("video_call_waiting_anim");
   240         indicator2.setIcon(HbIcon(QLatin1String("qtg_mono_call_diverted")));
   217         } else {
   241         indicator2.show();
   218             icon.setIconName("voice_call_waiting_anim");
   242     } else if (cipheringIndicator) {
   219         }
   243         indicator1.setIcon(HbIcon(QLatin1String("qtg_mono_ciphering_off")));
   220         break;
   244         indicator1.show();
   221     case BubbleManagerIF::Outgoing:
   245         indicator2.setIcon(HbIcon());
   222     case BubbleManagerIF::Active:
   246         indicator2.hide();
   223         if ( callFlags & BubbleManagerIF::VoIPCall ) {
   247     } else if (divertIndicator) {
   224             icon.setIconName("qtg_large_voip_call_active");
   248         indicator1.setIcon(HbIcon(QLatin1String("qtg_mono_call_diverted")));
   225         } else if ( callFlags & BubbleManagerIF::Video ) {
   249         indicator1.show();
   226             icon.setIconName("qtg_large_video_call_active");
   250         indicator2.setIcon(HbIcon());
   227         } else {
   251         indicator2.hide();
   228             icon.setIconName("qtg_large_active_call");
   252     } else {
   229         }
   253         indicator1.setIcon(HbIcon());
   230         break;
   254         indicator1.hide();
   231     case BubbleManagerIF::OnHold:
   255         indicator2.setIcon(HbIcon());
   232         if ( callFlags & BubbleManagerIF::VoIPCall ) {
   256         indicator2.hide();
   233             icon.setIconName("qtg_large_voip_call_waiting");
   257     }
   234         } else if ( callFlags & BubbleManagerIF::Video ) {
   258 }
   235             icon.setIconName("qtg_large_video_call_waiting");
       
   236         } else {
       
   237             icon.setIconName("qtg_large_waiting_call");
       
   238         }
       
   239         break;
       
   240     case BubbleManagerIF::Disconnected:
       
   241     case BubbleManagerIF::AlertToDisconnected:
       
   242         if ( callFlags & BubbleManagerIF::VoIPCall ) {
       
   243             icon.setIconName("qtg_large_end_call");
       
   244         } else if ( callFlags & BubbleManagerIF::Video ) {
       
   245             icon.setIconName("qtg_large_end_call");
       
   246         } else {
       
   247             icon.setIconName("qtg_large_end_call");
       
   248         }
       
   249         break;
       
   250     default:
       
   251         icon.setIcon(HbIcon());
       
   252         showIcon = false;
       
   253         break;
       
   254     }
       
   255 
       
   256     if (showIcon) {
       
   257         icon.show();
       
   258     }
       
   259 }
       
   260 
       
   261 void BubbleUtils::setNumberTypeIcon(
       
   262     int callState,
       
   263     int callFlags,
       
   264     HbIconItem& icon)
       
   265 {
       
   266     if ( (( callState == BubbleManagerIF::Incoming ) ||
       
   267           ( callState == BubbleManagerIF::Waiting )) &&
       
   268          (callFlags & BubbleManagerIF::Diverted) ) {
       
   269         icon.setIcon( HbIcon(":/qtg_mono_call_diverted.svg") );
       
   270 
       
   271         // temporary, diverted icon is not yet in theme and
       
   272         // because of that css coloring doesn't work
       
   273         QColor color;
       
   274         color = HbColorScheme::color("qtc_list_item_title_normal");
       
   275         if (color.isValid()) {
       
   276             icon.setColor(Qt::white);
       
   277         }
       
   278 
       
   279         icon.show();
       
   280     } else {
       
   281         icon.setIcon( HbIcon() );
       
   282         icon.hide();
       
   283     }
       
   284 }
       
   285 
       
   286 void BubbleUtils::setCipheringIcon(
       
   287     int callState,
       
   288     int callFlags,
       
   289     HbIconItem& icon)
       
   290 {
       
   291     Q_UNUSED(callState)
       
   292 
       
   293     if (callFlags & BubbleManagerIF::NoCiphering) {
       
   294         icon.setIcon( HbIcon("qtg_mono_ciphering_off") );
       
   295         icon.show();
       
   296     } else {
       
   297         icon.setIcon( HbIcon() );
       
   298         icon.hide();
       
   299     }
       
   300 }
       
   301