Skip to content

Commit

Permalink
Released code for version 5.3.0-beta1.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlonluca committed Jul 25, 2016
1 parent 3737e0e commit 5abbeab
Show file tree
Hide file tree
Showing 43 changed files with 1,257 additions and 316 deletions.
19 changes: 18 additions & 1 deletion PiOmxTextures.pro
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,21 @@ SUBDIRS = \
piomxtextures_app \
piomxtextures_pocplayer \
piomxtextures_samples \
piomxtextures_qmlutils
piomxtextures_qmlutils \
piomxtextures_pocplayer_widget

qtHaveModule(webkit) {
message("Building wk1 sample...")
SUBDIRS += piomxtextures_browser_wk
SUBDIRS += piomxtextures_pocplayer_yt
}

qtHaveModule(webenginewidgets) {
#message("Building we sample based on widgets...")
#SUBDIRS += piomxtextures_browser_we_widget
}

qtHaveModule(webengine) {
message("Building we sample based on QML...")
SUBDIRS += piomxtextures_browser_we
}
63 changes: 63 additions & 0 deletions piomxtextures_browser_we/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Project: PiOmxTextures
* Author: Luca Carlon
* Date: 11.29.2015
*
* Copyright (c) 2015 Luca Carlon. All rights reserved.
*
* This file is part of PiOmxTextures.
*
* PiOmxTextures is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PiOmxTextures is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PiOmxTextures. If not, see <http://www.gnu.org/licenses/>.
*/

/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <QApplication>
#include <QQuickView>
#include <QQuickItem>
#include <QtWebEngineWidgets>

/*------------------------------------------------------------------------------
| main
+-----------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication a(argc, argv);

QStringList args = a.arguments();
const bool opengl = !args.contains("--no-opengl");
args.removeAll("--no-opengl");

if (opengl) {
qDebug("QML QtWebEngine...");

QQuickView* view = new QQuickView;
view->setSource(QUrl("qrc:/poc_main.qml"));
view->showFullScreen();

QObject* o = view->rootObject()->findChild<QObject*>("webEngineView");
o->setProperty("url", args.at(1));
}
else {
qDebug("Widget QtWebEngine...");

QWebEngineView* view = new QWebEngineView;
view->load(QUrl(args.at(1)));
view->show();
}

return a.exec();
}
12 changes: 12 additions & 0 deletions piomxtextures_browser_we/piomxtextures_browser_we.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
QT += core gui webenginewidgets

TARGET = piomxtextures_browser_we
TEMPLATE = app

SOURCES += main.cpp

DISTFILES += \
poc_main.qml

RESOURCES += \
res.qrc
12 changes: 12 additions & 0 deletions piomxtextures_browser_we/poc_main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import QtQuick 2.0
import QtWebEngine 1.2

Rectangle {
anchors.fill: parent
color: "red"

WebEngineView {
objectName: "webEngineView"
anchors.fill: parent
}
}
5 changes: 5 additions & 0 deletions piomxtextures_browser_we/res.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>poc_main.qml</file>
</qresource>
</RCC>
94 changes: 94 additions & 0 deletions piomxtextures_browser_wk/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Project: PiOmxTextures
* Author: Luca Carlon
* Date: 11.29.2015
*
* Copyright (c) 2015 Luca Carlon. All rights reserved.
*
* This file is part of PiOmxTextures.
*
* PiOmxTextures is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PiOmxTextures is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PiOmxTextures. If not, see <http://www.gnu.org/licenses/>.
*/

/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <QApplication>
#include <QWebView>
#include <QQuickView>
#include <QQuickItem>
#include <QGraphicsView>
#include <QGraphicsWebView>
#include <QGraphicsScene>
#include <QOpenGLWidget>
#include <QSurfaceFormat>

/*------------------------------------------------------------------------------
| main
+-----------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication a(argc, argv);

QStringList args = a.arguments();
const bool opengl = !args.contains("--no-opengl");
const bool wk2 = args.contains("--wk2");
args.removeAll("--no-opengl");
args.removeAll("--wk2");
args.removeAll("--wk1"); // Default.

const QString surl = args.at(1);

if (!wk2) {
QGraphicsWebView* webItem = new QGraphicsWebView;
QOpenGLWidget* glViewport = new QOpenGLWidget;

QGraphicsView* view = new QGraphicsView;

// Set EGL to 24bit color depth.
QSurfaceFormat curSurface = glViewport->format();
curSurface.setRedBufferSize(8);
curSurface.setGreenBufferSize(8);
curSurface.setBlueBufferSize(8);
curSurface.setAlphaBufferSize(0);
glViewport->setFormat(curSurface);

view->setRenderHints(QPainter::Antialiasing);
view->setScene(new QGraphicsScene);
if (opengl)
view->setViewport(glViewport);
else
QObject::connect(qApp, SIGNAL(aboutToQuit()),
glViewport, SLOT(deleteLater()));
view->showFullScreen();

view->scene()->setBackgroundBrush(QBrush(Qt::red));
view->scene()->setSceneRect(QRectF(0, 0, 1910, 1070));
view->scene()->addItem(webItem);

webItem->setUrl(QUrl(surl));
webItem->setMinimumSize(1910, 1070);
}
else {
QQuickView* view = new QQuickView;
view->setSource(QUrl("qrc:/main_wk2.qml"));
view->show();

QObject* o = view->rootObject();
o->setProperty("url", args.at(1));
}

return a.exec();
}
7 changes: 7 additions & 0 deletions piomxtextures_browser_wk/main_wk2.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import QtQuick 2.0
import QtWebKit 3.0

WebView {
objectName: "webView"
anchors.fill: parent
}
9 changes: 9 additions & 0 deletions piomxtextures_browser_wk/piomxtextures_browser_wk.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
QT += core gui webkitwidgets quick

TARGET = piomxtextures_browser_wk
TEMPLATE = app

SOURCES += main.cpp

RESOURCES += \
res.qrc
5 changes: 5 additions & 0 deletions piomxtextures_browser_wk/res.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>main_wk2.qml</file>
</qresource>
</RCC>
2 changes: 1 addition & 1 deletion piomxtextures_lib/piomxtextures_lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

TEMPLATE = lib

VERSION = 5.2.0
VERSION = 5.3.0

QT += core core-private gui gui-private opengl quick quick-private
CONFIG += no_private_qt_headers_warning
Expand Down
Binary file added piomxtextures_pocplayer/img/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions piomxtextures_pocplayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ bool show_media(QQuickView* view, QString mediaLocation)
QObject* rootObject = dynamic_cast<QObject*>(view->rootObject());
QObject* mediaOutput = rootObject->findChild<QObject*>("mediaOutput");
QMetaObject::invokeMethod(mediaOutput, "showUrlMedia", Q_ARG(QVariant, uri.toString()));
QMetaObject::invokeMethod(mediaOutput, "play");

return true;
}
Expand Down
Loading

0 comments on commit 5abbeab

Please sign in to comment.