|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QStringListModel> |
|
19 |
|
20 #include "memspykernelobjectdetailview.h" |
|
21 |
|
22 MemSpyKernelObjectDetailModel::MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent) : |
|
23 QAbstractListModel(parent), |
|
24 mDetails(details) |
|
25 { |
|
26 |
|
27 } |
|
28 |
|
29 int MemSpyKernelObjectDetailModel::rowCount(const QModelIndex &parent) const |
|
30 { |
|
31 Q_UNUSED(parent); |
|
32 return mDetails.count(); |
|
33 } |
|
34 |
|
35 QVariant MemSpyKernelObjectDetailModel::data(const QModelIndex &index, int role) const |
|
36 { |
|
37 if (role == Qt::DisplayRole) { |
|
38 |
|
39 // convert from semicolon delimited line to two lines |
|
40 return mDetails.at(index.row()).split(": "); |
|
41 } |
|
42 |
|
43 return QVariant(); |
|
44 } |
|
45 |
|
46 |
|
47 void MemSpyKernelObjectDetailView::initialize(const QVariantMap& params) |
|
48 { |
|
49 setTitle("Details"); |
|
50 |
|
51 mTypeName = params["typeName"].toString(); |
|
52 mObjectName = params["objectName"].toString(); |
|
53 MemSpyView::initialize(params); |
|
54 |
|
55 QStringList items = params.value("details").toStringList(); |
|
56 mListView.setModel(new MemSpyKernelObjectDetailModel(items, this)); |
|
57 } |
|
58 |
|
59 bool MemSpyKernelObjectDetailView::isBreadCrumbVisible() const |
|
60 { |
|
61 return true; |
|
62 } |
|
63 |
|
64 QString MemSpyKernelObjectDetailView::getBreadCrumbText() const |
|
65 { |
|
66 return tr("Kernel Objects > %1 > %2").arg(mTypeName).arg(mObjectName); |
|
67 } |