videocollection/tsrc/stubs/src/videocollectionviewutils.cpp
author hgs
Fri, 03 Sep 2010 12:37:43 +0300
changeset 58 d2b028fd1f7d
parent 55 4bfa887905cf
permissions -rw-r--r--
201035
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;
58
hgs
parents: 55
diff changeset
    23
bool VideoCollectionViewUtilsData::mIsServiceValue = 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();
41
hgs
parents: 39
diff changeset
    31
VideoCollectionCommon::TCollectionLevels VideoCollectionViewUtilsData::mWidgetLevel = VideoCollectionCommon::ELevelVideos;
hgs
parents: 39
diff changeset
    32
TMPXItemId VideoCollectionViewUtilsData::mActivityCollectionId = TMPXItemId::InvalidId();
hgs
parents: 39
diff changeset
    33
QString VideoCollectionViewUtilsData::mActivityCollectionName = "";
44
hgs
parents: 41
diff changeset
    34
QList<QString> VideoCollectionViewUtilsData::mCenRepStringValues;
hgs
parents: 41
diff changeset
    35
QList<int> VideoCollectionViewUtilsData::mCenRepIntValues;
34
hgs
parents:
diff changeset
    36
hgs
parents:
diff changeset
    37
VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
hgs
parents:
diff changeset
    38
{
hgs
parents:
diff changeset
    39
     static VideoCollectionViewUtils _popupInstance;
hgs
parents:
diff changeset
    40
     return _popupInstance;
hgs
parents:
diff changeset
    41
}
hgs
parents:
diff changeset
    42
hgs
parents:
diff changeset
    43
VideoCollectionViewUtils::VideoCollectionViewUtils():
58
hgs
parents: 55
diff changeset
    44
mIsService(false),
36
hgs
parents: 35
diff changeset
    45
mVideosSortRole(-1),
hgs
parents: 35
diff changeset
    46
mCollectionsSortRole(-1),
hgs
parents: 35
diff changeset
    47
mVideosSortOrder(Qt::AscendingOrder),
hgs
parents: 35
diff changeset
    48
mCollectionsSortOrder(Qt::AscendingOrder)
34
hgs
parents:
diff changeset
    49
{
hgs
parents:
diff changeset
    50
    // not stubbed
hgs
parents:
diff changeset
    51
}
hgs
parents:
diff changeset
    52
hgs
parents:
diff changeset
    53
VideoCollectionViewUtils::~VideoCollectionViewUtils()
hgs
parents:
diff changeset
    54
{
hgs
parents:
diff changeset
    55
    VideoCollectionViewUtilsData::reset();
hgs
parents:
diff changeset
    56
}
hgs
parents:
diff changeset
    57
36
hgs
parents: 35
diff changeset
    58
int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order, VideoCollectionCommon::TCollectionLevels target)
34
hgs
parents:
diff changeset
    59
{
36
hgs
parents: 35
diff changeset
    60
    int status(0);
hgs
parents: 35
diff changeset
    61
    if(target == VideoCollectionCommon::ELevelCategory )
hgs
parents: 35
diff changeset
    62
    {
hgs
parents: 35
diff changeset
    63
        VideoCollectionViewUtilsData::mCollectionSortRole = role;
hgs
parents: 35
diff changeset
    64
        mCollectionsSortRole = role;
hgs
parents: 35
diff changeset
    65
        VideoCollectionViewUtilsData::mCollectionSortOrder = order;
hgs
parents: 35
diff changeset
    66
        mCollectionsSortOrder = order;
hgs
parents: 35
diff changeset
    67
    }
hgs
parents: 35
diff changeset
    68
    else if(target > VideoCollectionCommon::ELevelCategory && 
hgs
parents: 35
diff changeset
    69
            target <= VideoCollectionCommon::ELevelAlbum)
hgs
parents: 35
diff changeset
    70
    {
hgs
parents: 35
diff changeset
    71
        VideoCollectionViewUtilsData::mVideoSortRole = role;
hgs
parents: 35
diff changeset
    72
        mVideosSortRole = role;
hgs
parents: 35
diff changeset
    73
        VideoCollectionViewUtilsData::mVideoSortOrder = order;
hgs
parents: 35
diff changeset
    74
        mVideosSortOrder = order;
hgs
parents: 35
diff changeset
    75
    }
hgs
parents: 35
diff changeset
    76
    else
hgs
parents: 35
diff changeset
    77
    {
hgs
parents: 35
diff changeset
    78
        status = -1;
hgs
parents: 35
diff changeset
    79
    }
hgs
parents: 35
diff changeset
    80
    return status;
34
hgs
parents:
diff changeset
    81
}
hgs
parents:
diff changeset
    82
36
hgs
parents: 35
diff changeset
    83
int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order,  VideoCollectionCommon::TCollectionLevels target)
34
hgs
parents:
diff changeset
    84
{
hgs
parents:
diff changeset
    85
    if (VideoCollectionViewUtilsData::mLoadSortingValuesFails)
hgs
parents:
diff changeset
    86
    {
hgs
parents:
diff changeset
    87
        return -1;
hgs
parents:
diff changeset
    88
    }
36
hgs
parents: 35
diff changeset
    89
    if(target == VideoCollectionCommon::ELevelCategory )
hgs
parents: 35
diff changeset
    90
    {
hgs
parents: 35
diff changeset
    91
        role = VideoCollectionViewUtilsData::mCollectionSortRole;
hgs
parents: 35
diff changeset
    92
        order = VideoCollectionViewUtilsData::mCollectionSortOrder;
hgs
parents: 35
diff changeset
    93
    }
hgs
parents: 35
diff changeset
    94
    else if(target > VideoCollectionCommon::ELevelCategory && 
hgs
parents: 35
diff changeset
    95
            target <= VideoCollectionCommon::ELevelAlbum)
hgs
parents: 35
diff changeset
    96
    {
hgs
parents: 35
diff changeset
    97
        role = VideoCollectionViewUtilsData::mVideoSortRole;
hgs
parents: 35
diff changeset
    98
        order = VideoCollectionViewUtilsData::mVideoSortOrder;
hgs
parents: 35
diff changeset
    99
    }
hgs
parents: 35
diff changeset
   100
    else
hgs
parents: 35
diff changeset
   101
    {
hgs
parents: 35
diff changeset
   102
        return -1;
hgs
parents: 35
diff changeset
   103
    }
34
hgs
parents:
diff changeset
   104
    return 0;
hgs
parents:
diff changeset
   105
}
hgs
parents:
diff changeset
   106
44
hgs
parents: 41
diff changeset
   107
QString VideoCollectionViewUtils::getCenRepStringValue(int key)
34
hgs
parents:
diff changeset
   108
{
44
hgs
parents: 41
diff changeset
   109
    Q_UNUSED(key);
hgs
parents: 41
diff changeset
   110
    if(VideoCollectionViewUtilsData::mCenRepStringValues.count() > 0)
34
hgs
parents:
diff changeset
   111
    {
50
hgs
parents: 44
diff changeset
   112
        QString str = VideoCollectionViewUtilsData::mCenRepStringValues.takeFirst();
hgs
parents: 44
diff changeset
   113
        if(str != CENREP_NO_STRING) 
hgs
parents: 44
diff changeset
   114
        {
hgs
parents: 44
diff changeset
   115
            return str;
hgs
parents: 44
diff changeset
   116
        }
34
hgs
parents:
diff changeset
   117
    }
50
hgs
parents: 44
diff changeset
   118
    return QString();
34
hgs
parents:
diff changeset
   119
}
hgs
parents:
diff changeset
   120
44
hgs
parents: 41
diff changeset
   121
int VideoCollectionViewUtils::getCenRepIntValue(int key)
34
hgs
parents:
diff changeset
   122
{
44
hgs
parents: 41
diff changeset
   123
    Q_UNUSED(key);
hgs
parents: 41
diff changeset
   124
    if(VideoCollectionViewUtilsData::mCenRepIntValues.count() > 0)
hgs
parents: 41
diff changeset
   125
    {
55
hgs
parents: 50
diff changeset
   126
        int value = VideoCollectionViewUtilsData::mCenRepIntValues.takeFirst();
50
hgs
parents: 44
diff changeset
   127
        if(value != CENREP_NO_INT)
hgs
parents: 44
diff changeset
   128
        {
hgs
parents: 44
diff changeset
   129
            return value;
hgs
parents: 44
diff changeset
   130
        }
44
hgs
parents: 41
diff changeset
   131
    }
hgs
parents: 41
diff changeset
   132
    return -1;
34
hgs
parents:
diff changeset
   133
}
hgs
parents:
diff changeset
   134
hgs
parents:
diff changeset
   135
void VideoCollectionViewUtils::initListView(HbListView *view)
hgs
parents:
diff changeset
   136
{
hgs
parents:
diff changeset
   137
    Q_UNUSED(view);
hgs
parents:
diff changeset
   138
    // not stubbed
hgs
parents:
diff changeset
   139
}
hgs
parents:
diff changeset
   140
41
hgs
parents: 39
diff changeset
   141
void VideoCollectionViewUtils::setWidgetActivityLevel(const VideoCollectionCommon::TCollectionLevels &level)
39
hgs
parents: 36
diff changeset
   142
{
41
hgs
parents: 39
diff changeset
   143
    VideoCollectionViewUtilsData::mWidgetLevel = level;
39
hgs
parents: 36
diff changeset
   144
}
hgs
parents: 36
diff changeset
   145
  
41
hgs
parents: 39
diff changeset
   146
void VideoCollectionViewUtils::getActivityWidgetLevel(VideoCollectionCommon::TCollectionLevels &level)
hgs
parents: 39
diff changeset
   147
{
hgs
parents: 39
diff changeset
   148
    level = VideoCollectionViewUtilsData::mWidgetLevel;
hgs
parents: 39
diff changeset
   149
}
hgs
parents: 39
diff changeset
   150
hgs
parents: 39
diff changeset
   151
void VideoCollectionViewUtils::setCollectionActivityData(const TMPXItemId &id, const QString &name)
39
hgs
parents: 36
diff changeset
   152
{
41
hgs
parents: 39
diff changeset
   153
    VideoCollectionViewUtilsData::mActivityCollectionId = id;
hgs
parents: 39
diff changeset
   154
    VideoCollectionViewUtilsData::mActivityCollectionName = name;
39
hgs
parents: 36
diff changeset
   155
}
41
hgs
parents: 39
diff changeset
   156
    
hgs
parents: 39
diff changeset
   157
void VideoCollectionViewUtils::getCollectionActivityData(TMPXItemId &id, QString &name)
hgs
parents: 39
diff changeset
   158
{
hgs
parents: 39
diff changeset
   159
    id = VideoCollectionViewUtilsData::mActivityCollectionId;
hgs
parents: 39
diff changeset
   160
    name = VideoCollectionViewUtilsData::mActivityCollectionName;
hgs
parents: 39
diff changeset
   161
}
hgs
parents: 39
diff changeset
   162
39
hgs
parents: 36
diff changeset
   163
58
hgs
parents: 55
diff changeset
   164
void VideoCollectionViewUtils::sortModel(VideoProxyModelGeneric *model,
36
hgs
parents: 35
diff changeset
   165
    bool async, VideoCollectionCommon::TCollectionLevels target)
34
hgs
parents:
diff changeset
   166
{
hgs
parents:
diff changeset
   167
    Q_UNUSED(model);
hgs
parents:
diff changeset
   168
    Q_UNUSED(async);
36
hgs
parents: 35
diff changeset
   169
    Q_UNUSED(target);
34
hgs
parents:
diff changeset
   170
    // not stubbed
hgs
parents:
diff changeset
   171
}
hgs
parents:
diff changeset
   172
hgs
parents:
diff changeset
   173
void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
hgs
parents:
diff changeset
   174
{
35
hgs
parents: 34
diff changeset
   175
    VideoCollectionViewUtilsData::mLastStatusAdditional = additional;
34
hgs
parents:
diff changeset
   176
    VideoCollectionViewUtilsData::mLastError = statusCode;
hgs
parents:
diff changeset
   177
}
58
hgs
parents: 55
diff changeset
   178
hgs
parents: 55
diff changeset
   179
void VideoCollectionViewUtils::setIsService()
hgs
parents: 55
diff changeset
   180
{
hgs
parents: 55
diff changeset
   181
	mIsService = VideoCollectionViewUtilsData::mIsServiceValue;
hgs
parents: 55
diff changeset
   182
}
hgs
parents: 55
diff changeset
   183
hgs
parents: 55
diff changeset
   184
bool VideoCollectionViewUtils::isService()
hgs
parents: 55
diff changeset
   185
{
hgs
parents: 55
diff changeset
   186
    return mIsService;
hgs
parents: 55
diff changeset
   187
}