equal
deleted
inserted
replaced
18 // System includes |
18 // System includes |
19 |
19 |
20 // User includes |
20 // User includes |
21 #include "radiofadinglabel.h" |
21 #include "radiofadinglabel.h" |
22 #include "radiologger.h" |
22 #include "radiologger.h" |
23 #include "radiouiutilities.h" |
23 #include "radioutil.h" |
24 |
24 |
25 // Constants |
25 // Constants |
26 const QString KHideEffect = "hide"; |
26 const QString HIDE_EFFECT = "hide"; |
27 const QString KShowEffect = "show"; |
27 const QString SHOW_EFFECT = "show"; |
28 |
28 |
29 #ifdef USE_DEPRECATED_ORBIT_APIS |
29 #ifdef USE_DEPRECATED_ORBIT_APIS |
30 # define SET_CONTENT setText |
30 # define SET_CONTENT setText |
31 # define GET_CONTENT text |
31 # define GET_CONTENT text |
32 #else |
32 #else |
40 RadioFadingLabel::RadioFadingLabel( QGraphicsItem* parent ) : |
40 RadioFadingLabel::RadioFadingLabel( QGraphicsItem* parent ) : |
41 HbLabel( parent ), |
41 HbLabel( parent ), |
42 mFadingEnabled( false ) |
42 mFadingEnabled( false ) |
43 { |
43 { |
44 QEffectList effectList; |
44 QEffectList effectList; |
45 // effectList.append( EffectInfo( this, ":/effects/fade_in.fxml", KShowEffect ) ); |
45 // effectList.append( EffectInfo( this, ":/effects/fade_in.fxml", SHOW_EFFECT ) ); |
46 // effectList.append( EffectInfo( this, ":/effects/fade_out.fxml", KHideEffect ) ); |
46 // effectList.append( EffectInfo( this, ":/effects/fade_out.fxml", HIDE_EFFECT ) ); |
47 RadioUiUtilities::addEffects( effectList ); |
47 RadioUtil::addEffects( effectList ); |
48 } |
48 } |
49 |
49 |
50 /*! |
50 /*! |
51 * |
51 * |
52 */ |
52 */ |
76 parentItem() && parentItem()->isVisible() && // Parent is visible |
76 parentItem() && parentItem()->isVisible() && // Parent is visible |
77 mFadingEnabled ) { // Fading is enabled |
77 mFadingEnabled ) { // Fading is enabled |
78 if ( newText.isEmpty() ) { |
78 if ( newText.isEmpty() ) { |
79 if ( isVisible() ) { |
79 if ( isVisible() ) { |
80 mTextHolder = ""; |
80 mTextHolder = ""; |
81 startEffect( KHideEffect, "effectFinished" ); |
81 startEffect( HIDE_EFFECT, "effectFinished" ); |
82 } |
82 } |
83 } else { |
83 } else { |
84 if ( GET_CONTENT().isEmpty() ) { |
84 if ( GET_CONTENT().isEmpty() ) { |
85 HbLabel::SET_CONTENT( trimHtml( newText ) ); |
85 HbLabel::SET_CONTENT( trimHtml( newText ) ); |
86 startEffect( KShowEffect ); |
86 startEffect( SHOW_EFFECT ); |
87 } else { |
87 } else { |
88 mTextHolder = newText; |
88 mTextHolder = newText; |
89 startEffect( KHideEffect, "effectFinished" ); |
89 startEffect( HIDE_EFFECT, "effectFinished" ); |
90 } |
90 } |
91 } |
91 } |
92 } else { |
92 } else { |
93 HbLabel::SET_CONTENT( trimHtml( newText ) ); |
93 HbLabel::SET_CONTENT( trimHtml( newText ) ); |
94 } |
94 } |
101 void RadioFadingLabel::effectFinished( HbEffect::EffectStatus status ) |
101 void RadioFadingLabel::effectFinished( HbEffect::EffectStatus status ) |
102 { |
102 { |
103 if ( status.reason == Hb::EffectFinished ) { |
103 if ( status.reason == Hb::EffectFinished ) { |
104 HbLabel::SET_CONTENT( trimHtml( mTextHolder ) ); |
104 HbLabel::SET_CONTENT( trimHtml( mTextHolder ) ); |
105 if ( !mTextHolder.isEmpty() ) { |
105 if ( !mTextHolder.isEmpty() ) { |
106 HbEffect::start( this, KShowEffect ); |
106 HbEffect::start( this, SHOW_EFFECT ); |
107 } |
107 } |
108 mTextHolder = ""; |
108 mTextHolder = ""; |
109 } |
109 } |
110 } |
110 } |
111 |
111 |