diff options
author | Oleg Yadrov <oleg.yadrov@qt.io> | 2016-11-28 12:43:24 -0800 |
---|---|---|
committer | Oleg Yadrov <oleg.yadrov@qt.io> | 2017-01-04 00:11:04 +0000 |
commit | 0b1a2b195a1499057408075242103615466b3ecf (patch) | |
tree | 9e0e555fd71908be79a827352196ad766599675d /plugin | |
parent | 0831aa531e559a2d6dba5cbd510289212949fa56 (diff) |
Long live set top box demo
Done-with: Jake Petroules <jake.petroules@qt.io>
Change-Id: I9b2b03aba1008e25c99a3b6943c25a360bfd000f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/Info.plist | 27 | ||||
-rw-r--r-- | plugin/cpp/main.cpp | 63 | ||||
-rw-r--r-- | plugin/plugin.pro | 18 | ||||
-rw-r--r-- | plugin/plugin.qbs | 52 | ||||
-rw-r--r-- | plugin/qml/main.qml | 48 | ||||
-rw-r--r-- | plugin/qml/qml.qrc | 5 |
6 files changed, 213 insertions, 0 deletions
diff --git a/plugin/Info.plist b/plugin/Info.plist new file mode 100644 index 0000000..06cb945 --- /dev/null +++ b/plugin/Info.plist @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleIdentifier</key> + <string>org.example.qt-tv-npapi-host</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0.0</string> + <key>LSMinimumSystemVersion</key> + <string>10.7</string> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/plugin/cpp/main.cpp b/plugin/cpp/main.cpp new file mode 100644 index 0000000..1169488 --- /dev/null +++ b/plugin/cpp/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QFontDatabase> +#include <QtWebKit/QWebSettings> + +void loadFonts() { + QStringList fonts { + ":/fonts/TitilliumWeb-Black.ttf", + ":/fonts/TitilliumWeb-Bold.ttf", + ":/fonts/TitilliumWeb-BoldItalic.ttf", + ":/fonts/TitilliumWeb-ExtraLight.ttf", + ":/fonts/TitilliumWeb-ExtraLightItalic.ttf", + ":/fonts/TitilliumWeb-Italic.ttf", + ":/fonts/TitilliumWeb-Light.ttf", + ":/fonts/TitilliumWeb-LightItalic.ttf", + ":/fonts/TitilliumWeb-Regular.ttf", + ":/fonts/TitilliumWeb-SemiBold.ttf", + ":/fonts/TitilliumWeb-SemiBoldItalic.ttf", + ":/fonts/fontawesome-webfont.ttf" + }; + + foreach (const QString &font, fonts) { + QFontDatabase::addApplicationFont(font); + } +} + +int main(int argc, char *argv[]) { + QGuiApplication app(argc, argv); + + loadFonts(); + + QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + + return app.exec(); +} diff --git a/plugin/plugin.pro b/plugin/plugin.pro new file mode 100644 index 0000000..37a6682 --- /dev/null +++ b/plugin/plugin.pro @@ -0,0 +1,18 @@ +TEMPLATE = app +QT += qml webkit +CONFIG += console +CONFIG -= app_bundle + +TARGET = qt-tv-npapi-host + +darwin { + QMAKE_RPATHDIR += @loader_path/../Frameworks + QMAKE_LFLAGS += "-Wl,-sectcreate,__TEXT,__info_plist,$$PWD/Info.plist" +} + + +SOURCES += \ + cpp/main.cpp + +RESOURCES += \ + qml/qml.qrc diff --git a/plugin/plugin.qbs b/plugin/plugin.qbs new file mode 100644 index 0000000..98f980c --- /dev/null +++ b/plugin/plugin.qbs @@ -0,0 +1,52 @@ +import qbs + +QtGuiApplication { + Depends { name: "Android.ndk"; required: false } + + Depends { name: "Qt.core"; versionAtLeast: project.minimumQtVersion } + Depends { name: "Qt"; submodules: ["qml"] } + Depends { name: "Qt.webkit"; required: false } + Depends { name: "openssl"; profiles: [] } + + condition: Qt.webkit.present + cpp.cxxLanguageVersion: "c++11" + cpp.rpaths: qbs.targetOS.contains("darwin") ? ["@loader_path/../Frameworks"] : undefined + consoleApplication: true + targetName: "qt-tv-npapi-host" + + Properties { + condition: qbs.targetOS.contains("android") + architectures: ["x86", "armv7"] + Android.ndk.appStl: "gnustl_shared" + } + + architectures: undefined + + files: [ + "Info.plist", + ] + + Group { + name: "C++" + prefix: "cpp/" + files: [ + "main.cpp", + ] + } + + QMLGroup { + name: "QML" + prefix: "qml/" + files: [ + "main.qml", + ] + } + + Group { + fileTagsFilter: product.type + qbs.install: true + qbs.installDir: qbs.targetOS.contains("darwin") + ? "Applications/Qt TV.app/Contents/Executables" + : "bin" + } +} diff --git a/plugin/qml/main.qml b/plugin/qml/main.qml new file mode 100644 index 0000000..3f50bf5 --- /dev/null +++ b/plugin/qml/main.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtWebKit 3.0 + +Window { + id: appWindow + + visible: true + visibility: Window.FullScreen + flags: Qt.FramelessWindowHint + color: "#000000" + title: Qt.application.name + + readonly property real dp: Screen.pixelDensity * 25.4 / 160 + + WebView { + id: webView + + anchors.fill: parent + + url: "http://www.flashls.org/latest/examples/chromeless/" + } +} diff --git a/plugin/qml/qml.qrc b/plugin/qml/qml.qrc new file mode 100644 index 0000000..59d301c --- /dev/null +++ b/plugin/qml/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/qml"> + <file>main.qml</file> + </qresource> +</RCC> |