videocollection/videocollectionview/src/videohintwidget.cpp
changeset 36 8aed59de29f9
parent 35 3738fe97f027
child 41 229f037ce963
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
    13 *
    13 *
    14 * Description:   Videolist content widget implementation
    14 * Description:   Videolist content widget implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 // Version : %version: 13 %
       
    19 
       
    20 // INCLUDE FILES
    18 #include <hbpushbutton.h>
    21 #include <hbpushbutton.h>
    19 #include <hblabel.h>
    22 #include <hblabel.h>
    20 #include <qgraphicsitem.h>
    23 #include <qgraphicsitem.h>
    21 #include <hbinstance.h>
    24 #include <hbinstance.h>
    22 
    25 
    23 #include "videohintwidget.h"
    26 #include "videohintwidget.h"
    24 #include "videocollectionuiloader.h"
    27 #include "videocollectionuiloader.h"
    25 #include "videocollectionviewutils.h"
    28 #include "videocollectionviewutils.h"
       
    29 #include "videocollectiontrace.h"
    26 
    30 
    27 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    28 // Constructor
    32 // Constructor
    29 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    30 //
    34 //
    31 VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
    35 VideoHintWidget::VideoHintWidget( VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent ) 
    32 HbWidget(parent),
    36     : HbWidget( parent )
    33 mUiLoader(uiLoader),
    37     , mUiLoader( uiLoader )
    34 mServiceIcon(0),
    38     , mServiceIcon( 0 )
    35 mAddVideosIcon(0),
    39     , mAddVideosIcon( 0 )
    36 mCurrentLevel(AllVideos),
    40     , mCurrentLevel( AllVideos )
    37 mButtonShown(false),
    41     , mButtonShown( false )
    38 mActivated(false)
    42     , mActivated( false )
    39 {
    43 {
       
    44 	FUNC_LOG;
    40     // NOP
    45     // NOP
    41 }
    46 }
    42 
    47 
    43 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    44 // Destructor
    49 // Destructor
    45 // ---------------------------------------------------------------------------
    50 // ---------------------------------------------------------------------------
    46 //
    51 //
    47 VideoHintWidget::~VideoHintWidget()
    52 VideoHintWidget::~VideoHintWidget()
    48 {
    53 {
       
    54 	FUNC_LOG;
    49     delete mServiceIcon;
    55     delete mServiceIcon;
    50     delete mAddVideosIcon;
    56     delete mAddVideosIcon;
    51 }
    57 }
    52 
    58 
    53 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    54 // initialize
    60 // initialize
    55 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    56 //
    62 //
    57 int VideoHintWidget::initialize()
    63 int VideoHintWidget::initialize()
    58 {
    64 {
       
    65 	FUNC_LOG;
    59     VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance();
    66     VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance();
    60     return utils.getServiceIconStrings(mServiceIconString, mServiceIconPressedString);
    67     return utils.getServiceIconStrings(mServiceIconString, mServiceIconPressedString);
    61 }
    68 }
    62 
    69 
    63 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    64 // setLevel
    71 // setLevel
    65 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    66 //
    73 //
    67 void VideoHintWidget::setLevel(HintLevel level)
    74 void VideoHintWidget::setLevel(HintLevel level)
    68 {
    75 {
       
    76 	FUNC_LOG;
       
    77 	INFO_1("VideoHintWidget::setLevel() level: %d", level);
    69     mCurrentLevel = level;
    78     mCurrentLevel = level;
    70     if(mActivated) {
    79     if(mActivated) {
    71         updateUiComponents();
    80         updateUiComponents();
    72     }
    81     }
    73 }
    82 }
    76 // setButtonShown
    85 // setButtonShown
    77 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    78 //
    87 //
    79 void VideoHintWidget::setButtonShown(bool shown)
    88 void VideoHintWidget::setButtonShown(bool shown)
    80 {
    89 {
       
    90 	FUNC_LOG;
       
    91 	INFO_1("VideoHintWidget::setButtonShown() shown: %d", shown);
    81     mButtonShown = shown;
    92     mButtonShown = shown;
    82     if(mActivated) {
    93     if(mActivated) {
    83         updateUiComponents();
    94         updateUiComponents();
    84     }
    95     }
    85 }
    96 }
    88 // orientationChanged
    99 // orientationChanged
    89 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
    90 //
   101 //
    91 void VideoHintWidget::orientationChangedSlot(Qt::Orientation targetOrientation)
   102 void VideoHintWidget::orientationChangedSlot(Qt::Orientation targetOrientation)
    92 {
   103 {
       
   104 	FUNC_LOG;
    93     Q_UNUSED(targetOrientation);
   105     Q_UNUSED(targetOrientation);
    94     updateUiComponents();
   106     updateUiComponents();
    95 }
   107 }
    96 
   108 
    97 // ---------------------------------------------------------------------------
   109 // ---------------------------------------------------------------------------
    98 // activate
   110 // activate
    99 // ---------------------------------------------------------------------------
   111 // ---------------------------------------------------------------------------
   100 //
   112 //
   101 void VideoHintWidget::activate()
   113 void VideoHintWidget::activate()
   102 {
   114 {
       
   115 	FUNC_LOG;
   103     if (!mActivated)
   116     if (!mActivated)
   104     {
   117     {
   105         if(mServiceIconString.isEmpty() || 
   118         if(mServiceIconString.isEmpty() || 
   106            mServiceIconPressedString.isEmpty())
   119            mServiceIconPressedString.isEmpty())
   107         {
   120         {
   114             this, SLOT(orientationChangedSlot(Qt::Orientation)));
   127             this, SLOT(orientationChangedSlot(Qt::Orientation)));
   115         
   128         
   116         mServiceIcon = new HbIcon(mServiceIconString);
   129         mServiceIcon = new HbIcon(mServiceIconString);
   117         mServiceIcon->setIconName(mServiceIconPressedString, QIcon::Normal, QIcon::On);
   130         mServiceIcon->setIconName(mServiceIconPressedString, QIcon::Normal, QIcon::On);
   118         
   131         
   119         mAddVideosIcon = new HbIcon(":/images/mono_video_addvideos.svg");
   132         mAddVideosIcon = new HbIcon("qtg_mono_add_to_video_collection");
   120         
   133         
   121         updateUiComponents();
   134         updateUiComponents();
   122         
   135         
   123         setVisible(true);
   136         setVisible(true);
   124         
   137         
   130 // deactivate
   143 // deactivate
   131 // ---------------------------------------------------------------------------
   144 // ---------------------------------------------------------------------------
   132 //
   145 //
   133 void VideoHintWidget::deactivate()
   146 void VideoHintWidget::deactivate()
   134 {
   147 {
       
   148 	FUNC_LOG;
   135     if (mActivated)
   149     if (mActivated)
   136     {
   150     {
   137         mActivated = false;
   151         mActivated = false;
   138         
   152         
   139         setVisible(false);
   153         setVisible(false);
   166 // updateUiComponents
   180 // updateUiComponents
   167 // ---------------------------------------------------------------------------
   181 // ---------------------------------------------------------------------------
   168 //
   182 //
   169 void VideoHintWidget::updateUiComponents()
   183 void VideoHintWidget::updateUiComponents()
   170 {
   184 {
       
   185 	FUNC_LOG;
   171     HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   186     HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   172     if (mainWnd)
   187     if (mainWnd)
   173     {
   188     {
   174         HbPushButton *serviceButton =
   189         HbPushButton *serviceButton =
   175             mUiLoader->findWidget<HbPushButton>(
   190             mUiLoader->findWidget<HbPushButton>(