void CProgressJob::SetText(const std::string &text) { if (!m_updateInformation) return; if (m_progress != NULL) m_progress->SetText(text); else if (m_progressDialog != NULL) { m_progressDialog->SetText(CVariant{text}); ShowProgressDialog(); } }
void CProgressJob::SetTitle(const std::string &title) { if (!m_updateInformation) return; if (m_progress != NULL) m_progress->SetTitle(title); else if (m_progressDialog != NULL) { m_progressDialog->SetHeading(CVariant{title}); ShowProgressDialog(); } }
nsresult nsMsgPrintEngine::FireThatLoadOperationStartup(const nsString& uri) { if (!uri.IsEmpty()) mLoadURI = uri; else mLoadURI.Truncate(); bool notify = false; nsresult rv = NS_ERROR_FAILURE; // Don't show dialog if we are out of URLs //if ( mCurrentlyPrintingURI < mURIArray.Length() && !mIsDoingPrintPreview) if ( mCurrentlyPrintingURI < mURIArray.Length()) rv = ShowProgressDialog(!mIsDoingPrintPreview, notify); if (NS_FAILED(rv) || !notify) return FireThatLoadOperation(uri); return NS_OK; }
void CProgressJob::SetProgress(float percentage) const { if (!m_updateProgress) return; if (m_progress != NULL) m_progress->SetPercentage(percentage); else if (m_progressDialog != NULL) { ShowProgressDialog(); int iPercentage = static_cast<int>(ceil(percentage)); // only change and update the progress bar if its percentage value changed // (this can have a huge impact on performance if it's called a lot) if (iPercentage != m_progressDialog->GetPercentage()) { m_progressDialog->SetPercentage(iPercentage); m_progressDialog->Progress(); } } }
void CaptureContext::RecompressCapture() { QString destFilename = GetCaptureFilename(); QString tempFilename; ICaptureFile *cap = NULL; ICaptureFile *tempCap = NULL; bool inplace = false; if(IsCaptureTemporary() || !IsCaptureLocal()) { QMessageBox::StandardButton res = RDDialog::question(m_MainWindow, tr("Unsaved capture"), tr("To recompress a capture you must save it first. Save this capture?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if(res == QMessageBox::Cancel || res == QMessageBox::No) return; destFilename = m_MainWindow->GetSavePath(); // if it's already local, we'll do the save as part of the recompression convert. If it's // remote, we need to copy it first, but we copy it to a temporary so we can do the conversion // to the target location if(IsCaptureLocal()) { tempFilename = GetCaptureFilename(); } else { tempFilename = TempCaptureFilename(lit("recompress")); Replay().CopyCaptureFromRemote(GetCaptureFilename(), tempFilename, m_MainWindow); if(!QFile::exists(tempFilename)) { RDDialog::critical(m_MainWindow, tr("Failed to save capture"), tr("Capture couldn't be saved from remote.")); return; } } } else { // if we're doing this inplace on an already saved capture, then we need to recompress to a // temporary and close/move it afterwards. inplace = true; destFilename = TempCaptureFilename(lit("recompress")); } if(IsCaptureLocal()) { // for local files we already have a handle. We'll reuse it, then re-open cap = Replay().GetCaptureFile(); } else { // for remote files we open a new short-lived handle on the temporary file tempCap = cap = RENDERDOC_OpenCaptureFile(); cap->OpenFile(tempFilename.toUtf8().data(), "rdc"); } if(!cap) { RDDialog::critical(m_MainWindow, tr("Unexpected missing handle"), tr("Couldn't get open handle to file for recompression.")); return; } int index = cap->FindSectionByType(SectionType::FrameCapture); SectionProperties props = cap->GetSectionProperties(index); if(props.flags & SectionFlags::ZstdCompressed) { RDDialog::information(m_MainWindow, tr("Capture already compressed"), tr("This capture is already compressed as much as is possible.")); if(tempCap) tempCap->Shutdown(); if(!tempFilename.isEmpty()) QFile::remove(tempFilename); return; } // convert from the currently open cap to the destination float progress = 0.0f; LambdaThread *th = new LambdaThread([this, cap, destFilename, &progress]() { cap->Convert(destFilename.toUtf8().data(), "rdc", [&progress](float p) { progress = p; }); }); th->start(); // wait a few ms before popping up a progress bar th->wait(500); if(th->isRunning()) { ShowProgressDialog(m_MainWindow, tr("Recompressing file."), [th]() { return !th->isRunning(); }, [&progress]() { return progress; }); } th->deleteLater(); if(inplace) { // if we're recompressing "in place", we need to close our capture, move the temporary over // the original, then re-open. // this releases the hold over the real desired location. cap->OpenFile("", ""); // now remove the old capture QFile::remove(GetCaptureFilename()); // move the recompressed one over QFile::rename(destFilename, GetCaptureFilename()); // and re-open cap->OpenFile(GetCaptureFilename().c_str(), "rdc"); } else { // we've converted into the desired location. We don't have to do anything else but mark our // new locally saved non-temporary status. m_CaptureFile = destFilename; m_CaptureLocal = true; m_CaptureTemporary = false; // open the saved capture file. This will let us remove the old file too Replay().ReopenCaptureFile(m_CaptureFile); m_CaptureMods = CaptureModifications::All; SaveChanges(); } // close any temporary resources if(tempCap) tempCap->Shutdown(); if(!tempFilename.isEmpty()) QFile::remove(tempFilename); }
void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFilename, bool temporary, bool local) { m_LoadInProgress = true; if(local) m_Config.CrashReport_LastOpenedCapture = origFilename; bool newCapture = (!temporary && !Config().RecentCaptureFiles.contains(origFilename)); LambdaThread *thread = new LambdaThread([this, captureFile, origFilename, temporary, local]() { LoadCaptureThreaded(captureFile, origFilename, temporary, local); }); thread->selfDelete(true); thread->start(); QElapsedTimer loadTimer; loadTimer.start(); ShowProgressDialog(m_MainWindow, tr("Loading Capture: %1").arg(origFilename), [this]() { return !m_LoadInProgress; }, [this]() { return UpdateLoadProgress(); }); ANALYTIC_ADDAVG(Performance.LoadTime, double(loadTimer.nsecsElapsed() * 1.0e-9)); ANALYTIC_SET(CaptureFeatures.ShaderLinkage, m_APIProps.ShaderLinkage); ANALYTIC_SET(CaptureFeatures.YUVTextures, m_APIProps.YUVTextures); ANALYTIC_SET(CaptureFeatures.SparseResources, m_APIProps.SparseResources); ANALYTIC_SET(CaptureFeatures.MultiGPU, m_APIProps.MultiGPU); ANALYTIC_SET(CaptureFeatures.D3D12Bundle, m_APIProps.D3D12Bundle); m_MainWindow->setProgress(-1.0f); if(m_CaptureLoaded) { m_CaptureTemporary = temporary; m_CaptureMods = CaptureModifications::NoModifications; rdcarray<ICaptureViewer *> viewers(m_CaptureViewers); // make sure we're on a consistent event before invoking viewer forms if(m_LastDrawcall) SetEventID(viewers, m_LastDrawcall->eventId, true); else if(!m_Drawcalls.empty()) SetEventID(viewers, m_Drawcalls.back().eventId, true); GUIInvoke::blockcall([&viewers]() { // notify all the registers viewers that a capture has been loaded for(ICaptureViewer *viewer : viewers) { if(viewer) viewer->OnCaptureLoaded(); } }); if(newCapture && m_Notes.contains(lit("comments"))) { if(!HasCommentView()) ShowCommentView(); RaiseDockWindow(GetCommentView()->Widget()); } } }
static void Run() { CImg Source, SourceMask; InitSourceImage(gFilterRecord, Source, SourceMask); Parameters params; params.Init(); ReadRegistryParameters(params); ReadScriptParameters(params); /* Run the UI if we've been told to. */ bool bApplyToImage = true; if(!gFilterRecord->descriptorParameters || gFilterRecord->descriptorParameters->playInfo == plugInDialogDisplay) { PreviewRenderer pr; pr.Source.Hold(Source); pr.SourceMask.Hold(SourceMask); pr.FilterSettings = params.FilterSettings; pr.FilterOptions = params.FilterOptions; SetFromImage(gFilterRecord, pr.Source, pr.Image.PreviewImage); UIResult ret = DoUI(&pr); pr.m_pAlgorithm->Abort(); pr.Image.PreviewImage.Free(); if(ret == UI_CANCEL) { /* The user cancelled. */ throw PhotoshopErrorException(userCanceledErr); } if(ret == UI_SAVE_ONLY) bApplyToImage = false; params.FilterSettings = pr.FilterSettings; params.FilterOptions = pr.FilterOptions; WriteRegistryParameters(params); } WriteScriptParameters(params); if(!bApplyToImage) return; /* Run the main filter. */ auto_ptr<Algorithm> pAlgo(new Algorithm); pAlgo->SetTarget(Source); pAlgo->SetMask(SourceMask); pAlgo->GetSettings() = params.FilterSettings; pAlgo->GetOptions() = params.FilterOptions; if(Source.m_iBytesPerChannel == 2) pAlgo->GetSettings().m_fInputScale = 255.0f / 32768.0f; else pAlgo->GetSettings().m_fInputScale = 1.0f; pAlgo->Run(); if(!ShowProgressDialog(pAlgo.get())) throw PhotoshopErrorException(userCanceledErr); string sError; if(pAlgo->GetError(sError)) throw Exception(sError); }
void GNC::GUI::StatusBarProgreso::OnMostrarOcultarDialogoProgreso(wxMouseEvent& ) { ShowProgressDialog(!GNC::GCS::ControladorVistas::Instance()->EsVisible(m_pPanelTareas)); }