tstaskmonitor/client/s60/src/tstask.cpp
author hgs
Tue, 29 Jun 2010 10:20:30 +0300
changeset 100 0920c6a9b6c8
parent 99 7aaf39b772ac
permissions -rw-r--r--
201025_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
94
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: 
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
#include "tstask.h"
hgs
parents:
diff changeset
    18
96
hgs
parents: 94
diff changeset
    19
#include <XQConversions>
94
hgs
parents:
diff changeset
    20
99
hgs
parents: 96
diff changeset
    21
#include "tsentry.h"
94
hgs
parents:
diff changeset
    22
99
hgs
parents: 96
diff changeset
    23
/*!
hgs
parents: 96
diff changeset
    24
    @class TsTask
hgs
parents: 96
diff changeset
    25
    @ingroup publicApi
hgs
parents: 96
diff changeset
    26
    @brief TsTask object represents a single task.
hgs
parents: 96
diff changeset
    27
    
hgs
parents: 96
diff changeset
    28
    This class is one of the Qt interfaces for Task Monitor server. It can be
hgs
parents: 96
diff changeset
    29
    used to set custom screenshot of the task, or to change the task visibility.
hgs
parents: 96
diff changeset
    30
*/
hgs
parents: 96
diff changeset
    31
hgs
parents: 96
diff changeset
    32
/*!
hgs
parents: 96
diff changeset
    33
    @internal
hgs
parents: 96
diff changeset
    34
    Constructor. 
hgs
parents: 96
diff changeset
    35
    Takes ownership over @a entry.
hgs
parents: 96
diff changeset
    36
*/
hgs
parents: 96
diff changeset
    37
TsTask::TsTask(CTsEntry* entry) : mEntry(entry)
94
hgs
parents:
diff changeset
    38
{
hgs
parents:
diff changeset
    39
}
hgs
parents:
diff changeset
    40
99
hgs
parents: 96
diff changeset
    41
/*!
hgs
parents: 96
diff changeset
    42
    Destructor.
hgs
parents: 96
diff changeset
    43
*/
94
hgs
parents:
diff changeset
    44
TsTask::~TsTask()
hgs
parents:
diff changeset
    45
{
hgs
parents:
diff changeset
    46
    delete mEntry;
hgs
parents:
diff changeset
    47
}
hgs
parents:
diff changeset
    48
99
hgs
parents: 96
diff changeset
    49
/*!
hgs
parents: 96
diff changeset
    50
    @return True if it's possible to close the task, false otherwise.
hgs
parents: 96
diff changeset
    51
*/
94
hgs
parents:
diff changeset
    52
bool TsTask::isClosable() const
hgs
parents:
diff changeset
    53
{
hgs
parents:
diff changeset
    54
    return mEntry->CloseableApp();
hgs
parents:
diff changeset
    55
}
hgs
parents:
diff changeset
    56
99
hgs
parents: 96
diff changeset
    57
/*!
hgs
parents: 96
diff changeset
    58
    @return Icon of the task.
hgs
parents: 96
diff changeset
    59
*/
94
hgs
parents:
diff changeset
    60
QPixmap TsTask::icon() const
hgs
parents:
diff changeset
    61
{
hgs
parents:
diff changeset
    62
    QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(mEntry->AppIconBitmap());
hgs
parents:
diff changeset
    63
    QPixmap mask = QPixmap::fromSymbianCFbsBitmap(mEntry->AppIconMask());
hgs
parents:
diff changeset
    64
    // @todo QPixmap::setAlphaChannel() is deprecated, change to code using QPainter
hgs
parents:
diff changeset
    65
    pixmap.setAlphaChannel(mask);
hgs
parents:
diff changeset
    66
    return pixmap;
hgs
parents:
diff changeset
    67
}
hgs
parents:
diff changeset
    68
99
hgs
parents: 96
diff changeset
    69
/*!
hgs
parents: 96
diff changeset
    70
    @return Screenshot of the task.
hgs
parents: 96
diff changeset
    71
*/
96
hgs
parents: 94
diff changeset
    72
QPixmap TsTask::screenshot() const
hgs
parents: 94
diff changeset
    73
{
hgs
parents: 94
diff changeset
    74
    return QPixmap::fromSymbianCFbsBitmap(mEntry->Screenshot());
hgs
parents: 94
diff changeset
    75
}
hgs
parents: 94
diff changeset
    76
99
hgs
parents: 96
diff changeset
    77
/*!
hgs
parents: 96
diff changeset
    78
    @return Name of the task.
hgs
parents: 96
diff changeset
    79
*/
94
hgs
parents:
diff changeset
    80
QString TsTask::name() const
hgs
parents:
diff changeset
    81
{
hgs
parents:
diff changeset
    82
    return XQConversions::s60DescToQString(mEntry->AppName());
hgs
parents:
diff changeset
    83
}
99
hgs
parents: 96
diff changeset
    84
hgs
parents: 96
diff changeset
    85
/*!
hgs
parents: 96
diff changeset
    86
    @fn TsTask::open()
hgs
parents: 96
diff changeset
    87
    Start or bring the task to foreground.
hgs
parents: 96
diff changeset
    88
*/
hgs
parents: 96
diff changeset
    89
hgs
parents: 96
diff changeset
    90
/*!
hgs
parents: 96
diff changeset
    91
    @fn TsTask::close()
hgs
parents: 96
diff changeset
    92
    Close the task.
hgs
parents: 96
diff changeset
    93
*/