perfapps/memspyui/ui/hb/src/memspywindowgroupsdetailview.cpp
author hgs
Fri, 17 Sep 2010 14:22:55 +0300
changeset 52 36d60d12b4af
permissions -rw-r--r--
201037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52
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
hgs
parents:
diff changeset
    18
#include "memspywindowgroupsdetailview.h"
hgs
parents:
diff changeset
    19
#include "viewmanager.h"
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
MemSpyWindowGroupsDetailModel::MemSpyWindowGroupsDetailModel(MemSpyWindowGroup* group, QObject *parent) :
hgs
parents:
diff changeset
    22
    QAbstractListModel(parent)
hgs
parents:
diff changeset
    23
{
hgs
parents:
diff changeset
    24
    mData << (QStringList() << tr("WG ID") << QString("%1").arg(group->id()));
hgs
parents:
diff changeset
    25
    mData << (QStringList() << tr("Client ThreadId") << QString("%1").arg(group->threadId()));
hgs
parents:
diff changeset
    26
    mData << (QStringList() << tr("Thr") << group->fullName());
hgs
parents:
diff changeset
    27
    mData << (QStringList() << tr("Priority") << QString("%1").arg(group->priority()));
hgs
parents:
diff changeset
    28
    mData << (QStringList() << tr("Handle") << QString("0x%1").arg(group->windowGroupHandle(), 0, 16));
hgs
parents:
diff changeset
    29
    mData << (QStringList() << tr("Name") << group->name());
hgs
parents:
diff changeset
    30
    mData << (QStringList() << tr("UID") << QString("%1").arg(group->uid()));
hgs
parents:
diff changeset
    31
    mData << (QStringList() << tr("IsBusy") << (group->isBusy() ? tr("Yes") : tr("No")));
hgs
parents:
diff changeset
    32
    mData << (QStringList() << tr("IsSystem") << (group->isSystem() ? tr("Yes") : tr("No")));
hgs
parents:
diff changeset
    33
    mData << (QStringList() << tr("IsHidden") << (group->isHidden() ? tr("Yes") : tr("No")));
hgs
parents:
diff changeset
    34
    mData << (QStringList() << tr("Caption") << group->caption());
hgs
parents:
diff changeset
    35
    mData << (QStringList() << tr("Docname") << group->docName());
hgs
parents:
diff changeset
    36
}
hgs
parents:
diff changeset
    37
    
hgs
parents:
diff changeset
    38
int MemSpyWindowGroupsDetailModel::rowCount(const QModelIndex &parent) const
hgs
parents:
diff changeset
    39
{
hgs
parents:
diff changeset
    40
    Q_UNUSED(parent);
hgs
parents:
diff changeset
    41
    return mData.count();
hgs
parents:
diff changeset
    42
}
hgs
parents:
diff changeset
    43
    
hgs
parents:
diff changeset
    44
QVariant MemSpyWindowGroupsDetailModel::data(const QModelIndex &index, int role) const
hgs
parents:
diff changeset
    45
{
hgs
parents:
diff changeset
    46
    if (role == Qt::DisplayRole)
hgs
parents:
diff changeset
    47
        return mData.at(index.row());
hgs
parents:
diff changeset
    48
    
hgs
parents:
diff changeset
    49
    return QVariant();
hgs
parents:
diff changeset
    50
}    
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
void MemSpyWindowGroupsDetailView::initialize(const QVariantMap& params)
hgs
parents:
diff changeset
    53
{
hgs
parents:
diff changeset
    54
    setTitle(tr("Window Group Detail"));
hgs
parents:
diff changeset
    55
    MemSpyView::initialize(params);
hgs
parents:
diff changeset
    56
    
hgs
parents:
diff changeset
    57
    MemSpyWindowGroup* group = static_cast<MemSpyWindowGroup*>(
hgs
parents:
diff changeset
    58
            qVariantValue<void*>(params["group"]));
hgs
parents:
diff changeset
    59
    
hgs
parents:
diff changeset
    60
    mModel = new MemSpyWindowGroupsDetailModel(group);
hgs
parents:
diff changeset
    61
    mListView.setModel(mModel);
hgs
parents:
diff changeset
    62
}