| 815 | } |
| 816 | |
| 817 | void MainWindow::LoadCapture(const QString &filename, const ReplayOptions &opts, bool temporary, |
| 818 | bool local) |
| 819 | { |
| 820 | if(PromptCloseCapture()) |
| 821 | { |
| 822 | if(m_Ctx.IsCaptureLoading()) |
| 823 | return; |
| 824 | |
| 825 | QString driver; |
| 826 | QString machineIdent; |
| 827 | ReplaySupport support = ReplaySupport::Unsupported; |
| 828 | |
| 829 | bool remoteReplay = !local || m_Ctx.Replay().CurrentRemote().IsConnected(); |
| 830 | |
| 831 | if(local) |
| 832 | { |
| 833 | ICaptureFile *file = RENDERDOC_OpenCaptureFile(); |
| 834 | |
| 835 | ResultDetails result = file->OpenFile(filename, "rdc", NULL); |
| 836 | |
| 837 | if(!result.OK()) |
| 838 | { |
| 839 | RDDialog::critical(this, tr("Error opening capture"), |
| 840 | tr("Couldn't open file '%1'\n%2").arg(filename).arg(result.Message())); |
| 841 | |
| 842 | file->Shutdown(); |
| 843 | return; |
| 844 | } |
| 845 | |
| 846 | driver = file->DriverName(); |
| 847 | machineIdent = file->RecordedMachineIdent(); |
| 848 | support = file->LocalReplaySupport(); |
| 849 | |
| 850 | file->Shutdown(); |
| 851 | |
| 852 | // if the return value suggests remote replay, and it's not already selected, AND the user |
| 853 | // hasn't previously chosen to always replay locally without being prompted, ask if they'd |
| 854 | // prefer to switch to a remote context for replaying. |
| 855 | if(support == ReplaySupport::SuggestRemote && !remoteReplay && |
| 856 | !m_Ctx.Config().AlwaysReplayLocally) |
| 857 | { |
| 858 | SuggestRemoteDialog dialog(driver, machineIdent, this); |
| 859 | |
| 860 | FillRemotesMenu(dialog.remotesMenu(), false); |
| 861 | |
| 862 | dialog.remotesAdded(); |
| 863 | |
| 864 | RDDialog::show(&dialog); |
| 865 | |
| 866 | if(dialog.choice() == SuggestRemoteDialog::Cancel) |
| 867 | { |
| 868 | return; |
| 869 | } |
| 870 | else if(dialog.choice() == SuggestRemoteDialog::Remote) |
| 871 | { |
| 872 | // we only get back here from the dialog once the context switch has begun, |
| 873 | // so contextChooser will have been disabled. |
| 874 | // Check once to see if it's enabled before even popping up the dialog in case |
no test coverage detected