equal
deleted
inserted
replaced
27 |
27 |
28 // Constructor |
28 // Constructor |
29 PerfMonDataPopupDialog::PerfMonDataPopupDialog(const QVariantMap ¶meters) : |
29 PerfMonDataPopupDialog::PerfMonDataPopupDialog(const QVariantMap ¶meters) : |
30 mLastError(NoError), |
30 mLastError(NoError), |
31 mShowEventReceived(false), |
31 mShowEventReceived(false), |
32 mLocation(LocationTopRight), |
32 mLocation(LocationUndefined), |
33 mWidget(new PerfMonDataPopupWidget(this)) |
33 mWidget(new PerfMonDataPopupWidget(this)) |
34 { |
34 { |
35 setTimeout(0); |
35 setTimeout(0); |
36 setModal(false); |
36 setModal(false); |
37 setDismissPolicy(HbPopup::NoDismiss); |
37 setDismissPolicy(HbPopup::NoDismiss); |
106 } |
106 } |
107 |
107 |
108 // Widget is about to hide. Closing effect has ended. |
108 // Widget is about to hide. Closing effect has ended. |
109 void PerfMonDataPopupDialog::hideEvent(QHideEvent *event) |
109 void PerfMonDataPopupDialog::hideEvent(QHideEvent *event) |
110 { |
110 { |
111 if (mainWindow()) { |
|
112 disconnect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), |
|
113 this, SLOT(reposition())); |
|
114 } |
|
115 HbPopup::hideEvent(event); |
111 HbPopup::hideEvent(event); |
116 emit deviceDialogClosed(); |
112 emit deviceDialogClosed(); |
117 } |
113 } |
118 |
114 |
119 // Widget is about to show |
115 // Widget is about to show |
120 void PerfMonDataPopupDialog::showEvent(QShowEvent *event) |
116 void PerfMonDataPopupDialog::showEvent(QShowEvent *event) |
121 { |
117 { |
122 if (mainWindow()) { |
|
123 connect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), |
|
124 this, SLOT(reposition())); |
|
125 } |
|
126 reposition(); |
|
127 HbPopup::showEvent(event); |
118 HbPopup::showEvent(event); |
128 mShowEventReceived = true; |
119 mShowEventReceived = true; |
129 } |
120 } |
130 |
121 |
131 |
122 |
146 |
137 |
147 void PerfMonDataPopupDialog::setLocation(Location location) |
138 void PerfMonDataPopupDialog::setLocation(Location location) |
148 { |
139 { |
149 if (location != mLocation) { |
140 if (location != mLocation) { |
150 mLocation = location; |
141 mLocation = location; |
151 reposition(); |
142 QSize screenSize = HbDeviceProfile::profile(mainWindow()).logicalSize(); |
|
143 if(mLocation == LocationTopRight) { |
|
144 setPreferredPos(QPointF(screenSize.width(), 0), HbPopup::TopRightCorner); |
|
145 } |
|
146 else{ |
|
147 setPreferredPos(QPointF(screenSize.width() / 2, screenSize.height()), HbPopup::BottomEdgeCenter); |
|
148 } |
152 } |
149 } |
153 } |
150 } |
154 |
151 |
155 QStringList PerfMonDataPopupDialog::lines() const |
152 QStringList PerfMonDataPopupDialog::lines() const |
156 { |
153 { |
158 } |
155 } |
159 |
156 |
160 void PerfMonDataPopupDialog::setLines(const QStringList &lines) |
157 void PerfMonDataPopupDialog::setLines(const QStringList &lines) |
161 { |
158 { |
162 mWidget->setLines(lines); |
159 mWidget->setLines(lines); |
163 setPreferredSize(mWidget->preferredWidth()+30,mWidget->preferredHeight()+30); |
|
164 } |
160 } |
165 |
|
166 void PerfMonDataPopupDialog::reposition() |
|
167 { |
|
168 if (mainWindow()) { |
|
169 QSize screenSize = HbDeviceProfile::profile(mainWindow()).logicalSize(); |
|
170 switch (mLocation) { |
|
171 case LocationTopRight: |
|
172 setPreferredPos(QPointF(screenSize.width(), 0), |
|
173 HbPopup::TopRightCorner); |
|
174 break; |
|
175 |
|
176 case LocationBottomMiddle: |
|
177 setPreferredPos(QPointF(screenSize.width() / 2, screenSize.height()), |
|
178 HbPopup::BottomEdgeCenter); |
|
179 break; |
|
180 } |
|
181 } |
|
182 resize(0,0); |
|
183 } |
|