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 <xqserviceutil.h> |
|
19 |
|
20 #include "wlansniffermainwindow.h" |
|
21 #include "wlansnifferlistview.h" |
|
22 #include "wlansnifferservice.h" |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "wlansniffermainwindowTraces.h" |
|
26 #endif |
|
27 |
|
28 |
|
29 WlanSnifferMainWindow::WlanSnifferMainWindow(WlanSniffer *appRef) : |
|
30 mAppRef(appRef), |
|
31 mService(0) |
|
32 { |
|
33 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_ENTRY ); |
|
34 |
|
35 mService = new WlanSnifferService(this); |
|
36 connect(mService,SIGNAL(toListView()),this,SLOT(toListView())); |
|
37 connect(mService,SIGNAL(returnValueDelivered()),this,SIGNAL(exitTriggered())); |
|
38 |
|
39 // Add the views to the main window |
|
40 addListView(); |
|
41 |
|
42 // Check if sniffer is used via a service |
|
43 if (!XQServiceUtil::isEmbedded()) { |
|
44 // Show the main window (which will display the first view that was added) |
|
45 show(); |
|
46 } |
|
47 |
|
48 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_EXIT ); |
|
49 } |
|
50 |
|
51 WlanSnifferMainWindow::~WlanSnifferMainWindow() |
|
52 { |
|
53 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_ENTRY ); |
|
54 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_EXIT ); |
|
55 } |
|
56 |
|
57 void WlanSnifferMainWindow::toListView() |
|
58 { |
|
59 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_TOLISTVIEW_ENTRY ); |
|
60 |
|
61 setCurrentView(mListView); |
|
62 show(); |
|
63 |
|
64 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_TOLISTVIEW_EXIT ); |
|
65 } |
|
66 |
|
67 void WlanSnifferMainWindow::toDetailsView(int iapId) |
|
68 { |
|
69 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_TODETAILSVIEW_ENTRY ); |
|
70 |
|
71 // TODO: Launch details view via QtHighway?? |
|
72 (void)iapId; |
|
73 |
|
74 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_TODETAILSVIEW_EXIT ); |
|
75 } |
|
76 |
|
77 void WlanSnifferMainWindow::updateListView() |
|
78 { |
|
79 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEW_ENTRY ); |
|
80 |
|
81 mListView->update(); |
|
82 |
|
83 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEW_EXIT ); |
|
84 } |
|
85 |
|
86 void WlanSnifferMainWindow::updateListViewConnectionOpened(int iapId) |
|
87 { |
|
88 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONOPENED_ENTRY ); |
|
89 |
|
90 mListView->updateConnectionOpened(iapId); |
|
91 |
|
92 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONOPENED_EXIT ); |
|
93 } |
|
94 |
|
95 void WlanSnifferMainWindow::updateListViewConnectionClosed(int iapId) |
|
96 { |
|
97 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONCLOSED_ENTRY ); |
|
98 |
|
99 mListView->updateConnectionClosed(iapId); |
|
100 |
|
101 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONCLOSED_EXIT ); |
|
102 } |
|
103 |
|
104 void WlanSnifferMainWindow::completeService() |
|
105 { |
|
106 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_COMPLETESERVICE_ENTRY ); |
|
107 |
|
108 mService->complete(); |
|
109 |
|
110 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_COMPLETESERVICE_EXIT ); |
|
111 } |
|
112 |
|
113 void WlanSnifferMainWindow::addListView() |
|
114 { |
|
115 OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_ADDLISTVIEW_ENTRY ); |
|
116 |
|
117 mListView = new WlanSnifferListView(mAppRef); |
|
118 addView(mListView); |
|
119 |
|
120 bool connectStatus = connect( |
|
121 mListView, |
|
122 SIGNAL(detailsTriggered(int)), |
|
123 this, |
|
124 SLOT(toDetailsView(int))); |
|
125 Q_ASSERT(connectStatus == true); |
|
126 connectStatus = connect( |
|
127 mListView, |
|
128 SIGNAL(completeServiceTriggered()), |
|
129 this, |
|
130 SLOT(completeService())); |
|
131 Q_ASSERT(connectStatus == true); |
|
132 |
|
133 OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_ADDLISTVIEW_EXIT ); |
|
134 } |
|