| 1175 | } |
| 1176 | |
| 1177 | void LiveCapture::connectionClosed() |
| 1178 | { |
| 1179 | ui->progressLabel->setVisible(false); |
| 1180 | ui->progressBar->setVisible(false); |
| 1181 | |
| 1182 | if(m_IgnoreThreadClosed) |
| 1183 | return; |
| 1184 | |
| 1185 | if(ui->captures->count() <= 1) |
| 1186 | { |
| 1187 | if(ui->captures->count() == 1) |
| 1188 | { |
| 1189 | Capture *cap = GetCapture(ui->captures->item(0)); |
| 1190 | |
| 1191 | // only auto-open a non-local capture if we are successfully connected |
| 1192 | // to this machine as a remote context |
| 1193 | if(!cap->local) |
| 1194 | { |
| 1195 | if(m_Ctx.Replay().CurrentRemote().Hostname() != rdcstr(m_Hostname)) |
| 1196 | return; |
| 1197 | } |
| 1198 | |
| 1199 | // don't close if a dialog is open |
| 1200 | if(QApplication::activeModalWidget() || QApplication::activePopupWidget()) |
| 1201 | return; |
| 1202 | |
| 1203 | if(cap->opened) |
| 1204 | return; |
| 1205 | |
| 1206 | openCapture(cap); |
| 1207 | if(!cap->saved) |
| 1208 | { |
| 1209 | cap->saved = true; |
| 1210 | m_Main->takeCaptureOwnership(); |
| 1211 | } |
| 1212 | } |
| 1213 | |
| 1214 | // auto-close and load capture if we got a capture. If we |
| 1215 | // don't have any captures but DO have child processes, |
| 1216 | // then don't close just yet. |
| 1217 | if(ui->captures->count() == 1 || m_Children.count() == 0) |
| 1218 | { |
| 1219 | // raise the texture viewer if it exists, instead of falling back to most likely the capture |
| 1220 | // executable dialog which is not useful. |
| 1221 | if(ui->captures->count() == 1 && m_Ctx.HasTextureViewer()) |
| 1222 | m_Ctx.ShowTextureViewer(); |
| 1223 | selfClose(); |
| 1224 | return; |
| 1225 | } |
| 1226 | |
| 1227 | // if we have no captures and only one child, close and |
| 1228 | // open up a connection to it (similar to behaviour with |
| 1229 | // only one capture |
| 1230 | if(ui->captures->count() == 0 && m_Children.count() == 1) |
| 1231 | { |
| 1232 | LiveCapture *live = |
| 1233 | new LiveCapture(m_Ctx, m_Hostname, m_HostFriendlyname, m_Children[0].ident, m_Main); |
| 1234 | m_Main->ShowLiveCapture(live); |
nothing calls this directly
no test coverage detected