Changeset View
Changeset View
Standalone View
Standalone View
mainWindow/kpMainWindow_View_Thumbnail.cpp
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 127 | { | |||
---|---|---|---|---|---|
139 | d->thumbnailSaveConfigTimer->start (500/*msec*/); | 139 | d->thumbnailSaveConfigTimer->start (500/*msec*/); | ||
140 | } | 140 | } | ||
141 | 141 | | |||
142 | // private slot | 142 | // private slot | ||
143 | void kpMainWindow::slotSaveThumbnailGeometry () | 143 | void kpMainWindow::slotSaveThumbnailGeometry () | ||
144 | { | 144 | { | ||
145 | qCDebug(kpLogMainWindow) << "kpMainWindow::saveThumbnailGeometry()"; | 145 | qCDebug(kpLogMainWindow) << "kpMainWindow::saveThumbnailGeometry()"; | ||
146 | 146 | | |||
147 | if (!d->thumbnail) | 147 | if (!d->thumbnail) { | ||
148 | return; | 148 | return; | ||
149 | } | ||||
149 | 150 | | |||
150 | QRect rect (d->thumbnail->x (), d->thumbnail->y (), | 151 | QRect rect (d->thumbnail->x (), d->thumbnail->y (), | ||
151 | d->thumbnail->width (), d->thumbnail->height ()); | 152 | d->thumbnail->width (), d->thumbnail->height ()); | ||
152 | qCDebug(kpLogMainWindow) << "\tthumbnail relative geometry=" << rect; | 153 | qCDebug(kpLogMainWindow) << "\tthumbnail relative geometry=" << rect; | ||
153 | 154 | | |||
154 | d->configThumbnailGeometry = mapFromGlobal (rect); | 155 | d->configThumbnailGeometry = mapFromGlobal (rect); | ||
155 | 156 | | |||
156 | qCDebug(kpLogMainWindow) << "\tCONFIG: saving thumbnail geometry " | 157 | qCDebug(kpLogMainWindow) << "\tCONFIG: saving thumbnail geometry "; | ||
157 | << d->configThumbnailGeometry | | |||
158 | << endl; | | |||
159 | 158 | | |||
160 | KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupThumbnail); | 159 | KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupThumbnail); | ||
161 | 160 | | |||
162 | cfg.writeEntry (kpSettingThumbnailGeometry, d->configThumbnailGeometry); | 161 | cfg.writeEntry (kpSettingThumbnailGeometry, d->configThumbnailGeometry); | ||
163 | cfg.sync (); | 162 | cfg.sync (); | ||
164 | } | 163 | } | ||
165 | 164 | | |||
166 | // private slot | 165 | // private slot | ||
Show All 12 Lines | 167 | { | |||
179 | enableThumbnailOptionActions (d->actionShowThumbnail->isChecked ()); | 178 | enableThumbnailOptionActions (d->actionShowThumbnail->isChecked ()); | ||
180 | updateThumbnail (); | 179 | updateThumbnail (); | ||
181 | } | 180 | } | ||
182 | 181 | | |||
183 | // private slot | 182 | // private slot | ||
184 | void kpMainWindow::updateThumbnailZoomed () | 183 | void kpMainWindow::updateThumbnailZoomed () | ||
185 | { | 184 | { | ||
186 | qCDebug(kpLogMainWindow) << "kpMainWindow::updateThumbnailZoomed() zoomed=" | 185 | qCDebug(kpLogMainWindow) << "kpMainWindow::updateThumbnailZoomed() zoomed=" | ||
187 | << d->actionZoomedThumbnail->isChecked () << endl; | 186 | << d->actionZoomedThumbnail->isChecked (); | ||
188 | 187 | | |||
189 | if (!d->thumbnailView) | 188 | if (!d->thumbnailView) { | ||
190 | return; | 189 | return; | ||
190 | } | ||||
191 | 191 | | |||
192 | destroyThumbnailView (); | 192 | destroyThumbnailView (); | ||
193 | createThumbnailView (); | 193 | createThumbnailView (); | ||
194 | } | 194 | } | ||
195 | 195 | | |||
196 | // private slot | 196 | // private slot | ||
197 | void kpMainWindow::slotZoomedThumbnailToggled () | 197 | void kpMainWindow::slotZoomedThumbnailToggled () | ||
198 | { | 198 | { | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 288 | { | |||
294 | d->thumbnailView->setObjectName ( QLatin1String("thumbnailView" )); | 294 | d->thumbnailView->setObjectName ( QLatin1String("thumbnailView" )); | ||
295 | } | 295 | } | ||
296 | 296 | | |||
297 | d->thumbnailView->showBuddyViewScrollableContainerRectangle ( | 297 | d->thumbnailView->showBuddyViewScrollableContainerRectangle ( | ||
298 | d->actionShowThumbnailRectangle->isChecked ()); | 298 | d->actionShowThumbnailRectangle->isChecked ()); | ||
299 | 299 | | |||
300 | 300 | | |||
301 | qCDebug(kpLogMainWindow) << "\t\tgive kpThumbnail the kpView:"; | 301 | qCDebug(kpLogMainWindow) << "\t\tgive kpThumbnail the kpView:"; | ||
302 | if (d->thumbnail) | 302 | if (d->thumbnail) { | ||
303 | d->thumbnail->setView (d->thumbnailView); | 303 | d->thumbnail->setView (d->thumbnailView); | ||
304 | else | 304 | } | ||
305 | qCCritical(kpLogMainWindow) << "kpMainWindow::createThumbnailView() no thumbnail" << endl; | 305 | else { | ||
306 | qCCritical(kpLogMainWindow) << "kpMainWindow::createThumbnailView() no thumbnail"; | ||||
307 | } | ||||
306 | 308 | | |||
307 | qCDebug(kpLogMainWindow) << "\t\tregistering the kpView:"; | 309 | qCDebug(kpLogMainWindow) << "\t\tregistering the kpView:"; | ||
308 | if (d->viewManager) | 310 | if (d->viewManager) { | ||
309 | d->viewManager->registerView (d->thumbnailView); | 311 | d->viewManager->registerView (d->thumbnailView); | ||
310 | } | 312 | } | ||
313 | } | ||||
311 | 314 | | |||
312 | // private | 315 | // private | ||
313 | void kpMainWindow::destroyThumbnailView () | 316 | void kpMainWindow::destroyThumbnailView () | ||
314 | { | 317 | { | ||
315 | if (!d->thumbnailView) | 318 | if (!d->thumbnailView) { | ||
316 | return; | 319 | return; | ||
320 | } | ||||
317 | 321 | | |||
318 | if (d->viewManager) | 322 | if (d->viewManager) { | ||
319 | d->viewManager->unregisterView (d->thumbnailView); | 323 | d->viewManager->unregisterView (d->thumbnailView); | ||
324 | } | ||||
320 | 325 | | |||
321 | if (d->thumbnail) | 326 | if (d->thumbnail) { | ||
322 | d->thumbnail->setView (nullptr); | 327 | d->thumbnail->setView (nullptr); | ||
328 | } | ||||
323 | 329 | | |||
324 | d->thumbnailView->deleteLater (); d->thumbnailView = nullptr; | 330 | d->thumbnailView->deleteLater (); d->thumbnailView = nullptr; | ||
325 | } | 331 | } | ||
326 | 332 | | |||
327 | 333 | | |||
328 | // private | 334 | // private | ||
329 | void kpMainWindow::updateThumbnail () | 335 | void kpMainWindow::updateThumbnail () | ||
330 | { | 336 | { | ||
331 | qCDebug(kpLogMainWindow) << "kpMainWindow::updateThumbnail()"; | 337 | qCDebug(kpLogMainWindow) << "kpMainWindow::updateThumbnail()"; | ||
332 | bool enable = d->actionShowThumbnail->isChecked (); | 338 | bool enable = d->actionShowThumbnail->isChecked (); | ||
333 | 339 | | |||
334 | qCDebug(kpLogMainWindow) << "\tthumbnail=" | 340 | qCDebug(kpLogMainWindow) << "\tthumbnail=" | ||
335 | << bool (d->thumbnail) | 341 | << bool (d->thumbnail) | ||
336 | << " action_isChecked=" | 342 | << " action_isChecked=" | ||
337 | << enable | 343 | << enable; | ||
338 | << endl; | | |||
339 | 344 | | |||
340 | if (bool (d->thumbnail) == enable) | 345 | if (bool (d->thumbnail) == enable) { | ||
341 | return; | 346 | return; | ||
347 | } | ||||
342 | 348 | | |||
343 | if (!d->thumbnail) | 349 | if (!d->thumbnail) | ||
344 | { | 350 | { | ||
345 | qCDebug(kpLogMainWindow) << "\tcreating thumbnail"; | 351 | qCDebug(kpLogMainWindow) << "\tcreating thumbnail"; | ||
346 | 352 | | |||
347 | // Read last saved geometry before creating thumbnail & friends | 353 | // Read last saved geometry before creating thumbnail & friends | ||
348 | // in case they call notifyThumbnailGeometryChanged() | 354 | // in case they call notifyThumbnailGeometryChanged() | ||
349 | QRect thumbnailGeometry = d->configThumbnailGeometry; | 355 | QRect thumbnailGeometry = d->configThumbnailGeometry; | ||
Show All 38 Lines | |||||
388 | qCDebug(kpLogMainWindow) << "\t\tconnecting signal thumbnail::windowClosed to destroy slot"; | 394 | qCDebug(kpLogMainWindow) << "\t\tconnecting signal thumbnail::windowClosed to destroy slot"; | ||
389 | connect (d->thumbnail, &kpThumbnail::windowClosed, | 395 | connect (d->thumbnail, &kpThumbnail::windowClosed, | ||
390 | this, &kpMainWindow::slotDestroyThumbnailInitatedByUser); | 396 | this, &kpMainWindow::slotDestroyThumbnailInitatedByUser); | ||
391 | qCDebug(kpLogMainWindow) << "\t\tDONE"; | 397 | qCDebug(kpLogMainWindow) << "\t\tDONE"; | ||
392 | } | 398 | } | ||
393 | else | 399 | else | ||
394 | { | 400 | { | ||
395 | qCDebug(kpLogMainWindow) << "\tdestroying thumbnail d->thumbnail=" | 401 | qCDebug(kpLogMainWindow) << "\tdestroying thumbnail d->thumbnail=" | ||
396 | << d->thumbnail << endl; | 402 | << d->thumbnail; | ||
397 | 403 | | |||
398 | if (d->thumbnailSaveConfigTimer && d->thumbnailSaveConfigTimer->isActive ()) | 404 | if (d->thumbnailSaveConfigTimer && d->thumbnailSaveConfigTimer->isActive ()) | ||
399 | { | 405 | { | ||
400 | d->thumbnailSaveConfigTimer->stop (); | 406 | d->thumbnailSaveConfigTimer->stop (); | ||
401 | slotSaveThumbnailGeometry (); | 407 | slotSaveThumbnailGeometry (); | ||
402 | } | 408 | } | ||
403 | 409 | | |||
404 | // Must be done before hiding the thumbnail to avoid triggering | 410 | // Must be done before hiding the thumbnail to avoid triggering | ||
Show All 13 Lines |