Changeset View
Changeset View
Standalone View
Standalone View
mainWindow/kpMainWindow_StatusBar.cpp
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | |||||
104 | 104 | | |||
105 | //--------------------------------------------------------------------- | 105 | //--------------------------------------------------------------------- | ||
106 | 106 | | |||
107 | // private slot | 107 | // private slot | ||
108 | void kpMainWindow::setStatusBarMessage (const QString &message) | 108 | void kpMainWindow::setStatusBarMessage (const QString &message) | ||
109 | { | 109 | { | ||
110 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarMessage(" | 110 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarMessage(" | ||
111 | << message | 111 | << message | ||
112 | << ") ok=" << d->statusBarCreated | 112 | << ") ok=" << d->statusBarCreated; | ||
113 | << endl; | | |||
114 | 113 | | |||
115 | if (!d->statusBarCreated) | 114 | if (!d->statusBarCreated) { | ||
116 | return; | 115 | return; | ||
116 | } | ||||
117 | 117 | | |||
118 | d->statusBarMessageLabel->setText (message); | 118 | d->statusBarMessageLabel->setText (message); | ||
119 | } | 119 | } | ||
120 | 120 | | |||
121 | //--------------------------------------------------------------------- | 121 | //--------------------------------------------------------------------- | ||
122 | 122 | | |||
123 | // private slot | 123 | // private slot | ||
124 | void kpMainWindow::setStatusBarShapePoints (const QPoint &startPoint, | 124 | void kpMainWindow::setStatusBarShapePoints (const QPoint &startPoint, | ||
125 | const QPoint &endPoint) | 125 | const QPoint &endPoint) | ||
126 | { | 126 | { | ||
127 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarShapePoints(" | 127 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarShapePoints(" | ||
128 | << startPoint << "," << endPoint | 128 | << startPoint << "," << endPoint | ||
129 | << ") ok=" << d->statusBarCreated | 129 | << ") ok=" << d->statusBarCreated; | ||
130 | << endl; | | |||
131 | 130 | | |||
132 | if (!d->statusBarCreated) | 131 | if (!d->statusBarCreated) { | ||
133 | return; | 132 | return; | ||
133 | } | ||||
134 | 134 | | |||
135 | if (d->statusBarShapeLastPointsInitialised && | 135 | if (d->statusBarShapeLastPointsInitialised && | ||
136 | startPoint == d->statusBarShapeLastStartPoint && | 136 | startPoint == d->statusBarShapeLastStartPoint && | ||
137 | endPoint == d->statusBarShapeLastEndPoint) | 137 | endPoint == d->statusBarShapeLastEndPoint) | ||
138 | { | 138 | { | ||
139 | qCDebug(kpLogMainWindow) << "\tNOP"; | 139 | qCDebug(kpLogMainWindow) << "\tNOP"; | ||
140 | return; | 140 | return; | ||
141 | } | 141 | } | ||
Show All 26 Lines | |||||
168 | //--------------------------------------------------------------------- | 168 | //--------------------------------------------------------------------- | ||
169 | 169 | | |||
170 | // private slot | 170 | // private slot | ||
171 | void kpMainWindow::setStatusBarShapeSize (const QSize &size) | 171 | void kpMainWindow::setStatusBarShapeSize (const QSize &size) | ||
172 | { | 172 | { | ||
173 | #if DEBUG_STATUS_BAR && 0 | 173 | #if DEBUG_STATUS_BAR && 0 | ||
174 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarShapeSize(" | 174 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarShapeSize(" | ||
175 | << size | 175 | << size | ||
176 | << ") ok=" << d->statusBarCreated | 176 | << ") ok=" << d->statusBarCreated; | ||
177 | << endl; | | |||
178 | #endif | 177 | #endif | ||
179 | 178 | | |||
180 | if (!d->statusBarCreated) | 179 | if (!d->statusBarCreated) { | ||
181 | return; | 180 | return; | ||
181 | } | ||||
182 | 182 | | |||
183 | if (d->statusBarShapeLastSizeInitialised && | 183 | if (d->statusBarShapeLastSizeInitialised && | ||
184 | size == d->statusBarShapeLastSize) | 184 | size == d->statusBarShapeLastSize) | ||
185 | { | 185 | { | ||
186 | #if DEBUG_STATUS_BAR && 0 | 186 | #if DEBUG_STATUS_BAR && 0 | ||
187 | qCDebug(kpLogMainWindow) << "\tNOP"; | 187 | qCDebug(kpLogMainWindow) << "\tNOP"; | ||
188 | #endif | 188 | #endif | ||
189 | return; | 189 | return; | ||
Show All 17 Lines | |||||
207 | 207 | | |||
208 | //--------------------------------------------------------------------- | 208 | //--------------------------------------------------------------------- | ||
209 | 209 | | |||
210 | // private slot | 210 | // private slot | ||
211 | void kpMainWindow::setStatusBarDocSize (const QSize &size) | 211 | void kpMainWindow::setStatusBarDocSize (const QSize &size) | ||
212 | { | 212 | { | ||
213 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarDocSize(" | 213 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarDocSize(" | ||
214 | << size | 214 | << size | ||
215 | << ") ok=" << d->statusBarCreated | 215 | << ") ok=" << d->statusBarCreated; | ||
216 | << endl; | | |||
217 | 216 | | |||
218 | if (!d->statusBarCreated) | 217 | if (!d->statusBarCreated) { | ||
219 | return; | 218 | return; | ||
219 | } | ||||
220 | 220 | | |||
221 | QLabel *statusBarLabel = d->statusBarLabels.at (StatusBarItemDocSize); | 221 | QLabel *statusBarLabel = d->statusBarLabels.at (StatusBarItemDocSize); | ||
222 | if (size == KP_INVALID_SIZE) | 222 | if (size == KP_INVALID_SIZE) | ||
223 | { | 223 | { | ||
224 | statusBarLabel->setText (QString()); | 224 | statusBarLabel->setText (QString()); | ||
225 | } | 225 | } | ||
226 | else | 226 | else | ||
227 | { | 227 | { | ||
228 | statusBarLabel->setText (i18n ("%1 x %2", | 228 | statusBarLabel->setText (i18n ("%1 x %2", | ||
229 | size.width (), | 229 | size.width (), | ||
230 | size.height ())); | 230 | size.height ())); | ||
231 | } | 231 | } | ||
232 | } | 232 | } | ||
233 | 233 | | |||
234 | //--------------------------------------------------------------------- | 234 | //--------------------------------------------------------------------- | ||
235 | 235 | | |||
236 | // private slot | 236 | // private slot | ||
237 | void kpMainWindow::setStatusBarDocDepth (int depth) | 237 | void kpMainWindow::setStatusBarDocDepth (int depth) | ||
238 | { | 238 | { | ||
239 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarDocDepth(" | 239 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarDocDepth(" | ||
240 | << depth | 240 | << depth | ||
241 | << ") ok=" << d->statusBarCreated | 241 | << ") ok=" << d->statusBarCreated; | ||
242 | << endl; | | |||
243 | 242 | | |||
244 | if (!d->statusBarCreated) | 243 | if (!d->statusBarCreated) { | ||
245 | return; | 244 | return; | ||
245 | } | ||||
246 | 246 | | |||
247 | QLabel *statusBarLabel = d->statusBarLabels.at (StatusBarItemDocDepth); | 247 | QLabel *statusBarLabel = d->statusBarLabels.at (StatusBarItemDocDepth); | ||
248 | if (depth <= 0) | 248 | if (depth <= 0) | ||
249 | { | 249 | { | ||
250 | statusBarLabel->setText (QString()); | 250 | statusBarLabel->setText (QString()); | ||
251 | } | 251 | } | ||
252 | else | 252 | else | ||
253 | { | 253 | { | ||
254 | statusBarLabel->setText (i18n ("%1bpp", depth)); | 254 | statusBarLabel->setText (i18n ("%1bpp", depth)); | ||
255 | } | 255 | } | ||
256 | } | 256 | } | ||
257 | 257 | | |||
258 | //--------------------------------------------------------------------- | 258 | //--------------------------------------------------------------------- | ||
259 | 259 | | |||
260 | // private slot | 260 | // private slot | ||
261 | void kpMainWindow::setStatusBarZoom (int zoom) | 261 | void kpMainWindow::setStatusBarZoom (int zoom) | ||
262 | { | 262 | { | ||
263 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarZoom(" | 263 | qCDebug(kpLogMainWindow) << "kpMainWindow::setStatusBarZoom(" | ||
264 | << zoom | 264 | << zoom | ||
265 | << ") ok=" << d->statusBarCreated | 265 | << ") ok=" << d->statusBarCreated; | ||
266 | << endl; | | |||
267 | 266 | | |||
268 | if (!d->statusBarCreated) | 267 | if (!d->statusBarCreated) { | ||
269 | return; | 268 | return; | ||
269 | } | ||||
270 | 270 | | |||
271 | QLabel *statusBarLabel = d->statusBarLabels.at (StatusBarItemZoom); | 271 | QLabel *statusBarLabel = d->statusBarLabels.at (StatusBarItemZoom); | ||
272 | if (zoom <= 0) | 272 | if (zoom <= 0) | ||
273 | { | 273 | { | ||
274 | statusBarLabel->setText (QString()); | 274 | statusBarLabel->setText (QString()); | ||
275 | } | 275 | } | ||
276 | else | 276 | else | ||
277 | { | 277 | { | ||
278 | statusBarLabel->setText (i18n ("%1%", zoom)); | 278 | statusBarLabel->setText (i18n ("%1%", zoom)); | ||
279 | } | 279 | } | ||
280 | } | 280 | } | ||
281 | 281 | | |||
282 | //--------------------------------------------------------------------- | 282 | //--------------------------------------------------------------------- | ||
283 | 283 | | |||
284 | void kpMainWindow::recalculateStatusBarMessage () | 284 | void kpMainWindow::recalculateStatusBarMessage () | ||
285 | { | 285 | { | ||
286 | qCDebug(kpLogMainWindow) << "kpMainWindow::recalculateStatusBarMessage()"; | 286 | qCDebug(kpLogMainWindow) << "kpMainWindow::recalculateStatusBarMessage()"; | ||
287 | QString scrollViewMessage = d->scrollView->statusMessage (); | 287 | QString scrollViewMessage = d->scrollView->statusMessage (); | ||
288 | qCDebug(kpLogMainWindow) << "\tscrollViewMessage=" << scrollViewMessage; | 288 | qCDebug(kpLogMainWindow) << "\tscrollViewMessage=" << scrollViewMessage; | ||
289 | qCDebug(kpLogMainWindow) << "\tresizing doc? " << !d->scrollView->newDocSize ().isEmpty () | 289 | qCDebug(kpLogMainWindow) << "\tresizing doc? " << !d->scrollView->newDocSize ().isEmpty (); | ||
290 | << endl; | | |||
291 | qCDebug(kpLogMainWindow) << "\tviewUnderCursor? " | 290 | qCDebug(kpLogMainWindow) << "\tviewUnderCursor? " | ||
292 | << (d->viewManager && d->viewManager->viewUnderCursor ()) | 291 | << (d->viewManager && d->viewManager->viewUnderCursor ()); | ||
293 | << endl; | | |||
294 | 292 | | |||
295 | // HACK: To work around kpViewScrollableContainer's unreliable | 293 | // HACK: To work around kpViewScrollableContainer's unreliable | ||
296 | // status messages (which in turn is due to Qt not updating | 294 | // status messages (which in turn is due to Qt not updating | ||
297 | // QWidget::underMouse() on drags and we needing to hack around it) | 295 | // QWidget::underMouse() on drags and we needing to hack around it) | ||
298 | if (!scrollViewMessage.isEmpty () && | 296 | if (!scrollViewMessage.isEmpty () && | ||
299 | d->scrollView->newDocSize ().isEmpty () && | 297 | d->scrollView->newDocSize ().isEmpty () && | ||
300 | d->viewManager && d->viewManager->viewUnderCursor ()) | 298 | d->viewManager && d->viewManager->viewUnderCursor ()) | ||
301 | { | 299 | { | ||
302 | #if DEBUG_STATUS_BAR && 1 | 300 | #if DEBUG_STATUS_BAR && 1 | ||
303 | qCDebug(kpLogMainWindow) << "\t\tnot resizing & viewUnderCursor - message is wrong - clearing" | 301 | qCDebug(kpLogMainWindow) << "\t\tnot resizing & viewUnderCursor - message is wrong - clearing"; | ||
304 | << endl; | | |||
305 | #endif | 302 | #endif | ||
306 | d->scrollView->blockSignals (true); | 303 | d->scrollView->blockSignals (true); | ||
307 | d->scrollView->clearStatusMessage (); | 304 | d->scrollView->clearStatusMessage (); | ||
308 | d->scrollView->blockSignals (false); | 305 | d->scrollView->blockSignals (false); | ||
309 | 306 | | |||
310 | scrollViewMessage.clear (); | 307 | scrollViewMessage.clear (); | ||
311 | #if DEBUG_STATUS_BAR && 1 | 308 | #if DEBUG_STATUS_BAR && 1 | ||
312 | qCDebug(kpLogMainWindow) << "\t\t\tdone"; | 309 | qCDebug(kpLogMainWindow) << "\t\t\tdone"; | ||
Show All 26 Lines | 335 | { | |||
339 | qCDebug(kpLogMainWindow) << "kpMainWindow::recalculateStatusBarShape()"; | 336 | qCDebug(kpLogMainWindow) << "kpMainWindow::recalculateStatusBarShape()"; | ||
340 | 337 | | |||
341 | QSize docResizeTo = d->scrollView->newDocSize (); | 338 | QSize docResizeTo = d->scrollView->newDocSize (); | ||
342 | qCDebug(kpLogMainWindow) << "\tdocResizeTo=" << docResizeTo; | 339 | qCDebug(kpLogMainWindow) << "\tdocResizeTo=" << docResizeTo; | ||
343 | if (docResizeTo.isValid ()) | 340 | if (docResizeTo.isValid ()) | ||
344 | { | 341 | { | ||
345 | const QPoint startPoint (d->document->width (), d->document->height ()); | 342 | const QPoint startPoint (d->document->width (), d->document->height ()); | ||
346 | qCDebug(kpLogMainWindow) << "\thavedMovedFromOrgSize=" | 343 | qCDebug(kpLogMainWindow) << "\thavedMovedFromOrgSize=" | ||
347 | << d->scrollView->haveMovedFromOriginalDocSize () << endl; | 344 | << d->scrollView->haveMovedFromOriginalDocSize (); | ||
348 | if (!d->scrollView->haveMovedFromOriginalDocSize ()) | 345 | if (!d->scrollView->haveMovedFromOriginalDocSize ()) | ||
349 | { | 346 | { | ||
350 | setStatusBarShapePoints (startPoint); | 347 | setStatusBarShapePoints (startPoint); | ||
351 | setStatusBarShapeSize (); | 348 | setStatusBarShapeSize (); | ||
352 | } | 349 | } | ||
353 | else | 350 | else | ||
354 | { | 351 | { | ||
355 | const int newWidth = docResizeTo.width (); | 352 | const int newWidth = docResizeTo.width (); | ||
Show All 23 Lines | |||||
379 | } | 376 | } | ||
380 | 377 | | |||
381 | //--------------------------------------------------------------------- | 378 | //--------------------------------------------------------------------- | ||
382 | 379 | | |||
383 | // private slot | 380 | // private slot | ||
384 | void kpMainWindow::recalculateStatusBar () | 381 | void kpMainWindow::recalculateStatusBar () | ||
385 | { | 382 | { | ||
386 | qCDebug(kpLogMainWindow) << "kpMainWindow::recalculateStatusBar() ok=" | 383 | qCDebug(kpLogMainWindow) << "kpMainWindow::recalculateStatusBar() ok=" | ||
387 | << d->statusBarCreated | 384 | << d->statusBarCreated; | ||
388 | << endl; | | |||
389 | 385 | | |||
390 | if (!d->statusBarCreated) | 386 | if (!d->statusBarCreated) { | ||
391 | return; | 387 | return; | ||
388 | } | ||||
392 | 389 | | |||
393 | recalculateStatusBarMessage (); | 390 | recalculateStatusBarMessage (); | ||
394 | recalculateStatusBarShape (); | 391 | recalculateStatusBarShape (); | ||
395 | 392 | | |||
396 | if (d->document) | 393 | if (d->document) | ||
397 | { | 394 | { | ||
398 | setStatusBarDocSize (QSize (d->document->width (), d->document->height ())); | 395 | setStatusBarDocSize (QSize (d->document->width (), d->document->height ())); | ||
399 | setStatusBarDocDepth (d->document->image ().depth ()); | 396 | setStatusBarDocDepth (d->document->image ().depth ()); | ||
Show All 18 Lines |