void ScreenshotWindow::_SetWorkerThread(thread_id thread) { if (!Lock()) return; // bool enabled = thread < 0; // // fPreviewsButton->SetEnabled(enabled); // fNextButton->SetEnabled(enabled); // fCloseButton->SetEnabled(enabled); if (thread >= 0) { fWorkerThread = thread; resume_thread(fWorkerThread); } else { fWorkerThread = -1; if (fDownloadPending) { _DownloadScreenshot(); fDownloadPending = false; } } Unlock(); }
void ScreenshotWindow::MessageReceived(BMessage* message) { switch (message->what) { case MSG_NEXT_SCREENSHOT: { atomic_add(&fCurrentScreenshotIndex, 1); _UpdateToolBar(); _DownloadScreenshot(); break; } case MSG_PREVIOUS_SCREENSHOT: atomic_add(&fCurrentScreenshotIndex, -1); _UpdateToolBar(); _DownloadScreenshot(); break; case MSG_DOWNLOAD_START: if (!fBarberPoleShown) { fBarberPole->Start(); fBarberPole->Show(); fBarberPoleShown = true; } break; case MSG_DOWNLOAD_STOP: if (fBarberPoleShown) { fBarberPole->Hide(); fBarberPole->Stop(); fBarberPoleShown = true; } break; default: BWindow::MessageReceived(message); break; } }
void ScreenshotWindow::SetPackage(const PackageInfoRef& package) { if (fPackage == package) return; fPackage = package; BString title = B_TRANSLATE("Screenshot"); if (package.Get() != NULL) { title = package->Title(); _DownloadScreenshot(); } SetTitle(title); }
void ScreenshotWindow::SetPackage(const PackageInfoRef& package) { if (fPackage == package) return; fPackage = package; BString title = B_TRANSLATE("Screenshot"); if (package.Get() != NULL) { title = package->Title(); _DownloadScreenshot(); } SetTitle(title); atomic_set(&fCurrentScreenshotIndex, 0); _UpdateToolBar(); }