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

Method slotDesktopMediaRequest

Plugins/WebBrowser/FrmWebView.cpp:442–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440// Test example: https://thetbw.github.io/web-screen-recorder-demo/
441#include "DlgScreenCapture.h"
442void CFrmWebView::slotDesktopMediaRequest(const QWebEngineDesktopMediaRequest &request)
443{
444 qDebug(log) << Q_FUNC_INFO;
445 QString szMsg = "- Screen:\n";
446 for(int i = 0; i < request.screensModel()->rowCount(); i++) {
447 QModelIndex index;
448 auto model = request.screensModel();
449 index = model->index(i, 0);
450 szMsg += " - " + QString::number(i) + ": " + model->data(index).toString() + "\n";
451 }
452 szMsg += "- Windows:\n";
453 for(int w = 0; w < request.windowsModel()->rowCount(); w++) {
454 QModelIndex index;
455 auto model = request.windowsModel();
456 index = model->index(w, 0);
457 szMsg += " - " + QString::number(w) + ": " + model->data(index).toString() + "\n";
458 }
459 qDebug(log) << szMsg;
460
461 if(request.screensModel()->rowCount() <= 0 && request.windowsModel()->rowCount() <= 0)
462 return;
463
464 CDlgScreenCapture dlg(request);
465 if(QDialog::Rejected == dlg.exec())
466 return;
467 // select the primary screen
468 CDlgScreenCapture::Type type;
469 int id = -1;
470 int nRet = dlg.GetIndex(type, id);
471 if(nRet) return;
472 QModelIndex index;
473 QAbstractListModel* model = nullptr;
474 switch(type) {
475 case CDlgScreenCapture::Type::Screen: {
476 model = request.screensModel();
477 if(!model) return;
478 if(0 > id || model->rowCount() <= id)
479 return;
480 index = model->index(id);
481 request.selectScreen(index);
482 break;
483 }
484 case CDlgScreenCapture::Type::Window: {
485 model = request.windowsModel();
486 if(!model) return;
487 if(0 > id || model->rowCount() <= id)
488 return;
489 index = model->index(id);
490 request.selectWindow(index);
491 break;
492 }
493 }
494
495}
496
497void CFrmWebView::slotWebAuthUxRequested(QWebEngineWebAuthUxRequest *request)
498{

Callers

nothing calls this directly

Calls 4

rowCountMethod · 0.45
indexMethod · 0.45
dataMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected