26
|
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 <QAction>
|
|
19 |
#include <QStringListModel>
|
|
20 |
#include <HbMenu>
|
|
21 |
|
|
22 |
#include "memspythreaddetailindexview.h"
|
|
23 |
#include "viewmanager.cpp"
|
|
24 |
|
|
25 |
void MemSpyThreadDetailIndexView::initialize(const QVariantMap& params)
|
|
26 |
{
|
|
27 |
MemSpyView::initialize(params);
|
|
28 |
|
|
29 |
setTitle(tr("Thread Details"));
|
|
30 |
|
|
31 |
mThreadId = qVariantValue<ThreadId>(params["tid"]);
|
|
32 |
|
|
33 |
QStringList lines = QStringList() << tr("General") << tr("Heap") << tr("Stack")
|
|
34 |
<< tr("Chunks") << tr("Code Segments") << tr("Open Files") << tr("Active Objects")
|
|
35 |
<< tr("Handles to other Threads") << tr("Handles to other Processes")
|
|
36 |
<< tr("Servers Running in Thread") << tr("Client <-> Server connections")
|
|
37 |
<< tr("Semaphores") << tr("References this Thread") << tr("References this Process")
|
|
38 |
<< tr("Mutexes") << tr("Timers") << tr("Logical DD Channels")
|
|
39 |
<< tr("Change Notifiers") << tr("Undertakers") << tr("Logical Device Drivers")
|
|
40 |
<< tr("Physical Device Drivers");
|
|
41 |
|
|
42 |
mListView.setModel(new QStringListModel(lines, this));
|
|
43 |
|
|
44 |
connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
|
|
45 |
}
|
|
46 |
|
|
47 |
HbMenu* MemSpyThreadDetailIndexView::createToolMenu()
|
|
48 |
{
|
|
49 |
HbMenu* menu = new HbMenu(tr("Thread"));
|
|
50 |
mPriorityMenu = menu->addMenu("Change Priority");
|
|
51 |
|
|
52 |
mPriorityMenu->addAction(tr("Abs. Very Low"), this, SLOT(changePriority()));
|
|
53 |
mPriorityMenu->addAction(tr("Abs. Low Normal"), this, SLOT(changePriority()));
|
|
54 |
mPriorityMenu->addAction(tr("Abs. Low"), this, SLOT(changePriority()));
|
|
55 |
mPriorityMenu->addAction(tr("Abs. Background Normal"), this, SLOT(changePriority()));
|
|
56 |
mPriorityMenu->addAction(tr("Abs. Background"), this, SLOT(changePriority()));
|
|
57 |
mPriorityMenu->addAction(tr("Abs. Foreground Normal"), this, SLOT(changePriority()));
|
|
58 |
mPriorityMenu->addAction(tr("Abs. Foreground"), this, SLOT(changePriority()));
|
|
59 |
mPriorityMenu->addAction(tr("Abs. High Normal"), this, SLOT(changePriority()));
|
|
60 |
mPriorityMenu->addAction(tr("Abs. High"), this, SLOT(changePriority()));
|
|
61 |
mPriorityMenu->addAction(tr("Abs. Real Time 1"), this, SLOT(changePriority()));
|
|
62 |
mPriorityMenu->addAction(tr("Abs. Real Time 2"), this, SLOT(changePriority()));
|
|
63 |
mPriorityMenu->addAction(tr("Abs. Real Time 3"), this, SLOT(changePriority()));
|
|
64 |
mPriorityMenu->addAction(tr("Abs. Real Time 4"), this, SLOT(changePriority()));
|
|
65 |
mPriorityMenu->addAction(tr("Abs. Real Time 5"), this, SLOT(changePriority()));
|
|
66 |
mPriorityMenu->addAction(tr("Abs. Real Time 6"), this, SLOT(changePriority()));
|
|
67 |
mPriorityMenu->addAction(tr("Abs. Real Time 7"), this, SLOT(changePriority()));
|
|
68 |
mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority()));
|
|
69 |
|
|
70 |
return menu;
|
|
71 |
}
|
|
72 |
|
|
73 |
void MemSpyThreadDetailIndexView::changePriority()
|
|
74 |
{
|
|
75 |
QAction *s = qobject_cast<QAction*>(sender());
|
|
76 |
int index = mPriorityMenu->actions().indexOf(s);
|
|
77 |
|
|
78 |
ThreadPriority priorities[] = {
|
|
79 |
ThreadPriorityAbsoluteVeryLow,
|
|
80 |
ThreadPriorityAbsoluteLowNormal,
|
|
81 |
ThreadPriorityAbsoluteLow,
|
|
82 |
ThreadPriorityAbsoluteBackgroundNormal,
|
|
83 |
ThreadPriorityAbsoluteBackground,
|
|
84 |
ThreadPriorityAbsoluteForegroundNormal,
|
|
85 |
ThreadPriorityAbsoluteForeground,
|
|
86 |
ThreadPriorityAbsoluteHighNormal,
|
|
87 |
ThreadPriorityAbsoluteHigh,
|
|
88 |
ThreadPriorityAbsoluteRealTime1,
|
|
89 |
ThreadPriorityAbsoluteRealTime2,
|
|
90 |
ThreadPriorityAbsoluteRealTime3,
|
|
91 |
ThreadPriorityAbsoluteRealTime4,
|
|
92 |
ThreadPriorityAbsoluteRealTime5,
|
|
93 |
ThreadPriorityAbsoluteRealTime6,
|
|
94 |
ThreadPriorityAbsoluteRealTime7,
|
|
95 |
ThreadPriorityAbsoluteRealTime8 };
|
|
96 |
|
|
97 |
mEngine.setThreadPriority(mThreadId, priorities[index]);
|
|
98 |
}
|
|
99 |
|
|
100 |
void MemSpyThreadDetailIndexView::itemClicked(const QModelIndex& index)
|
|
101 |
{
|
|
102 |
ThreadInfoType types[] = { ThreadInfoTypeGeneral, ThreadInfoTypeHeap,
|
|
103 |
ThreadInfoTypeStack, ThreadInfoTypeChunk, ThreadInfoTypeCodeSeg,
|
|
104 |
ThreadInfoTypeOpenFiles, ThreadInfoTypeActiveObjects, ThreadInfoTypeOwnedThreadHandles,
|
|
105 |
ThreadInfoTypeOwnedProcessHandles, ThreadInfoTypeServer, ThreadInfoTypeSession,
|
|
106 |
ThreadInfoTypeSemaphore, ThreadInfoTypeOtherThreads, ThreadInfoTypeOtherProcesses,
|
|
107 |
ThreadInfoTypeMutex, ThreadInfoTypeTimer, ThreadInfoTypeChannel,
|
|
108 |
ThreadInfoTypeChangeNotifier, ThreadInfoTypeUndertaker,
|
|
109 |
ThreadInfoTypeLDD, ThreadInfoTypePDD };
|
|
110 |
|
|
111 |
QVariantMap map;
|
|
112 |
map.insert("tid", mThreadId);
|
|
113 |
map.insert("type", types[index.row()]);
|
|
114 |
mViewManager.showView(ThreadDetailView, map);
|
|
115 |
}
|
|
116 |
|