MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / slotCaptureFullPage

Method slotCaptureFullPage

Plugins/WebBrowser/FrmWebBrowser.cpp:1158–1204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1156}
1157
1158void CFrmWebBrowser::slotCaptureFullPage()
1159{
1160 auto pWeb = CurrentView();
1161 if(!pWeb) return;
1162 qDebug(log) << "contents size:" << pWeb->page()->contentsSize();
1163 QString szFile = m_pPara->m_Record.GetImageFile(true);
1164 CCaptureFullPage *pCapture = new CCaptureFullPage();
1165 if(szFile.isEmpty() || !pCapture)
1166 return;
1167 bool check = connect(pCapture, &CCaptureFullPage::sigFinished,
1168 this, [this, pWeb, szFile, pCapture](){
1169 pWeb->setEnabled(true);
1170 qDebug(log) << "End action:" << m_pPara->m_Record.GetEndAction();
1171 QFileInfo fi(szFile);
1172 if(!fi.exists()) {
1173 QString szErr = tr("Fail: capture full page");
1174 qCritical(log) << szErr;
1175 emit sigError(FailCaptureFullPage, szErr);
1176 } else {
1177 QString szMsg = tr("Capture full page to") + " " + szFile;
1178 qInfo(log) << szMsg;
1179 emit sigInformation(szMsg);
1180 switch(m_pPara->m_Record.GetEndAction())
1181 {
1182 case CParameterRecord::ENDACTION::OpenFile: {
1183 bool bRet = QDesktopServices::openUrl(QUrl::fromLocalFile(szFile));
1184 if(!bRet)
1185 qCritical(log) << "Fail: Open capture page the file:" << szFile;
1186 break;
1187 }
1188 case CParameterRecord::ENDACTION::OpenFolder: {
1189 QFileInfo fi(szFile);
1190 QDesktopServices::openUrl(QUrl::fromLocalFile(fi.absolutePath()));
1191 break;
1192 }
1193 default:
1194 break;
1195 }
1196 pCapture->deleteLater();
1197 }
1198 });
1199 Q_ASSERT(check);
1200 pWeb->setEnabled(false);
1201 pCapture->Start(pWeb, pWeb->url(), szFile);
1202
1203 emit sigInformation(tr("Start capture full page"));
1204}
1205
1206void CFrmWebBrowser::slotRecord()
1207{

Callers

nothing calls this directly

Calls 5

GetImageFileMethod · 0.80
GetEndActionMethod · 0.80
urlMethod · 0.80
isEmptyMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected