Commit aa50336a authored by Edric Milaret's avatar Edric Milaret

video: add live video source switching

Refs #74732

Change-Id: I9b04690a4be797ceacb1a81c6cef3cf8a836755a
parent 7153eed5
......@@ -21,6 +21,10 @@
#include <QApplication>
#include <QDesktopWidget>
#include <memory>
#include "video/devicemodel.h"
#include "selectareadialog.h"
VideoWidget::VideoWidget(QWidget *parent) :
......@@ -162,6 +166,7 @@ VideoWidget::mouseDoubleClickEvent(QMouseEvent *e) {
this->show();
}
}
void
VideoWidget::showContextMenu(const QPoint& pos)
{
......@@ -169,6 +174,23 @@ VideoWidget::showContextMenu(const QPoint& pos)
QMenu menu;
for (auto device : Video::DeviceModel::instance()->devices()) {
std::unique_ptr<QAction> deviceAction(new QAction(device->name(), this));
deviceAction->setCheckable(true);
if (device == Video::DeviceModel::instance()->activeDevice())
deviceAction->setChecked(true);
auto ptr = deviceAction.release();
menu.addAction(ptr);
connect(ptr, &QAction::toggled, [=](bool checked) {
if (checked == true) {
Video::SourceModel::instance()->switchTo(device);
Video::DeviceModel::instance()->setActive(device);
}
});
}
menu.addSeparator();
auto shareAction = new QAction("Share entire screen", this);
menu.addAction(shareAction);
connect(shareAction, &QAction::triggered, [=]() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment