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