src/Webcam.cpp

changeset 391
42936c86cbac
child 392
e5b14c5d646b
equal deleted inserted replaced
390:2a69be28a925 391:42936c86cbac
1 /**
2 * Webcam.cpp is part of bmsapp.
3 *
4 * bmsapp is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * bmsapp is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include "Webcam.h"
18 #include "MainWindow.h"
19
20 #include <QWebEngineView>
21
22 Webcam::Webcam(QString url, QWidget *parent) : QDialog(parent)
23 {
24 qDebug() << "Webcam:" << url;
25
26 dialog = new QDialog(parent);
27 dialog->setWindowTitle(tr("BMSapp - Webcam ") + url);
28 dialog->setObjectName(QString::fromUtf8("Webcam"));
29 dialog->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
30
31 QWebEngineView *m_view(new QWebEngineView(dialog));
32 QWebEnginePage *page = m_view->page();
33
34 connect(page, &QWebEnginePage::windowCloseRequested, this, &Webcam::windowClose);
35
36 page->load(QUrl(url));
37 dialog->resize(800, 600);
38 m_view->resize(780, 592);
39
40 dialog->setModal(true);
41 dialog->exec();
42 }
43
44
45 Webcam::~Webcam()
46 {
47 qDebug() << "Webcam destroyed";
48 }
49
50
51 void Webcam::windowClose()
52 {
53 dialog->close();
54 }
55
56

mercurial