Skip to content
Snippets Groups Projects
Commit aa50336a authored by Edric Milaret's avatar Edric Milaret
Browse files

video: add live video source switching

Refs #74732

Change-Id: I9b04690a4be797ceacb1a81c6cef3cf8a836755a
parent 7153eed5
Branches
Tags
No related merge requests found
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <memory>
#include "video/devicemodel.h"
#include "selectareadialog.h" #include "selectareadialog.h"
VideoWidget::VideoWidget(QWidget *parent) : VideoWidget::VideoWidget(QWidget *parent) :
...@@ -162,6 +166,7 @@ VideoWidget::mouseDoubleClickEvent(QMouseEvent *e) { ...@@ -162,6 +166,7 @@ VideoWidget::mouseDoubleClickEvent(QMouseEvent *e) {
this->show(); this->show();
} }
} }
void void
VideoWidget::showContextMenu(const QPoint& pos) VideoWidget::showContextMenu(const QPoint& pos)
{ {
...@@ -169,6 +174,23 @@ VideoWidget::showContextMenu(const QPoint& pos) ...@@ -169,6 +174,23 @@ VideoWidget::showContextMenu(const QPoint& pos)
QMenu menu; 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); auto shareAction = new QAction("Share entire screen", this);
menu.addAction(shareAction); menu.addAction(shareAction);
connect(shareAction, &QAction::triggered, [=]() { connect(shareAction, &QAction::triggered, [=]() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment