videocollection/tsrc/stubs/src/videocollectionviewutils.cpp
author hgs
Fri, 16 Apr 2010 18:13:14 +0300
changeset 36 8aed59de29f9
parent 35 3738fe97f027
child 39 f6d44a0cd476
permissions -rw-r--r--
201015
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: video collection view plugin's ui utils class
hgs
parents:
diff changeset
    15
* 
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include "videocollectionviewutils.h"
hgs
parents:
diff changeset
    19
#include "videocollectionviewutilsdata.h"
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
int VideoCollectionViewUtilsData::mLastError = 0;
hgs
parents:
diff changeset
    22
bool VideoCollectionViewUtilsData::mLoadSortingValuesFails = false;
hgs
parents:
diff changeset
    23
bool VideoCollectionViewUtilsData::mGetServiceIconStringsFails = false;
36
hgs
parents: 35
diff changeset
    24
int VideoCollectionViewUtilsData::mVideoSortRole = -1;
hgs
parents: 35
diff changeset
    25
int VideoCollectionViewUtilsData::mCollectionSortRole = -1;
hgs
parents: 35
diff changeset
    26
Qt::SortOrder VideoCollectionViewUtilsData::mVideoSortOrder = Qt::AscendingOrder;
hgs
parents: 35
diff changeset
    27
Qt::SortOrder VideoCollectionViewUtilsData::mCollectionSortOrder = Qt::AscendingOrder;
34
hgs
parents:
diff changeset
    28
QString VideoCollectionViewUtilsData::mIconString = "";
hgs
parents:
diff changeset
    29
QString VideoCollectionViewUtilsData::mPressedString = "";
35
hgs
parents: 34
diff changeset
    30
QVariant VideoCollectionViewUtilsData::mLastStatusAdditional = QVariant();
34
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
hgs
parents:
diff changeset
    33
{
hgs
parents:
diff changeset
    34
     static VideoCollectionViewUtils _popupInstance;
hgs
parents:
diff changeset
    35
     return _popupInstance;
hgs
parents:
diff changeset
    36
}
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
VideoCollectionViewUtils::VideoCollectionViewUtils():
36
hgs
parents: 35
diff changeset
    39
mVideosSortRole(-1),
hgs
parents: 35
diff changeset
    40
mCollectionsSortRole(-1),
hgs
parents: 35
diff changeset
    41
mVideosSortOrder(Qt::AscendingOrder),
hgs
parents: 35
diff changeset
    42
mCollectionsSortOrder(Qt::AscendingOrder)
34
hgs
parents:
diff changeset
    43
{
hgs
parents:
diff changeset
    44
    // not stubbed
hgs
parents:
diff changeset
    45
}
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
VideoCollectionViewUtils::~VideoCollectionViewUtils()
hgs
parents:
diff changeset
    48
{
hgs
parents:
diff changeset
    49
    VideoCollectionViewUtilsData::reset();
hgs
parents:
diff changeset
    50
}
hgs
parents:
diff changeset
    51
36
hgs
parents: 35
diff changeset
    52
int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order, VideoCollectionCommon::TCollectionLevels target)
34
hgs
parents:
diff changeset
    53
{
36
hgs
parents: 35
diff changeset
    54
    int status(0);
hgs
parents: 35
diff changeset
    55
    if(target == VideoCollectionCommon::ELevelCategory )
hgs
parents: 35
diff changeset
    56
    {
hgs
parents: 35
diff changeset
    57
        VideoCollectionViewUtilsData::mCollectionSortRole = role;
hgs
parents: 35
diff changeset
    58
        mCollectionsSortRole = role;
hgs
parents: 35
diff changeset
    59
        VideoCollectionViewUtilsData::mCollectionSortOrder = order;
hgs
parents: 35
diff changeset
    60
        mCollectionsSortOrder = order;
hgs
parents: 35
diff changeset
    61
    }
hgs
parents: 35
diff changeset
    62
    else if(target > VideoCollectionCommon::ELevelCategory && 
hgs
parents: 35
diff changeset
    63
            target <= VideoCollectionCommon::ELevelAlbum)
hgs
parents: 35
diff changeset
    64
    {
hgs
parents: 35
diff changeset
    65
        VideoCollectionViewUtilsData::mVideoSortRole = role;
hgs
parents: 35
diff changeset
    66
        mVideosSortRole = role;
hgs
parents: 35
diff changeset
    67
        VideoCollectionViewUtilsData::mVideoSortOrder = order;
hgs
parents: 35
diff changeset
    68
        mVideosSortOrder = order;
hgs
parents: 35
diff changeset
    69
    }
hgs
parents: 35
diff changeset
    70
    else
hgs
parents: 35
diff changeset
    71
    {
hgs
parents: 35
diff changeset
    72
        status = -1;
hgs
parents: 35
diff changeset
    73
    }
hgs
parents: 35
diff changeset
    74
    return status;
34
hgs
parents:
diff changeset
    75
}
hgs
parents:
diff changeset
    76
36
hgs
parents: 35
diff changeset
    77
int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order,  VideoCollectionCommon::TCollectionLevels target)
34
hgs
parents:
diff changeset
    78
{
hgs
parents:
diff changeset
    79
    if (VideoCollectionViewUtilsData::mLoadSortingValuesFails)
hgs
parents:
diff changeset
    80
    {
hgs
parents:
diff changeset
    81
        return -1;
hgs
parents:
diff changeset
    82
    }
36
hgs
parents: 35
diff changeset
    83
    if(target == VideoCollectionCommon::ELevelCategory )
hgs
parents: 35
diff changeset
    84
    {
hgs
parents: 35
diff changeset
    85
        role = VideoCollectionViewUtilsData::mCollectionSortRole;
hgs
parents: 35
diff changeset
    86
        order = VideoCollectionViewUtilsData::mCollectionSortOrder;
hgs
parents: 35
diff changeset
    87
    }
hgs
parents: 35
diff changeset
    88
    else if(target > VideoCollectionCommon::ELevelCategory && 
hgs
parents: 35
diff changeset
    89
            target <= VideoCollectionCommon::ELevelAlbum)
hgs
parents: 35
diff changeset
    90
    {
hgs
parents: 35
diff changeset
    91
        role = VideoCollectionViewUtilsData::mVideoSortRole;
hgs
parents: 35
diff changeset
    92
        order = VideoCollectionViewUtilsData::mVideoSortOrder;
hgs
parents: 35
diff changeset
    93
    }
hgs
parents: 35
diff changeset
    94
    else
hgs
parents: 35
diff changeset
    95
    {
hgs
parents: 35
diff changeset
    96
        return -1;
hgs
parents: 35
diff changeset
    97
    }
34
hgs
parents:
diff changeset
    98
    return 0;
hgs
parents:
diff changeset
    99
}
hgs
parents:
diff changeset
   100
hgs
parents:
diff changeset
   101
int VideoCollectionViewUtils::getServiceIconStrings(QString& icon, 
hgs
parents:
diff changeset
   102
    QString& iconPressed)
hgs
parents:
diff changeset
   103
{
hgs
parents:
diff changeset
   104
    if (VideoCollectionViewUtilsData::mGetServiceIconStringsFails)
hgs
parents:
diff changeset
   105
    {
hgs
parents:
diff changeset
   106
        return -1;
hgs
parents:
diff changeset
   107
    }
hgs
parents:
diff changeset
   108
    
hgs
parents:
diff changeset
   109
    icon = VideoCollectionViewUtilsData::mIconString;
hgs
parents:
diff changeset
   110
    iconPressed = VideoCollectionViewUtilsData::mPressedString;
hgs
parents:
diff changeset
   111
    
hgs
parents:
diff changeset
   112
    return 0;
hgs
parents:
diff changeset
   113
}
hgs
parents:
diff changeset
   114
hgs
parents:
diff changeset
   115
QString VideoCollectionViewUtils::getServiceUriString()
hgs
parents:
diff changeset
   116
{
hgs
parents:
diff changeset
   117
    // not stubbed
hgs
parents:
diff changeset
   118
    return QString();
hgs
parents:
diff changeset
   119
}
hgs
parents:
diff changeset
   120
hgs
parents:
diff changeset
   121
void VideoCollectionViewUtils::initListView(HbListView *view)
hgs
parents:
diff changeset
   122
{
hgs
parents:
diff changeset
   123
    Q_UNUSED(view);
hgs
parents:
diff changeset
   124
    // not stubbed
hgs
parents:
diff changeset
   125
}
hgs
parents:
diff changeset
   126
hgs
parents:
diff changeset
   127
void VideoCollectionViewUtils::sortModel(VideoSortFilterProxyModel *model,
36
hgs
parents: 35
diff changeset
   128
    bool async, VideoCollectionCommon::TCollectionLevels target)
34
hgs
parents:
diff changeset
   129
{
hgs
parents:
diff changeset
   130
    Q_UNUSED(model);
hgs
parents:
diff changeset
   131
    Q_UNUSED(async);
36
hgs
parents: 35
diff changeset
   132
    Q_UNUSED(target);
34
hgs
parents:
diff changeset
   133
    // not stubbed
hgs
parents:
diff changeset
   134
}
hgs
parents:
diff changeset
   135
hgs
parents:
diff changeset
   136
void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
hgs
parents:
diff changeset
   137
{
35
hgs
parents: 34
diff changeset
   138
    VideoCollectionViewUtilsData::mLastStatusAdditional = additional;
34
hgs
parents:
diff changeset
   139
    VideoCollectionViewUtilsData::mLastError = statusCode;
hgs
parents:
diff changeset
   140
}