| 1992 | } |
| 1993 | |
| 1994 | void MainWindow::setRemoteHost(int hostIdx) |
| 1995 | { |
| 1996 | if(!PromptCloseCapture()) |
| 1997 | return; |
| 1998 | |
| 1999 | // we only want to block once before the initial remoteProbe has happened. After that once we can |
| 2000 | // acquire once, we re-release so the next one can happen |
| 2001 | m_RemoteInitialProbeReady.acquire(); |
| 2002 | m_RemoteInitialProbeReady.release(); |
| 2003 | |
| 2004 | rdcarray<RemoteHost> hosts = m_Ctx.Config().GetRemoteHosts(); |
| 2005 | |
| 2006 | RemoteHost host; |
| 2007 | if(hostIdx >= 0 && hostIdx < hosts.count()) |
| 2008 | host = hosts[hostIdx]; |
| 2009 | |
| 2010 | bool noToAll = false; |
| 2011 | |
| 2012 | QList<LiveCapture *> liveCaptures = m_LiveCaptures; |
| 2013 | |
| 2014 | int unsavedCaps = 0; |
| 2015 | for(LiveCapture *live : liveCaptures) |
| 2016 | unsavedCaps += live->unsavedCaptureCount(); |
| 2017 | |
| 2018 | for(LiveCapture *live : liveCaptures) |
| 2019 | { |
| 2020 | // allow live captures to this host to stay open, that way |
| 2021 | // we can connect to a live capture, then switch into that |
| 2022 | // context |
| 2023 | if(host.IsValid() && live->hostname() == host.Hostname()) |
| 2024 | continue; |
| 2025 | |
| 2026 | // if the user previously selected 'no to all' in the save prompts below, apply that to all |
| 2027 | // subsequent live captures by skipping the check and unconditionally cleaning all captures |
| 2028 | if(!noToAll) |
| 2029 | { |
| 2030 | if(!live->checkAllowClose(unsavedCaps, noToAll)) |
| 2031 | return; |
| 2032 | } |
| 2033 | |
| 2034 | live->cleanItems(); |
| 2035 | live->close(); |
| 2036 | } |
| 2037 | |
| 2038 | m_Ctx.Replay().DisconnectFromRemoteServer(); |
| 2039 | |
| 2040 | if(!host.IsValid()) |
| 2041 | { |
| 2042 | contextChooser->setIcon(Icons::house()); |
| 2043 | contextChooser->setText(tr("Replay Context: %1").arg(tr("Local"))); |
| 2044 | |
| 2045 | ui->action_Inject_into_Process->setEnabled(true); |
| 2046 | |
| 2047 | statusText->setText(QString()); |
| 2048 | |
| 2049 | SetTitle(); |
| 2050 | |
| 2051 | if(m_Ctx.HasCaptureDialog()) |
no test coverage detected