summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorOleg Yadrov <oleg.yadrov@qt.io>2016-11-28 12:43:24 -0800
committerOleg Yadrov <oleg.yadrov@qt.io>2017-01-04 00:11:04 +0000
commit0b1a2b195a1499057408075242103615466b3ecf (patch)
tree9e0e555fd71908be79a827352196ad766599675d /ui
parent0831aa531e559a2d6dba5cbd510289212949fa56 (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 'ui')
-rw-r--r--ui/Info-ios.plist38
-rw-r--r--ui/Info.plist33
-rw-r--r--ui/android/AndroidManifest.xml77
-rw-r--r--ui/android/build.gradle57
-rw-r--r--ui/android/res/values/libs.xml25
-rw-r--r--ui/cpp/cuterectangle.cpp119
-rw-r--r--ui/cpp/cuterectangle.h64
-rw-r--r--ui/cpp/main.cpp92
-rw-r--r--ui/cpp/processcontroller.cpp104
-rw-r--r--ui/cpp/processcontroller.h64
-rw-r--r--ui/cpp/webutils.cpp40
-rw-r--r--ui/cpp/webutils.h56
-rw-r--r--ui/qml/components/Colors.qml54
-rw-r--r--ui/qml/components/Fonts.qml33
-rw-r--r--ui/qml/components/JSONListModel.qml91
-rw-r--r--ui/qml/components/JSONQuery.qml51
-rw-r--r--ui/qml/components/Settings.qml93
-rw-r--r--ui/qml/controls/+webengine/WebView.qml35
-rw-r--r--ui/qml/controls/+webview/WebView.qml31
-rw-r--r--ui/qml/controls/AbstractButton.qml60
-rw-r--r--ui/qml/controls/ApplicationButton.qml111
-rw-r--r--ui/qml/controls/ApplicationWindow.qml83
-rw-r--r--ui/qml/controls/BaseScreen.qml32
-rw-r--r--ui/qml/controls/BusyIndicator.qml48
-rw-r--r--ui/qml/controls/HorizontalSpacer.qml33
-rw-r--r--ui/qml/controls/InvalidSettingsOverlay.qml105
-rw-r--r--ui/qml/controls/Label.qml35
-rw-r--r--ui/qml/controls/NavigationStack.qml101
-rw-r--r--ui/qml/controls/OverlayItem.qml59
-rw-r--r--ui/qml/controls/PageIndicator.qml61
-rw-r--r--ui/qml/controls/RoundButton.qml59
-rw-r--r--ui/qml/controls/SeekSlider.qml122
-rw-r--r--ui/qml/controls/TextButton.qml64
-rw-r--r--ui/qml/controls/TextInputField.qml181
-rw-r--r--ui/qml/controls/ToolBar.qml36
-rw-r--r--ui/qml/controls/UrlInputField.qml249
-rw-r--r--ui/qml/controls/VerticalDissolveEffect.qml54
-rw-r--r--ui/qml/controls/VerticalSpacer.qml33
-rw-r--r--ui/qml/controls/VideoPlayer.qml474
-rw-r--r--ui/qml/controls/VideoPlayerButton.qml49
-rw-r--r--ui/qml/controls/WebView.qml43
-rw-r--r--ui/qml/main.qml161
-rw-r--r--ui/qml/qml.qrc52
-rw-r--r--ui/qml/screens/MainScreen.qml149
-rw-r--r--ui/qml/screens/MovieDetailsScreen.qml373
-rw-r--r--ui/qml/screens/MoviesControls/AnimatedText.qml46
-rw-r--r--ui/qml/screens/MoviesControls/BackgroundPoster.qml60
-rw-r--r--ui/qml/screens/MoviesControls/ImageButton.qml113
-rw-r--r--ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml142
-rw-r--r--ui/qml/screens/MoviesControls/MovieCatalogButton.qml140
-rw-r--r--ui/qml/screens/MoviesControls/MovieCatalogView.qml112
-rw-r--r--ui/qml/screens/MoviesControls/MovieImagesView.qml87
-rw-r--r--ui/qml/screens/MoviesControls/MoviePoster.qml82
-rw-r--r--ui/qml/screens/MoviesControls/WebViewOverlay.qml66
-rw-r--r--ui/qml/screens/MoviesScreen.qml379
-rw-r--r--ui/qml/screens/SettingsScreen.qml150
-rw-r--r--ui/qml/screens/TrailerScreen.qml91
-rw-r--r--ui/qml/screens/WebBrowserScreen.qml117
-rw-r--r--ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt26
-rw-r--r--ui/qml/scripts/3rdparty/YoutubeClientV3.js276
-rw-r--r--ui/qml/scripts/3rdparty/qt_attribution.json10
-rw-r--r--ui/qml/scripts/XMLHttpRequestCache.js28
-rw-r--r--ui/qml/scripts/datamodels.js43
-rw-r--r--ui/ui.pro54
-rw-r--r--ui/ui.qbs172
65 files changed, 6178 insertions, 0 deletions
diff --git a/ui/Info-ios.plist b/ui/Info-ios.plist
new file mode 100644
index 0000000..a09fd27
--- /dev/null
+++ b/ui/Info-ios.plist
@@ -0,0 +1,38 @@
+<?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>CFBundleDisplayName</key>
+ <string>Qt TV</string>
+ <key>CFBundleExecutable</key>
+ <string>Qt TV</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.example.Qt-TV</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Qt TV</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>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
diff --git a/ui/Info.plist b/ui/Info.plist
new file mode 100644
index 0000000..312651f
--- /dev/null
+++ b/ui/Info.plist
@@ -0,0 +1,33 @@
+<?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>CFBundleDisplayName</key>
+ <string>Qt TV</string>
+ <key>CFBundleExecutable</key>
+ <string>Qt TV</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.example.Qt-TV</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Qt TV</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/ui/android/AndroidManifest.xml b/ui/android/AndroidManifest.xml
new file mode 100644
index 0000000..267dbcf
--- /dev/null
+++ b/ui/android/AndroidManifest.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<manifest package="org.qtproject.qttv" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
+ <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Qt TV">
+ <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Qt TV" android:screenOrientation="landscape" android:launchMode="singleTop">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+
+ <!-- Application arguments -->
+ <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
+ <!-- Application arguments -->
+
+ <meta-data android:name="android.app.lib_name" android:value="qt-tv"/>
+ <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+ <meta-data android:name="android.app.repository" android:value="default"/>
+ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
+ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
+ <!-- Deploy Qt libs as part of package -->
+ <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
+ <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+ <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+ <!-- Run with local libs -->
+ <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
+ <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+ <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
+ <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
+ <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
+ <!-- Messages maps -->
+ <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+ <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
+ <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+ <!-- Messages maps -->
+
+ <!-- Splash screen -->
+ <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
+ <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
+ <!-- Splash screen -->
+
+ <!-- Background running -->
+ <!-- Warning: changing this value to true may cause unexpected crashes if the
+ application still try to draw after
+ "applicationStateChanged(Qt::ApplicationSuspended)"
+ signal is sent! -->
+ <meta-data android:name="android.app.background_running" android:value="false"/>
+ <!-- Background running -->
+
+ <!-- auto screen scale factor -->
+ <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
+ <!-- auto screen scale factor -->
+
+ <!-- extract android style -->
+ <!-- available android:values :
+ * full - useful QWidget & Quick Controls 1 apps
+ * minimal - useful for Quick Controls 2 apps, it is much faster than "full"
+ * none - useful for apps that don't use any of the above Qt modules
+ -->
+ <meta-data android:name="android.app.extract_android_style" android:value="full"/>
+ <!-- extract android style -->
+ </activity>
+
+ <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
+
+ </application>
+
+ <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19"/>
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+ <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+ Remove the comment if you do not require these default permissions. -->
+ <!-- %%INSERT_PERMISSIONS -->
+
+ <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+ Remove the comment if you do not require these default features. -->
+ <!-- %%INSERT_FEATURES -->
+
+</manifest>
diff --git a/ui/android/build.gradle b/ui/android/build.gradle
new file mode 100644
index 0000000..ef416b0
--- /dev/null
+++ b/ui/android/build.gradle
@@ -0,0 +1,57 @@
+buildscript {
+ repositories {
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.1.0'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+apply plugin: 'com.android.application'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+}
+
+android {
+ /*******************************************************
+ * The following variables:
+ * - androidBuildToolsVersion,
+ * - androidCompileSdkVersion
+ * - qt5AndroidDir - holds the path to qt android files
+ * needed to build any Qt application
+ * on Android.
+ *
+ * are defined in gradle.properties file. This file is
+ * updated by QtCreator and androiddeployqt tools.
+ * Changing them manually might break the compilation!
+ *******************************************************/
+
+ compileSdkVersion androidCompileSdkVersion.toInteger()
+
+ buildToolsVersion androidBuildToolsVersion
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
+ aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
+ res.srcDirs = [qt5AndroidDir + '/res', 'res']
+ resources.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ assets.srcDirs = ['assets']
+ jniLibs.srcDirs = ['libs']
+ }
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+}
diff --git a/ui/android/res/values/libs.xml b/ui/android/res/values/libs.xml
new file mode 100644
index 0000000..43296f2
--- /dev/null
+++ b/ui/android/res/values/libs.xml
@@ -0,0 +1,25 @@
+<?xml version='1.0' encoding='utf-8'?>
+<resources>
+ <array name="qt_sources">
+ <item>https://download.qt.io/ministro/android/qt5/qt-5.7</item>
+ </array>
+
+ <!-- The following is handled automatically by the deployment tool. It should
+ not be edited manually. -->
+
+ <array name="bundled_libs">
+ <!-- %%INSERT_EXTRA_LIBS%% -->
+ </array>
+
+ <array name="qt_libs">
+ <!-- %%INSERT_QT_LIBS%% -->
+ </array>
+
+ <array name="bundled_in_lib">
+ <!-- %%INSERT_BUNDLED_IN_LIB%% -->
+ </array>
+ <array name="bundled_in_assets">
+ <!-- %%INSERT_BUNDLED_IN_ASSETS%% -->
+ </array>
+
+</resources>
diff --git a/ui/cpp/cuterectangle.cpp b/ui/cpp/cuterectangle.cpp
new file mode 100644
index 0000000..5204a10
--- /dev/null
+++ b/ui/cpp/cuterectangle.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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 "cuterectangle.h"
+
+CuteRectangle::CuteRectangle(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+ mColor("#000000"),
+ mBorderColor("#000000"),
+ mBorderWidth(0)
+{
+ connect(this, SIGNAL(colorChanged(QColor)), this, SLOT(update()));
+ connect(this, SIGNAL(borderColorChanged(QColor)), this, SLOT(update()));
+ connect(this, SIGNAL(borderWidthChanged(int)), this, SLOT(update()));
+}
+
+void CuteRectangle::paint(QPainter *painter)
+{
+ QPen pen(mBorderColor);
+ pen.setWidth(0);
+ if (mBorderWidth == 0) {
+ pen.setColor(mColor);
+ }
+ painter->setPen(pen);
+
+ QBrush brush(mColor);
+ painter->setBrush(brush);
+
+ painter->setRenderHint(QPainter::Antialiasing);
+
+ float centerX = width() / 2.0f;
+ float centerY = height() / 2.0f;
+
+ const float padding = 1.0f; // from each side, to prevent clipping
+ float paintedWidth;
+ float paintedHeight;
+ float cornerRadius;
+
+ if (width() > height()) {
+ paintedHeight = height() - padding * 2.0f;
+ paintedWidth = paintedHeight * 1.35f;
+ } else {
+ paintedWidth = width() - padding * 2.0f;
+ paintedHeight = paintedWidth * 0.74f;
+ }
+
+ cornerRadius = paintedWidth * 0.143f;
+
+ QPainterPath path;
+ // start from the top right corner
+ path.moveTo(centerX + paintedWidth / 2.0f, centerY - paintedHeight / 2.0f);
+ // moving clockwise
+ path.lineTo(centerX + paintedWidth / 2.0f, centerY + paintedHeight / 2.0f - cornerRadius);
+ path.lineTo(centerX + paintedWidth / 2.0f - cornerRadius, centerY + paintedHeight / 2.0f);
+ path.lineTo(centerX - paintedWidth / 2.0f, centerY + paintedHeight / 2.0f);
+ path.lineTo(centerX - paintedWidth / 2.0f, centerY - paintedHeight / 2.0f + cornerRadius);
+ path.lineTo(centerX - paintedWidth / 2.0f + cornerRadius, centerY - paintedHeight / 2.0f);
+ path.lineTo(centerX + paintedWidth / 2.0f, centerY - paintedHeight / 2.0f);
+
+ painter->drawPath(path);
+}
+
+QColor CuteRectangle::color() const
+{
+ return mColor;
+}
+
+void CuteRectangle::setColor(const QColor &color)
+{
+ if (color == mColor) return;
+ mColor = color;
+ emit colorChanged(color);
+}
+
+QColor CuteRectangle::borderColor() const
+{
+ return mBorderColor;
+}
+
+void CuteRectangle::setBorderColor(const QColor &color)
+{
+ if (color == mBorderColor) return;
+ mBorderColor = color;
+ emit borderColorChanged(color);
+}
+
+int CuteRectangle::borderWidth() const
+{
+ return mBorderWidth;
+}
+
+void CuteRectangle::setBorderWidth(int width)
+{
+ if (width == mBorderWidth) return;
+ mBorderWidth = width;
+ emit borderWidthChanged(width);
+}
diff --git a/ui/cpp/cuterectangle.h b/ui/cpp/cuterectangle.h
new file mode 100644
index 0000000..6a9293b
--- /dev/null
+++ b/ui/cpp/cuterectangle.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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.
+**
+****************************************************************************/
+
+#ifndef CUTERECTANGLE_H
+#define CUTERECTANGLE_H
+
+#include <QQuickPaintedItem>
+#include <QPainter>
+#include <QPainterPath>
+
+class CuteRectangle : public QQuickPaintedItem
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
+ Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
+
+public:
+ CuteRectangle(QQuickItem *parent = 0);
+
+ void paint(QPainter *painter);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+ QColor borderColor() const;
+ void setBorderColor(const QColor &color);
+ int borderWidth() const;
+ void setBorderWidth(int width);
+
+private:
+ QColor mColor;
+ QColor mBorderColor;
+ int mBorderWidth;
+
+signals:
+ void colorChanged(QColor color);
+ void borderColorChanged(QColor color);
+ void borderWidthChanged(int width);
+};
+
+#endif // CUTERECTANGLE_H
diff --git a/ui/cpp/main.cpp b/ui/cpp/main.cpp
new file mode 100644
index 0000000..453ed30
--- /dev/null
+++ b/ui/cpp/main.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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 <QQmlContext>
+#include <QQmlFileSelector>
+#include <QFontDatabase>
+#include "cuterectangle.h"
+#include "processcontroller.h"
+#include "webutils.h"
+
+#ifdef QT_WEBENGINE_LIB
+#include <QtWebEngine>
+#endif
+
+#ifdef QT_WEBVIEW_LIB
+#include <QtWebView>
+#endif
+
+void loadFonts() {
+ QStringList fonts {
+ ":/fonts/TitilliumWeb-Bold.ttf",
+ ":/fonts/TitilliumWeb-Italic.ttf",
+ ":/fonts/TitilliumWeb-Regular.ttf",
+ ":/fonts/fontawesome-webfont.ttf"
+ };
+
+ foreach (const QString &font, fonts) {
+ QFontDatabase::addApplicationFont(font);
+ }
+}
+
+int main(int argc, char *argv[]) {
+ QGuiApplication app(argc, argv);
+
+ QStringList extraSelectors;
+
+ // Order of the selectors is important on macOS, which supports both QtWebEngine and QtWebView.
+ // Currently, macOS does not support QtWebView well, regardless of whether the QtWebEngine or
+ // native backend is chosen. The webengine selector comes first and so is prioritized over
+ // webview.
+
+#ifdef QT_WEBENGINE_LIB
+ QtWebEngine::initialize();
+ extraSelectors.append(QStringLiteral("webengine"));
+#endif
+
+#ifdef QT_WEBVIEW_LIB
+ QtWebView::initialize();
+ extraSelectors.append(QStringLiteral("webview"));
+#endif
+
+ loadFonts();
+
+ qmlRegisterType<CuteRectangle>("Shapes", 1, 0, "CuteRectangle");
+
+ QQmlApplicationEngine engine;
+
+ QQmlFileSelector::get(&engine)->setExtraSelectors(extraSelectors);
+
+ ProcessController processController(&app);
+ engine.rootContext()->setContextProperty("processController", &processController);
+ WebUtils webUtils(&app);
+ engine.rootContext()->setContextProperty("webUtils", &webUtils);
+
+ engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
+
+ return app.exec();
+}
diff --git a/ui/cpp/processcontroller.cpp b/ui/cpp/processcontroller.cpp
new file mode 100644
index 0000000..e2f0634
--- /dev/null
+++ b/ui/cpp/processcontroller.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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 "processcontroller.h"
+#include <QProcess>
+
+class ProcessControllerPrivate {
+public:
+#ifndef QT_NO_PROCESS
+ QProcess process;
+#endif
+};
+
+ProcessController::ProcessController(QObject *parent)
+ : QObject(parent)
+ , d(new ProcessControllerPrivate)
+{
+}
+
+ProcessController::~ProcessController()
+{
+}
+
+QString ProcessController::program() const
+{
+#ifndef QT_NO_PROCESS
+ return d->process.program();
+#else
+ return QString();
+#endif
+}
+
+void ProcessController::setProgram(const QString &program)
+{
+#ifndef QT_NO_PROCESS
+ if (d->process.program() != program) {
+ if (d->process.state() == QProcess::NotRunning) {
+ d->process.setProgram(program);
+ emit programChanged();
+ }
+ }
+#else
+ Q_UNUSED(program);
+#endif
+}
+
+bool ProcessController::isRunning() const
+{
+#ifndef QT_NO_PROCESS
+ return d->process.state() == QProcess::NotRunning;
+#else
+ return false;
+#endif
+}
+
+void ProcessController::setRunning(bool running)
+{
+#ifndef QT_NO_PROCESS
+ if (running) {
+ if (d->process.state() == QProcess::NotRunning) {
+ d->process.start();
+ emit runningChanged();
+ }
+ } else {
+ if (d->process.state() != QProcess::NotRunning) {
+ d->process.close();
+ emit runningChanged();
+ }
+ }
+#else
+ Q_UNUSED(running);
+#endif
+}
+
+bool ProcessController::isAvailable() const
+{
+#ifndef QT_NO_PROCESS
+ return QFileInfo(d->process.program()).exists();
+#else
+ return false;
+#endif
+}
diff --git a/ui/cpp/processcontroller.h b/ui/cpp/processcontroller.h
new file mode 100644
index 0000000..59934ac
--- /dev/null
+++ b/ui/cpp/processcontroller.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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.
+**
+****************************************************************************/
+
+#ifndef PROCESSCONTROLLER_H
+#define PROCESSCONTROLLER_H
+
+#include <QObject>
+#include <QCoreApplication>
+#include <QFileInfo>
+#include <QDebug>
+
+class ProcessControllerPrivate;
+
+class ProcessController : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString program READ program WRITE setProgram NOTIFY programChanged)
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
+ Q_PROPERTY(bool available READ isAvailable NOTIFY programChanged)
+
+public:
+ explicit ProcessController(QObject *parent = 0);
+ virtual ~ProcessController();
+
+ QString program() const;
+ void setProgram(const QString &program);
+
+ bool isRunning() const;
+ void setRunning(bool running);
+
+ bool isAvailable() const;
+
+private:
+ QScopedPointer<ProcessControllerPrivate> d;
+
+signals:
+ void programChanged();
+ void runningChanged();
+};
+
+#endif // PROCESSCONTROLLER_H
diff --git a/ui/cpp/webutils.cpp b/ui/cpp/webutils.cpp
new file mode 100644
index 0000000..673af56
--- /dev/null
+++ b/ui/cpp/webutils.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** 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 "webutils.h"
+
+WebUtils::WebUtils(QObject *parent) :
+ QObject(parent)
+{
+}
+
+bool WebUtils::isAvailable() const
+{
+#if defined(QT_WEBENGINE_LIB) || defined(QT_WEBVIEW_LIB)
+ return true;
+#else
+ return false;
+#endif
+}
diff --git a/ui/cpp/webutils.h b/ui/cpp/webutils.h
new file mode 100644
index 0000000..bcbadb3
--- /dev/null
+++ b/ui/cpp/webutils.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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.
+**
+****************************************************************************/
+
+#ifndef WEBUTILS_H
+#define WEBUTILS_H
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QUrl>
+
+class WebUtils : public QObject {
+ Q_OBJECT
+
+ Q_PROPERTY(bool available READ isAvailable CONSTANT)
+
+public:
+ WebUtils(QObject *parent = 0);
+
+ bool isAvailable() const;
+
+ Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
+};
+
+inline QUrl WebUtils::fromUserInput(const QString& userInput)
+{
+ QFileInfo fileInfo(userInput);
+
+ if (fileInfo.exists()) {
+ return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
+ }
+
+ return QUrl::fromUserInput(userInput);
+}
+
+#endif // WEBUTILS_H
diff --git a/ui/qml/components/Colors.qml b/ui/qml/components/Colors.qml
new file mode 100644
index 0000000..2b6397b
--- /dev/null
+++ b/ui/qml/components/Colors.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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
+
+QtObject {
+ id: colors
+
+ readonly property color background1: "#3b7c74"
+ readonly property color background2: "#104a58"
+ readonly property color background3: "#04304d"
+ readonly property color background4: "#041f3a"
+ readonly property color background5: "#021124"
+
+ readonly property color gray1: Qt.rgba(0.0, 0.0, 0.0, 0.4)
+ readonly property color gray2: Qt.rgba(0.0, 0.0, 0.0, 0.8)
+ readonly property color gray3: "#999999"
+ readonly property color gray4: "#555555"
+
+ readonly property color green1: "#41cd52"
+ readonly property color green2: "#dcfcbd"
+
+ readonly property color yellow1: "#ffef26"
+
+ readonly property color white1: "#ffffff"
+ readonly property color white2: Qt.rgba(1.0, 1.0, 1.0, 0.8)
+ readonly property color white3: Qt.rgba(1.0, 1.0, 1.0, 0.5)
+ readonly property color white4: Qt.rgba(1.0, 1.0, 1.0, 0.06)
+
+ readonly property color black: "#000000"
+ readonly property color transparent: Qt.rgba(0.0, 0.0, 0.0, 0.0)
+}
diff --git a/ui/qml/components/Fonts.qml b/ui/qml/components/Fonts.qml
new file mode 100644
index 0000000..d4db9a5
--- /dev/null
+++ b/ui/qml/components/Fonts.qml
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** 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
+
+QtObject {
+ id: fonts
+
+ readonly property string titillium: "Titillium Web"
+ readonly property string fontAwesome: "FontAwesome"
+}
diff --git a/ui/qml/components/JSONListModel.qml b/ui/qml/components/JSONListModel.qml
new file mode 100644
index 0000000..154c4ca
--- /dev/null
+++ b/ui/qml/components/JSONListModel.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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 "../scripts/XMLHttpRequestCache.js" as XMLHttpRequestCache
+
+ListModel {
+ id: jsonListModel
+
+ property string source: ""
+ property bool working: false
+ property string arrayPropertyName: ""
+ property bool cached: true
+ property int cacheUpdateInterval: 1000 * 60 * 10 // 10 minutes
+
+ onSourceChanged: {
+ function processResponse(responseText) {
+ var items = JSON.parse(responseText)[arrayPropertyName]
+
+ if (items) {
+ var i = 0
+ var count = items.length
+ for (; i < count; i++) {
+ var item = items[i]
+ if (typeof item === "object") {
+ jsonListModel.append(item)
+ }
+ }
+ }
+
+ working = false
+ }
+
+ working = true
+
+ jsonListModel.clear()
+
+ var usingCacheData = false
+
+ if (cached) {
+ var cacheData = XMLHttpRequestCache.cache[source]
+
+ if (cacheData) {
+ if (new Date().getTime() - cacheData.timestamp < cacheUpdateInterval) {
+ usingCacheData = true
+ processResponse(cacheData.response)
+ }
+ }
+ }
+
+ if (!usingCacheData) {
+ var xhr = new XMLHttpRequest
+ xhr.open("GET", source)
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ XMLHttpRequestCache.cache[source] = {
+ timestamp: new Date().getTime(),
+ response: xhr.responseText
+ }
+
+ processResponse(xhr.responseText)
+ }
+ }
+
+ xhr.send()
+ }
+ }
+}
diff --git a/ui/qml/components/JSONQuery.qml b/ui/qml/components/JSONQuery.qml
new file mode 100644
index 0000000..ac54af5
--- /dev/null
+++ b/ui/qml/components/JSONQuery.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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.0
+
+QtObject {
+ id: jsonQuery
+
+ property var source
+ property var result
+
+ onSourceChanged: {
+ var xhr = new XMLHttpRequest
+ xhr.open("GET", source)
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status === 200) {
+ result = JSON.parse(xhr.responseText)
+ } else {
+ result = "Network error, status code: %1".arg(xhr.status)
+ }
+
+ }
+ }
+
+ xhr.send()
+ }
+}
diff --git a/ui/qml/components/Settings.qml b/ui/qml/components/Settings.qml
new file mode 100644
index 0000000..32ba5bd
--- /dev/null
+++ b/ui/qml/components/Settings.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** 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 "../scripts/datamodels.js" as DataModels
+import "../scripts/3rdparty/YoutubeClientV3.js" as YoutubeClient
+
+QtObject {
+ id: settings
+
+ property string youTubeKey: ""
+ property string tmdbKey: ""
+
+ readonly property int minimumVolume: 0
+ readonly property int maximumVolume: 5
+ property int volume: 5
+
+ readonly property var requiredKeys: ["YouTube", "TMDb"]
+ property var missingKeys: []
+
+ signal initialized()
+
+ onYouTubeKeyChanged: {
+ YoutubeClient.youTubeDataKey = youTubeKey
+ }
+
+ onTmdbKeyChanged: {
+ DataModels.apiKey = tmdbKey
+ }
+
+ Component.onCompleted: {
+ if (requiredKeys.length > 0) {
+ keyLoader.loadKey(0)
+ } else {
+ initialized()
+ }
+ }
+
+ property Loader keyLoader: Loader {
+ property int currentKeyIndex
+
+ function loadKey(index) {
+ currentKeyIndex = index
+ source = Qt.resolvedUrl("qrc:/secrets/%1.qml".arg(requiredKeys[index]))
+ }
+
+ onStatusChanged: {
+ if (status === Loader.Ready) {
+ switch (currentKeyIndex) {
+ case 0:
+ settings.youTubeKey = item.key
+ break
+ case 1:
+ settings.tmdbKey = item.key
+ break
+ }
+ } else if (status === Loader.Error) {
+ settings.missingKeys.push(settings.requiredKeys[currentKeyIndex])
+ }
+
+ if (status === Loader.Ready ||
+ status === Loader.Error) {
+ if (currentKeyIndex < settings.requiredKeys.length - 1) {
+ loadKey(currentKeyIndex + 1)
+ } else {
+ settings.initialized()
+ }
+ }
+ }
+ }
+}
diff --git a/ui/qml/controls/+webengine/WebView.qml b/ui/qml/controls/+webengine/WebView.qml
new file mode 100644
index 0000000..5c85300
--- /dev/null
+++ b/ui/qml/controls/+webengine/WebView.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtWebEngine 1.3 as WebEngine
+
+// Some websites (https://youtube.com/leanback, for example) can grab focus forever
+// https://bugreports.qt.io/browse/QTBUG-46251
+WebEngine.WebEngineView {
+ focus: true
+ settings.focusOnNavigationEnabled: false
+ settings.pluginsEnabled: true
+}
diff --git a/ui/qml/controls/+webview/WebView.qml b/ui/qml/controls/+webview/WebView.qml
new file mode 100644
index 0000000..87e25f7
--- /dev/null
+++ b/ui/qml/controls/+webview/WebView.qml
@@ -0,0 +1,31 @@
+/****************************************************************************
+**
+** 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 QtWebView 1.1 as WebView
+
+WebView.WebView {
+ focus: true
+}
diff --git a/ui/qml/controls/AbstractButton.qml b/ui/qml/controls/AbstractButton.qml
new file mode 100644
index 0000000..e241456
--- /dev/null
+++ b/ui/qml/controls/AbstractButton.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: abstractButton
+
+ property alias pressed: mouseArea.pressed
+ signal clicked()
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ item: abstractButton
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ anchors.fill: parent
+
+ onPressed: {
+ abstractButton.forceActiveFocus()
+ }
+
+ onClicked: {
+ abstractButton.clicked()
+ }
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select)
+ {
+ abstractButton.clicked()
+ }
+ }
+}
diff --git a/ui/qml/controls/ApplicationButton.qml b/ui/qml/controls/ApplicationButton.qml
new file mode 100644
index 0000000..a9d22d0
--- /dev/null
+++ b/ui/qml/controls/ApplicationButton.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** 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 Shapes 1.0
+
+AbstractButton {
+ id: applicationButton
+
+ opacity: enabled ? 1 : 0.25
+
+ width: 446 * dp
+ height: 330 * dp
+
+ property alias text: label.text
+ property alias icon: icon.text
+
+ states: [
+ State {
+ name: ""
+
+ PropertyChanges {
+ target: applicationButton
+ scale: 1
+ }
+ },
+ State {
+ name: "selected"
+ when: applicationButton.activeFocus
+
+ PropertyChanges {
+ target: applicationButton
+ scale: 1.07
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: ""
+ to: "selected"
+
+ PropertyAnimation {
+ property: "scale"
+ duration: 160
+ easing.type: Easing.InOutQuad
+ }
+ }
+ ]
+
+ CuteRectangle {
+ anchors.fill: parent
+
+ color: applicationButton.activeFocus ? colors.green1
+ : colors.gray1
+ }
+
+ Label {
+ id: icon
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: -30 * dp
+
+ horizontalAlignment: Text.AlignHCenter
+
+ font.family: fonts.fontAwesome
+ font.pixelSize: 140 * dp
+ color: applicationButton.activeFocus ? colors.white1
+ : colors.white2
+ }
+
+ Label {
+ id: label
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20 * dp
+
+ horizontalAlignment: Text.AlignHCenter
+
+ font.family: fonts.titillium
+ font.pixelSize: 42 * dp
+ color: applicationButton.activeFocus ? colors.white1
+ : colors.white2
+ }
+}
diff --git a/ui/qml/controls/ApplicationWindow.qml b/ui/qml/controls/ApplicationWindow.qml
new file mode 100644
index 0000000..857707b
--- /dev/null
+++ b/ui/qml/controls/ApplicationWindow.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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 "../components"
+
+Window {
+ id: applicationWindow
+
+ visible: true
+ visibility: Window.FullScreen
+ flags: Qt.Window | Qt.WindowFullscreenButtonHint
+ color: colors.white1
+ title: Qt.application.name
+
+ readonly property Colors colors: Colors {}
+ readonly property Fonts fonts: Fonts {}
+
+ readonly property real dp: physicalSizeMultiplier > 0 ? Screen.pixelDensity * 25.4 / 160 * physicalSizeMultiplier
+ : Screen.pixelDensity * 25.4 / 160
+ readonly property real originalDeviceDiagonal: 15 // 15 inch macbook pro
+ property real physicalSizeMultiplier: (((Math.sqrt(Math.pow(Screen.width, 2) + Math.pow(Screen.height, 2)) / Screen.pixelDensity) / 25.4) / originalDeviceDiagonal)
+
+// Component.onCompleted: {
+// var diagonalInPixels = Math.sqrt(Math.pow(Screen.width, 2) + Math.pow(Screen.height, 2))
+// var diagonalInMillimeters = diagonalInPixels / Screen.pixelDensity
+// var diagonalInInches = diagonalInMillimeters / 25.4
+
+// physicalSizeMultiplier = diagonalInInches / testDeviceDiagonal
+// }
+
+ property Item focusedItem: null
+ signal backPressed()
+
+ onActiveFocusItemChanged: {
+ if (focusedItem !== null && focusedItem.Keys !== undefined)
+ focusedItem.Keys.onPressed.disconnect(onKeyPressed)
+
+ if (activeFocusItem !== null)
+ {
+ activeFocusItem.Keys.onPressed.connect(onKeyPressed)
+ focusedItem = activeFocusItem
+ }
+ }
+
+ function onKeyPressed(event) {
+ if (event.key === Qt.Key_Back ||
+ event.key === Qt.Key_Escape ||
+ event.key === Qt.Key_Menu)
+ {
+ if (Qt.inputMethod.visible) {
+ Qt.inputMethod.hide()
+ } else {
+ backPressed()
+ }
+
+ event.accepted = true
+ }
+ }
+}
diff --git a/ui/qml/controls/BaseScreen.qml b/ui/qml/controls/BaseScreen.qml
new file mode 100644
index 0000000..2439681
--- /dev/null
+++ b/ui/qml/controls/BaseScreen.qml
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** 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
+
+FocusScope {
+ id: baseScreen
+
+ enabled: !stackView.busy
+}
diff --git a/ui/qml/controls/BusyIndicator.qml b/ui/qml/controls/BusyIndicator.qml
new file mode 100644
index 0000000..32f8084
--- /dev/null
+++ b/ui/qml/controls/BusyIndicator.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
+
+Label {
+ id: busyIndicator
+
+ property alias running: animation.running
+
+ color: colors.white2
+ font.family: fonts.fontAwesome
+ font.pixelSize: 160 * dp
+
+ text: "\uf021"
+
+ RotationAnimation on rotation {
+ id: animation
+
+ from: 0
+ to: 360
+ duration: 1400
+ loops: RotationAnimation.Infinite
+ running: busyIndicator.visible
+ }
+}
diff --git a/ui/qml/controls/HorizontalSpacer.qml b/ui/qml/controls/HorizontalSpacer.qml
new file mode 100644
index 0000000..9813172
--- /dev/null
+++ b/ui/qml/controls/HorizontalSpacer.qml
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: horizontalSpacer
+
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+}
diff --git a/ui/qml/controls/InvalidSettingsOverlay.qml b/ui/qml/controls/InvalidSettingsOverlay.qml
new file mode 100644
index 0000000..94d5cf1
--- /dev/null
+++ b/ui/qml/controls/InvalidSettingsOverlay.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** 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
+
+OverlayItem {
+ id: invalidSettingsOverlay
+
+ closeOnOuterClick: false
+ closeOnBackButtonPress: false
+
+ signal accepted()
+
+ Rectangle {
+ anchors.fill: parent
+
+ color: colors.gray2
+ }
+
+ Rectangle {
+ anchors.centerIn: parent
+
+ width: 1200 * dp
+ height: 360 * dp
+
+ radius: 8 * dp
+ color: colors.black
+ border.width: 4 * dp
+ border.color: colors.white2
+
+ Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 40 * dp
+ anchors.topMargin: 20 * dp
+
+ Label {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ wrapMode: Text.Wrap
+
+ color: colors.green1
+ font.family: fonts.titillium
+ font.pixelSize: 50 * dp
+
+ text: qsTr("Missing YouTube and/or TMDb API keys")
+ }
+
+ Label {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ wrapMode: Text.Wrap
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ text: qsTr("Please enter valid API keys for these services in Settings to access film trailers and information in Movies.")
+ }
+ }
+
+ TextButton {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.rightMargin: 40 * dp
+ anchors.bottomMargin: 40 * dp
+
+ width: 260 * dp
+
+ focus: true
+
+ text: qsTr("Go to Settings")
+
+ onClicked: {
+ invalidSettingsOverlay.accepted()
+ }
+ }
+ }
+}
diff --git a/ui/qml/controls/Label.qml b/ui/qml/controls/Label.qml
new file mode 100644
index 0000000..c5fe695
--- /dev/null
+++ b/ui/qml/controls/Label.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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
+
+Text {
+ id: label
+
+ font.family: "Titillium Web"
+ renderType: Text.QtRendering
+ elide: Text.ElideRight
+ color: colors.black
+}
diff --git a/ui/qml/controls/NavigationStack.qml b/ui/qml/controls/NavigationStack.qml
new file mode 100644
index 0000000..954a1c5
--- /dev/null
+++ b/ui/qml/controls/NavigationStack.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+
+StackView {
+ id: navigationStack
+
+ readonly property int transitionDuration: 300
+
+ onCurrentItemChanged: {
+ if (currentItem && overlay.visibleChildren.length === 0) {
+ currentItem.forceActiveFocus()
+ }
+ }
+
+ delegate: StackViewDelegate {
+ pushTransition: StackViewTransition {
+ ParallelAnimation {
+ PropertyAnimation {
+ target: enterItem
+ property: "scale"
+ from: 1.4
+ to: 1
+ duration: navigationStack.transitionDuration
+ }
+
+ PropertyAnimation {
+ target: enterItem
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: navigationStack.transitionDuration
+ }
+ }
+
+ ParallelAnimation {
+ PropertyAnimation {
+ target: exitItem
+ property: "opacity"
+ from: 1
+ to: 0
+ duration: navigationStack.transitionDuration / 2
+ }
+ }
+ }
+
+ popTransition: StackViewTransition {
+ ParallelAnimation {
+ PropertyAnimation {
+ target: exitItem
+ property: "scale"
+ from: 1
+ to: 1.4
+ duration: navigationStack.transitionDuration / 2
+ }
+
+ PropertyAnimation {
+ target: exitItem
+ property: "opacity"
+ from: 1
+ to: 0
+ duration: navigationStack.transitionDuration / 2
+ }
+ }
+
+ ParallelAnimation {
+ PropertyAnimation {
+ target: enterItem
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: navigationStack.transitionDuration
+ }
+ }
+ }
+ }
+}
diff --git a/ui/qml/controls/OverlayItem.qml b/ui/qml/controls/OverlayItem.qml
new file mode 100644
index 0000000..0867833
--- /dev/null
+++ b/ui/qml/controls/OverlayItem.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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
+
+FocusScope {
+ id: overlayItem
+
+ parent: overlay
+ anchors.fill: parent
+
+ visible: false
+
+ property bool closeOnOuterClick: true
+ property bool closeOnBackButtonPress: true
+
+ function open() {
+ z = overlay.visibleChildren.length
+ visible = true
+ forceActiveFocus()
+ }
+
+ function close() {
+ visible = false
+ stackView.currentItem.forceActiveFocus()
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ if (overlayItem.closeOnOuterClick) {
+ overlayItem.close()
+ }
+ }
+ }
+}
diff --git a/ui/qml/controls/PageIndicator.qml b/ui/qml/controls/PageIndicator.qml
new file mode 100644
index 0000000..ad04f4a
--- /dev/null
+++ b/ui/qml/controls/PageIndicator.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: pageIndicator
+
+ property alias count: repeater.model
+ property int currentIndex: 0
+
+ width: row.width
+ height: row.height
+
+ Row {
+ id: row
+
+ anchors.centerIn: parent
+
+ spacing: 10 * dp
+
+ Repeater {
+ id: repeater
+
+ delegate: Rectangle {
+ width: 16 * dp
+ height: width
+
+ radius: width / 2
+
+ scale: index === pageIndicator.currentIndex ? 1.2
+ : 1.0
+
+ color: index === pageIndicator.currentIndex ? colors.green1
+ : colors.gray4
+ }
+ }
+ }
+}
diff --git a/ui/qml/controls/RoundButton.qml b/ui/qml/controls/RoundButton.qml
new file mode 100644
index 0000000..93b62f9
--- /dev/null
+++ b/ui/qml/controls/RoundButton.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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
+
+AbstractButton {
+ id: roundButton
+
+ width: 120 * dp
+ height: width
+
+ property alias icon: label.text
+
+ Rectangle {
+ anchors.fill: parent
+
+ radius: roundButton.width / 2
+
+ color: roundButton.activeFocus ? colors.green1
+ : colors.gray1
+ }
+
+ Label {
+ id: label
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+
+ horizontalAlignment: Text.AlignHCenter
+
+ font.family: fonts.fontAwesome
+ font.pixelSize: roundButton.height * 0.5
+ color: roundButton.activeFocus ? colors.white1
+ : colors.white2
+ }
+}
diff --git a/ui/qml/controls/SeekSlider.qml b/ui/qml/controls/SeekSlider.qml
new file mode 100644
index 0000000..e37bb83
--- /dev/null
+++ b/ui/qml/controls/SeekSlider.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: seekSlider
+
+ height: 80 * dp
+
+ property real position: 0.5
+ property real sliderHeight: 20 * dp
+ property alias seeking: mouseArea.pressed
+ readonly property alias seekingPosition: mouseArea.seekingPosition
+
+ function updateHandlePosition() {
+ if (seeking) {
+ handle.x = (seekSlider.width - handle.width) * seekSlider.seekingPosition
+ } else {
+ handle.x = (seekSlider.width - handle.width) * seekSlider.position
+ }
+ }
+
+ onWidthChanged: {
+ updateHandlePosition()
+ }
+
+ onPositionChanged: {
+ updateHandlePosition()
+ }
+
+ onSeekingChanged: {
+ updateHandlePosition()
+ }
+
+ onSeekingPositionChanged: {
+ updateHandlePosition()
+ }
+
+ Rectangle {
+ id: progressRectangle
+
+ anchors.left: parent.left
+ anchors.right: handle.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: handle.radius
+
+ height: seekSlider.sliderHeight
+
+ radius: height / 2
+ color: colors.white2
+ }
+
+ Rectangle {
+ id: backgroundRectangle
+
+ anchors.left: handle.horizontalCenter
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.rightMargin: handle.radius
+
+ height: seekSlider.sliderHeight
+
+ radius: height / 2
+ color: colors.white3
+ }
+
+ Rectangle {
+ id: handle
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ width: 60 * dp
+ height: 60 * dp
+
+ radius: 30 * dp
+
+ color: colors.gray3
+ border.width: 20 * dp
+ border.color: colors.white1
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ anchors.fill: parent
+
+ property real seekingPosition: 0.0
+
+ onMouseXChanged: {
+ if (mouseX < handle.width / 2) {
+ seekingPosition = 0.0
+ } else if (mouseX > seekSlider.width - handle.width / 2) {
+ seekingPosition = 1.0
+ } else {
+ seekingPosition = (mouseX - handle.width / 2) / (seekSlider.width - handle.width)
+ }
+ }
+ }
+}
diff --git a/ui/qml/controls/TextButton.qml b/ui/qml/controls/TextButton.qml
new file mode 100644
index 0000000..bde0de1
--- /dev/null
+++ b/ui/qml/controls/TextButton.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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 Shapes 1.0
+
+AbstractButton {
+ id: textButton
+
+ implicitWidth: 220 * dp
+ implicitHeight: 80 * dp
+
+ opacity: enabled ? 1 : 0.4
+
+ property alias text: label.text
+
+ Rectangle {
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: textButton.activeFocus ? colors.green1
+ : colors.gray1
+ }
+
+ Label {
+ id: label
+
+ anchors.fill: parent
+ anchors.leftMargin: 30 * dp
+ anchors.rightMargin: 30 * dp
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ color: textButton.activeFocus ? colors.white1
+ : colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+ }
+}
diff --git a/ui/qml/controls/TextInputField.qml b/ui/qml/controls/TextInputField.qml
new file mode 100644
index 0000000..d3ce735
--- /dev/null
+++ b/ui/qml/controls/TextInputField.qml
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: textInputField
+
+ implicitWidth: 400 * dp
+ implicitHeight: 80 * dp
+
+ property alias placeholderText: placeholderLabel.text
+ property alias text: textInput.text
+ readonly property bool acceptingInput: textInput.activeFocus
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ item: textInputField
+ }
+
+ Rectangle {
+ id: backgroundRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.gray1
+ }
+
+ TextInput {
+ id: textInput
+
+ anchors.fill: parent
+ anchors.leftMargin: 30 * dp
+ anchors.rightMargin: 30 * dp
+
+ verticalAlignment: Text.AlignVCenter
+
+ clip: true
+
+ color: if (textInputField.activeFocus) colors.green1
+ else if (textInput.activeFocus) colors.white2
+ else colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ cursorDelegate: Rectangle {
+ id: cursorDelegate
+
+ width: 3 * dp
+
+ color: colors.white2
+
+ Connections {
+ target: textInput
+
+ onActiveFocusChanged: {
+ if (target.activeFocus) {
+ cursorAnimation.start()
+ } else {
+ cursorAnimation.stop()
+ }
+ }
+
+ onCursorPositionChanged: {
+ if (target.activeFocus) {
+ cursorAnimation.restart()
+ }
+ }
+ }
+
+ SequentialAnimation {
+ id: cursorAnimation
+
+ running: false
+ loops: SequentialAnimation.Infinite
+
+ onStopped: {
+ cursorDelegate.visible = false
+ }
+
+ PropertyAction {
+ target: cursorDelegate
+ property: "visible"
+ value: true
+ }
+
+ PauseAnimation {
+ duration: 440
+ }
+
+ PropertyAction {
+ target: cursorDelegate
+ property: "visible"
+ value: false
+ }
+
+ PauseAnimation {
+ duration: 440
+ }
+ }
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select)
+ {
+ textInputField.forceActiveFocus()
+ event.accepted = true
+ }
+ }
+ }
+
+ Label {
+ id: placeholderLabel
+
+ anchors.fill: parent
+ anchors.leftMargin: 30 * dp
+ anchors.rightMargin: 30 * dp
+
+ verticalAlignment: Text.AlignVCenter
+
+ color: textInputField.activeFocus || textInput.activeFocus ? colors.green1
+ : colors.white3
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ visible: !textInput.activeFocus && textInput.text === ""
+ }
+
+ Rectangle {
+ id: focusRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.transparent
+ border.width: Math.round(3 * dp)
+ border.color: colors.green1
+
+ visible: textInputField.activeFocus || textInput.activeFocus
+ }
+
+ Keys.onPressed: {
+ if (textInput.activeFocus) {
+ return
+ }
+
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select)
+ {
+ textInput.forceActiveFocus()
+ event.accepted = true
+ }
+ }
+}
diff --git a/ui/qml/controls/ToolBar.qml b/ui/qml/controls/ToolBar.qml
new file mode 100644
index 0000000..2dfc0e5
--- /dev/null
+++ b/ui/qml/controls/ToolBar.qml
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** 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
+
+FocusScope {
+ id: toolBar
+
+ z: 2
+
+ MouseArea {
+ anchors.fill: parent
+ }
+}
diff --git a/ui/qml/controls/UrlInputField.qml b/ui/qml/controls/UrlInputField.qml
new file mode 100644
index 0000000..0f1bccb
--- /dev/null
+++ b/ui/qml/controls/UrlInputField.qml
@@ -0,0 +1,249 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: urlInputField
+
+ implicitWidth: 400 * dp
+ implicitHeight: 80 * dp
+
+ property real progress: 0.0
+ property real minimumProgress: 0.1
+ property bool loading: false
+ property alias placeholderText: placeholderLabel.text
+ property alias text: textInput.text
+ readonly property bool acceptingInput: textInput.activeFocus
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ item: urlInputField
+ }
+
+ onLoadingChanged: {
+ if (loading) {
+ fadeOutAnimation.stop()
+ progressRectangle.width = 0
+ progressRectangle.opacity = 1
+ } else {
+ fadeOutAnimation.start()
+ }
+ }
+
+ onProgressChanged: {
+ var newWidth = urlInputField.progress > urlInputField.minimumProgress
+ ? width * urlInputField.progress
+ : width * urlInputField.minimumProgress
+
+ if (newWidth > progressRectangle.width) {
+ progressAnimation.stop()
+ progressAnimation.from = progressRectangle.width
+ progressAnimation.to = newWidth
+ progressAnimation.restart()
+ } else {
+ progressRectangle.width = newWidth
+ }
+ }
+
+ Rectangle {
+ id: backgroundRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.gray1
+ }
+
+ Rectangle {
+ id: progressRectangle
+
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ radius: Math.round(8 * dp)
+ color: colors.white4
+
+ NumberAnimation {
+ id: progressAnimation
+ target: progressRectangle
+ properties: "width"
+ duration: 200
+ loops: 1
+ running: false
+ }
+
+ SequentialAnimation {
+ id: fadeOutAnimation
+
+ loops: 1
+ running: false
+
+ PauseAnimation {
+ duration: 500
+ }
+
+ NumberAnimation {
+ target: progressRectangle
+ properties: "opacity"
+ from: 1
+ to: 0
+ duration: 200
+ }
+ }
+ }
+
+ TextInput {
+ id: textInput
+
+ anchors.fill: parent
+ anchors.leftMargin: 30 * dp
+ anchors.rightMargin: 30 * dp
+
+ verticalAlignment: Text.AlignVCenter
+
+ clip: true
+
+ color: if (urlInputField.activeFocus) colors.green1
+ else if (textInput.activeFocus) colors.white2
+ else colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ cursorDelegate: Rectangle {
+ id: cursorDelegate
+
+ width: 3 * dp
+
+ color: colors.white2
+
+ Connections {
+ target: textInput
+
+ onActiveFocusChanged: {
+ if (target.activeFocus) {
+ cursorAnimation.start()
+ } else {
+ cursorAnimation.stop()
+ }
+ }
+
+ onCursorPositionChanged: {
+ if (target.activeFocus) {
+ cursorAnimation.restart()
+ }
+ }
+ }
+
+ SequentialAnimation {
+ id: cursorAnimation
+
+ running: false
+ loops: SequentialAnimation.Infinite
+
+ onStopped: {
+ cursorDelegate.visible = false
+ }
+
+ PropertyAction {
+ target: cursorDelegate
+ property: "visible"
+ value: true
+ }
+
+ PauseAnimation {
+ duration: 440
+ }
+
+ PropertyAction {
+ target: cursorDelegate
+ property: "visible"
+ value: false
+ }
+
+ PauseAnimation {
+ duration: 440
+ }
+ }
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select)
+ {
+ urlInputField.forceActiveFocus()
+ event.accepted = true
+ }
+ }
+ }
+
+ Label {
+ id: placeholderLabel
+
+ anchors.fill: parent
+ anchors.leftMargin: 30 * dp
+ anchors.rightMargin: 30 * dp
+
+ verticalAlignment: Text.AlignVCenter
+
+
+ color: urlInputField.activeFocus || textInput.activeFocus ? colors.green1
+ : colors.white3
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ visible: !textInput.activeFocus && textInput.text === ""
+ }
+
+ Rectangle {
+ id: focusRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.transparent
+ border.width: Math.round(3 * dp)
+ border.color: colors.green1
+
+ visible: urlInputField.activeFocus || textInput.activeFocus
+ }
+
+ Keys.onPressed: {
+ if (textInput.activeFocus) {
+ return
+ }
+
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select)
+ {
+ textInput.forceActiveFocus()
+ event.accepted = true
+ }
+ }
+}
diff --git a/ui/qml/controls/VerticalDissolveEffect.qml b/ui/qml/controls/VerticalDissolveEffect.qml
new file mode 100644
index 0000000..582abfc
--- /dev/null
+++ b/ui/qml/controls/VerticalDissolveEffect.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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
+
+ShaderEffect {
+ id: verticalDissolveEffect
+
+ property real length: sourceHeight / 2
+ property real sourceHeight: 0
+ readonly property real effectiveLength: {
+ if (length <= 0) sourceHeight
+ else if (length >= (sourceHeight / 2)) 1
+ else Math.sqrt(1 / Math.pow(length / sourceHeight, 2))
+ }
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+
+ uniform lowp float effectiveLength;
+
+ void main() {
+ lowp vec4 texture = texture2D(source, qt_TexCoord0);
+
+ lowp float dist = abs(qt_TexCoord0.y - 0.5) * (effectiveLength * 2.0);
+ texture *= min(1.0, (effectiveLength - dist));
+
+ gl_FragColor = texture * qt_Opacity;
+ }"
+}
diff --git a/ui/qml/controls/VerticalSpacer.qml b/ui/qml/controls/VerticalSpacer.qml
new file mode 100644
index 0000000..d346001
--- /dev/null
+++ b/ui/qml/controls/VerticalSpacer.qml
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: verticalSpacer
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+}
diff --git a/ui/qml/controls/VideoPlayer.qml b/ui/qml/controls/VideoPlayer.qml
new file mode 100644
index 0000000..e3e4cae
--- /dev/null
+++ b/ui/qml/controls/VideoPlayer.qml
@@ -0,0 +1,474 @@
+/****************************************************************************
+**
+** 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 QtMultimedia 5.5
+
+FocusScope {
+ id: videoPlayer
+
+ property alias autoPlay: video.autoPlay
+ property int hideControlPanelTimeout: hideControlPanelTimer.interval
+ property alias duration: video.duration
+ property alias playbackRate: video.playbackRate
+ property alias playbackState: video.playbackState
+ property alias position: video.position
+ property alias source: video.source
+ property alias volume: video.volume
+
+ signal closePressed()
+
+ function play() {
+ video.play()
+ }
+
+ function stop() {
+ video.stop()
+ }
+
+ function pause() {
+ video.pause()
+ }
+
+ function seek(offset) {
+ video.seek(offset)
+ }
+
+ Video {
+ id: video
+
+ anchors.fill: parent
+
+ autoPlay: true
+ volume: (settings.volume - settings.minimumVolume) / settings.maximumVolume
+
+ function fastForwardPlaybackRate() {
+ if (playbackRate < 2.0) {
+ return 2.0
+ } else if (playbackRate < 5.0) {
+ return 5.0
+ } else if (playbackRate < 10.0) {
+ return 10.0
+ } else if (playbackRate < 30.0) {
+ return 30.0
+ } else if (playbackRate < 60.0) {
+ return 60.0
+ } else {
+ return 2.0
+ }
+ }
+
+ function fastBackwardPlaybackRate() {
+ if (playbackRate > -2.0) {
+ return -2.0
+ } else if (playbackRate > -5.0) {
+ return -5
+ } else if (playbackRate > -10.0) {
+ return -10.0
+ } else if (playbackRate > -30.0) {
+ return -30.0
+ } else if (playbackRate > -60.0) {
+ return -60.0
+ } else {
+ return -2.0
+ }
+ }
+
+ function formatDuration(durationInMilliseconds) {
+ var hours = Math.floor(durationInMilliseconds / (1000 * 60 * 60))
+ hours = (hours > 0) ? hours + ":" : ""
+ var minutes = Math.floor((durationInMilliseconds / (1000 * 60)) % 60)
+ minutes = (minutes < 10) ? "0" + minutes : minutes
+ var seconds = Math.floor((durationInMilliseconds / 1000) % 60)
+ seconds = (seconds < 10) ? "0" + seconds : seconds
+
+ return "%1%2:%3".arg(hours).arg(minutes).arg(seconds)
+ }
+
+ function userActionDetected() {
+ if (!controlPanel.visible) {
+ controlPanel.visible = true
+ }
+
+ hideControlPanelTimer.restart()
+ }
+
+ onPlaybackStateChanged: {
+ if (playbackState === MediaPlayer.StoppedState) {
+ playbackRate = 1.0
+
+ if (position === duration) {
+ seek(0)
+ }
+ }
+ }
+ }
+
+ Timer {
+ id: hideControlPanelTimer
+
+ interval: 3000
+ repeat: false
+ running: true
+ onTriggered: {
+ controlPanel.visible = false
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+ }
+
+ FocusScope {
+ id: controlPanel
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ height: 180 * dp
+
+ focus: true
+
+ Rectangle {
+ anchors.fill: parent
+
+ color: colors.gray2
+ }
+
+ VideoPlayerButton {
+ id: closeButton
+
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.leftMargin: 50 * dp
+ anchors.topMargin: 30 * dp
+
+ focus: true
+
+ icon: "\uf053"
+
+ KeyNavigation.right: fastBackwardButton
+
+ Keys.onPressed: {
+ video.userActionDetected()
+ }
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+
+ onClicked: {
+ videoPlayer.stop()
+ videoPlayer.closePressed()
+ }
+ }
+
+ Label {
+ anchors.right: playbackControlButtonsRow.left
+ anchors.top: parent.top
+ anchors.rightMargin: 50 * dp
+ anchors.topMargin: 31 * dp
+
+ visible: videoPlayer.playbackRate < -1.0
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 35 * dp
+
+ text: "%1×".arg(Math.abs(videoPlayer.playbackRate))
+ }
+
+ Row {
+ id: playbackControlButtonsRow
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ anchors.topMargin: 30 * dp
+
+ spacing: 60 * dp
+
+ VideoPlayerButton {
+ id: fastBackwardButton
+
+ icon: "\uf04a"
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+
+ KeyNavigation.left: closeButton
+ KeyNavigation.right: playPauseButton
+
+ Keys.onPressed: {
+ video.userActionDetected()
+ }
+
+ onClicked: {
+ var temp = video.fastBackwardPlaybackRate()
+
+ if (videoPlayer.playbackState === MediaPlayer.PausedState ||
+ videoPlayer.playbackState === MediaPlayer.StoppedState)
+ {
+ videoPlayer.play()
+ }
+
+ videoPlayer.playbackRate = temp
+ }
+ }
+
+ VideoPlayerButton {
+ id: playPauseButton
+
+ icon: videoPlayer.playbackState === MediaPlayer.PausedState ||
+ videoPlayer.playbackState === MediaPlayer.StoppedState ? "\uf04b"
+ : "\uf04c"
+
+ KeyNavigation.left: fastBackwardButton
+ KeyNavigation.right: fastForwardButton
+
+ Keys.onPressed: {
+ video.userActionDetected()
+ }
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+
+ onClicked: {
+ if (videoPlayer.playbackState === MediaPlayer.PausedState ||
+ videoPlayer.playbackState === MediaPlayer.StoppedState)
+ {
+ videoPlayer.play()
+ } else {
+ videoPlayer.pause()
+ videoPlayer.playbackRate = 1.0
+ }
+ }
+ }
+
+ VideoPlayerButton {
+ id: fastForwardButton
+
+ icon: "\uf04e"
+
+ KeyNavigation.left: playPauseButton
+ KeyNavigation.right: volumeDownButton
+
+ Keys.onPressed: {
+ video.userActionDetected()
+ }
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+
+ onClicked: {
+ var temp = video.fastForwardPlaybackRate()
+
+ if (videoPlayer.playbackState === MediaPlayer.PausedState ||
+ videoPlayer.playbackState === MediaPlayer.StoppedState)
+ {
+ videoPlayer.play()
+ }
+
+ videoPlayer.playbackRate = temp
+ }
+ }
+ }
+
+ Label {
+ anchors.left: playbackControlButtonsRow.right
+ anchors.top: parent.top
+ anchors.leftMargin: 50 * dp
+ anchors.topMargin: 31 * dp
+
+ visible: videoPlayer.playbackRate > 1.0
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 35 * dp
+
+ text: "%1×".arg(Math.abs(videoPlayer.playbackRate))
+ }
+
+ Row {
+ id: volumeControlButtonsRow
+
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.rightMargin: 50 * dp
+ anchors.topMargin: 30 * dp
+
+ spacing: 10 * dp
+
+ VideoPlayerButton {
+ id: volumeDownButton
+
+ icon: "\uf027"
+
+ KeyNavigation.left: fastForwardButton
+ KeyNavigation.right: volumeUpButton
+
+ Keys.onPressed: {
+ video.userActionDetected()
+ }
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+
+ onClicked: {
+ var newVolume = (settings.volume - 1)
+ if (newVolume >= settings.minimumVolume) {
+ settings.volume = newVolume
+ }
+ }
+ }
+
+ HorizontalSpacer {
+ width: 10 * dp
+ }
+
+ Repeater {
+ model: 5
+ delegate: Label {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: -5 * dp
+
+ font.family: fonts.fontAwesome
+ font.pixelSize: 24 * dp
+
+ color: colors.white2
+ text: (index + 1) > settings.volume ? "\uf10c" : "\uf111"
+ }
+ }
+
+ HorizontalSpacer {
+ width: 10 * dp
+ }
+
+ VideoPlayerButton {
+ id: volumeUpButton
+
+ icon: "\uf028"
+
+ KeyNavigation.left: volumeDownButton
+
+ Keys.onPressed: {
+ video.userActionDetected()
+ }
+
+ onPressedChanged: {
+ video.userActionDetected()
+ }
+
+ onClicked: {
+ var newVolume = (settings.volume + 1)
+ if (newVolume <= settings.maximumVolume) {
+ settings.volume = newVolume
+ }
+ }
+ }
+ }
+
+ Label {
+ id: playbackPositionLabel
+
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: 50 * dp
+ anchors.bottomMargin: 25 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 35 * dp
+
+ text: video.formatDuration(videoPlayer.position)
+ }
+
+ SeekSlider {
+ id: seekSlider
+
+ anchors.left: playbackPositionLabel.right
+ anchors.right: durationLabel.left
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: 20 * dp
+ anchors.rightMargin: 20 * dp
+ anchors.bottomMargin: 10 * dp
+
+ position: (videoPlayer.duration > 0) ? videoPlayer.position / videoPlayer.duration : 0
+
+ property bool wasPlayingWhenSeekingStarted: false
+
+ onSeekingChanged: {
+ video.userActionDetected()
+
+ if (seeking) {
+ wasPlayingWhenSeekingStarted = (videoPlayer.playbackState === MediaPlayer.PlayingState)
+ videoPlayer.pause()
+ videoPlayer.playbackRate = 1.0
+ } else {
+ videoPlayer.seek(videoPlayer.duration * seekingPosition)
+
+ if (wasPlayingWhenSeekingStarted) {
+ videoPlayer.play()
+ }
+ }
+ }
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: seekSlider.seeking
+ triggeredOnStart: true
+ onTriggered: {
+ video.userActionDetected()
+
+ videoPlayer.seek(videoPlayer.duration * seekSlider.seekingPosition)
+ }
+ }
+ }
+
+ Label {
+ id: durationLabel
+
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.rightMargin: 50 * dp
+ anchors.bottomMargin: 25 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 35 * dp
+
+ text: video.formatDuration(videoPlayer.duration)
+ }
+ }
+}
diff --git a/ui/qml/controls/VideoPlayerButton.qml b/ui/qml/controls/VideoPlayerButton.qml
new file mode 100644
index 0000000..1296bd2
--- /dev/null
+++ b/ui/qml/controls/VideoPlayerButton.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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
+
+AbstractButton {
+ id: videoPlayerButton
+
+ property alias icon: label.text
+
+ width: 70 * dp
+ height: 70 * dp
+
+ Label {
+ id: label
+
+ anchors.fill: parent
+
+ color: videoPlayerButton.activeFocus ? colors.green1
+ : colors.white1
+ font.family: fonts.fontAwesome
+ font.pixelSize: 60 * dp
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignHCenter
+ }
+}
diff --git a/ui/qml/controls/WebView.qml b/ui/qml/controls/WebView.qml
new file mode 100644
index 0000000..2a442f5
--- /dev/null
+++ b/ui/qml/controls/WebView.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ property url url
+ readonly property int loadProgress: 0
+ readonly property bool loading: false
+
+ Text {
+ anchors.fill: parent
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ color: colors.white1
+ font.pixelSize: 140 * dp
+ text: qsTr("Browser unavailable")
+ }
+}
diff --git a/ui/qml/main.qml b/ui/qml/main.qml
new file mode 100644
index 0000000..83a50b2
--- /dev/null
+++ b/ui/qml/main.qml
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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 QtGraphicalEffects 1.0
+import QtQuick.Particles 2.0
+import "components"
+import "controls"
+import "screens"
+
+ApplicationWindow {
+ id: appWindow
+
+ property Settings settings: Settings {
+ onInitialized: {
+ if (missingKeys.length > 0) {
+ invalidSettingsOverlay.open()
+ }
+ }
+ }
+
+ onBackPressed: {
+ if (overlay.visibleChildren.length > 0) {
+ var topOverlayItem = overlay.visibleChildren[overlay.visibleChildren.length - 1]
+ if (topOverlayItem.closeOnBackButtonPress) {
+ topOverlayItem.close()
+ }
+ } else if (stackView.depth > 1) {
+ stackView.pop()
+ } else {
+ Qt.quit()
+ }
+ }
+
+ RadialGradient {
+ id: backgroundGradient
+
+ anchors.fill: parent
+
+ horizontalRadius: Math.min(width, height)
+ verticalRadius: horizontalRadius
+
+ SequentialAnimation {
+ id: horizontalAnimation
+
+ loops: Animation.Infinite
+ running: true
+
+ NumberAnimation {
+ target: backgroundGradient
+ property: "horizontalOffset"
+ easing.type: Easing.InOutSine
+ duration: 8000
+ from: -width / 4
+ to: width / 4
+ onFromChanged: horizontalAnimation.restart()
+ onToChanged: horizontalAnimation.restart()
+ }
+
+ NumberAnimation {
+ target: backgroundGradient
+ property: "horizontalOffset"
+ easing.type: Easing.InOutSine
+ duration: 8000
+ from: width / 4
+ to: -width / 4
+ onFromChanged: horizontalAnimation.restart()
+ onToChanged: horizontalAnimation.restart()
+ }
+ }
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: colors.background1 }
+ GradientStop { position: 0.25; color: colors.background2 }
+ GradientStop { position: 0.5; color: colors.background3 }
+ GradientStop { position: 0.75; color: colors.background4 }
+ GradientStop { position: 1.0; color: colors.background5 }
+ }
+ }
+
+ ParticleSystem {
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: "green"
+ source: "qrc:/images/particle.png"
+ opacity: 0.1
+ color: colors.green2
+ }
+
+ Emitter {
+ anchors.fill: parent
+
+ group: "green"
+
+ emitRate: 2
+ startTime: lifeSpan
+ lifeSpan: 10000
+
+ size: 1200 * dp
+ sizeVariation: 400 * dp
+
+ velocity: AngleDirection {
+ angleVariation: 360
+ magnitude: 80 * dp
+ magnitudeVariation: 20 * dp
+ }
+ }
+ }
+
+ NavigationStack {
+ id: stackView
+
+ anchors.fill: parent
+
+ initialItem: MainScreen {}
+ }
+
+ Item {
+ id: overlay
+
+ anchors.fill: parent
+ }
+
+ InvalidSettingsOverlay {
+ id: invalidSettingsOverlay
+
+ onAccepted: {
+ close()
+ stackView.push(Qt.resolvedUrl("qrc:/qml/screens/SettingsScreen.qml"))
+ }
+ }
+
+ Loader {
+ anchors.fill: parent
+ source: Qt.platform.os === "tvos" ? "qrc:/qml/controls/TvRemoteInputArea.qml" : ""
+ }
+}
diff --git a/ui/qml/qml.qrc b/ui/qml/qml.qrc
new file mode 100644
index 0000000..3e045dd
--- /dev/null
+++ b/ui/qml/qml.qrc
@@ -0,0 +1,52 @@
+<RCC>
+ <qresource prefix="/qml">
+ <file>components/Colors.qml</file>
+ <file>components/Fonts.qml</file>
+ <file>components/JSONListModel.qml</file>
+ <file>components/JSONQuery.qml</file>
+ <file>components/Settings.qml</file>
+ <file>controls/+webengine/WebView.qml</file>
+ <file>controls/+webview/WebView.qml</file>
+ <file>controls/AbstractButton.qml</file>
+ <file>controls/ApplicationButton.qml</file>
+ <file>controls/ApplicationWindow.qml</file>
+ <file>controls/BaseScreen.qml</file>
+ <file>controls/BusyIndicator.qml</file>
+ <file>controls/HorizontalSpacer.qml</file>
+ <file>controls/Label.qml</file>
+ <file>controls/NavigationStack.qml</file>
+ <file>controls/RoundButton.qml</file>
+ <file>controls/SeekSlider.qml</file>
+ <file>controls/TextButton.qml</file>
+ <file>controls/TextInputField.qml</file>
+ <file>controls/UrlInputField.qml</file>
+ <file>controls/VerticalSpacer.qml</file>
+ <file>controls/VideoPlayer.qml</file>
+ <file>controls/VideoPlayerButton.qml</file>
+ <file>controls/WebView.qml</file>
+ <file>main.qml</file>
+ <file>screens/MainScreen.qml</file>
+ <file>screens/MovieDetailsScreen.qml</file>
+ <file>screens/MoviesControls/AnimatedText.qml</file>
+ <file>screens/MoviesControls/BackgroundPoster.qml</file>
+ <file>screens/MoviesControls/MovieCatalogButton.qml</file>
+ <file>screens/MoviesControls/MoviePoster.qml</file>
+ <file>screens/MoviesControls/ImageButton.qml</file>
+ <file>screens/MoviesScreen.qml</file>
+ <file>screens/SettingsScreen.qml</file>
+ <file>screens/TrailerScreen.qml</file>
+ <file>screens/WebBrowserScreen.qml</file>
+ <file>scripts/3rdparty/YoutubeClientV3.js</file>
+ <file>scripts/datamodels.js</file>
+ <file>screens/MoviesControls/MovieCatalogView.qml</file>
+ <file>controls/VerticalDissolveEffect.qml</file>
+ <file>controls/ToolBar.qml</file>
+ <file>screens/MoviesControls/MovieImagesView.qml</file>
+ <file>controls/OverlayItem.qml</file>
+ <file>screens/MoviesControls/ImagePreviewOverlay.qml</file>
+ <file>screens/MoviesControls/WebViewOverlay.qml</file>
+ <file>scripts/XMLHttpRequestCache.js</file>
+ <file>controls/InvalidSettingsOverlay.qml</file>
+ <file>controls/PageIndicator.qml</file>
+ </qresource>
+</RCC>
diff --git a/ui/qml/screens/MainScreen.qml b/ui/qml/screens/MainScreen.qml
new file mode 100644
index 0000000..d0a19ca
--- /dev/null
+++ b/ui/qml/screens/MainScreen.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+import Shapes 1.0
+import "../controls"
+import "../components"
+
+BaseScreen {
+ id: mainScreen
+
+ Time {
+ id: time
+
+ twentyFourHourFormat: false
+ }
+
+ Label {
+ id: timeLabel
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 100 * dp
+ font.weight: Font.Thin
+ text: "%1:%2"
+ .arg(time.hour)
+ .arg(time.minute < 10 ? "0" + time.minute : time.minute)
+
+ Label {
+ anchors.left: parent.right
+ anchors.leftMargin: 8 * dp
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: 26 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+ text: time.amPm
+ }
+ }
+
+ Grid {
+ id: buttonsGrid
+
+ anchors.centerIn: parent
+
+ columns: 2
+ rows: 2
+ columnSpacing: 50 * dp
+ rowSpacing: 50 * dp
+
+ ApplicationButton {
+ id: moviesButton
+
+ focus: true
+
+ icon: "\uf26c"
+ text: qsTr("MOVIES")
+
+ KeyNavigation.right: settingsButton
+ KeyNavigation.down: webBrowserButton
+
+ onClicked: {
+ stackView.push(Qt.resolvedUrl("qrc:/qml/screens/MoviesScreen.qml"))
+ }
+ }
+
+ ApplicationButton {
+ id: settingsButton
+
+ icon: "\uf085"
+ text: qsTr("SETTINGS")
+
+ KeyNavigation.left: moviesButton
+ KeyNavigation.down: npapiPluginButton
+
+ onClicked: {
+ stackView.push(Qt.resolvedUrl("qrc:/qml/screens/SettingsScreen.qml"))
+ }
+ }
+
+ ApplicationButton {
+ id: webBrowserButton
+
+ enabled: webUtils.available
+
+ icon: "\uf0ac"
+ text: qsTr("WEB BROWSER")
+
+ KeyNavigation.up: moviesButton
+ KeyNavigation.right: npapiPluginButton
+
+ onClicked: {
+ stackView.push(Qt.resolvedUrl("qrc:/qml/screens/WebBrowserScreen.qml"))
+ }
+ }
+
+ ApplicationButton {
+ id: npapiPluginButton
+
+ enabled: processController.available
+
+ icon: "\uf1c8"
+ text: qsTr("NPAPI PLUGIN")
+
+ Component.onCompleted: {
+ if (Qt.platform.os === "macos") {
+ processController.program = "./../Executables/qt-tv-npapi-host"
+ } else {
+ processController.program = "./qt-tv-npapi-host"
+ }
+ }
+
+ KeyNavigation.left: webBrowserButton
+ KeyNavigation.up: settingsButton
+
+ onClicked: {
+ processController.running = true
+ }
+ }
+ }
+}
diff --git a/ui/qml/screens/MovieDetailsScreen.qml b/ui/qml/screens/MovieDetailsScreen.qml
new file mode 100644
index 0000000..a339ab5
--- /dev/null
+++ b/ui/qml/screens/MovieDetailsScreen.qml
@@ -0,0 +1,373 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+import "../scripts/datamodels.js" as DataModels
+import "../controls"
+import "../components"
+import "MoviesControls"
+
+BaseScreen {
+ id: movieDetailsScreen
+
+ property var selectedMovie
+
+ ToolBar {
+ id: toolBar
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ height: 170 * dp
+
+ focus: true
+
+ RoundButton {
+ id: backButton
+
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 40 * dp
+
+ focus: true
+
+ icon: "\uf060"
+
+ KeyNavigation.right: trailerButton
+ KeyNavigation.down: movieImagesView.count > 0 ? movieImagesView : null
+
+ onClicked: {
+ stackView.pop()
+ }
+ }
+
+ Row {
+ anchors.left: backButton.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 50 * dp
+
+ spacing: 30 * dp
+
+ TextButton {
+ id: trailerButton
+
+ width: 260 * dp
+
+ text: qsTr("Watch Trailer")
+
+ KeyNavigation.left: backButton
+ KeyNavigation.right: imdbButton
+ KeyNavigation.down: movieImagesView.count > 0 ? movieImagesView : null
+
+ onClicked: {
+ stackView.push({
+ item: Qt.resolvedUrl("qrc:/qml/screens/TrailerScreen.qml"),
+ properties: {
+ "movieId" : movieQuery.youtubeId,
+ "movieTitle" : selectedMovie.title
+ }
+ })
+ }
+ }
+
+ TextButton {
+ id: imdbButton
+
+ text: qsTr("IMDB")
+
+ KeyNavigation.left: trailerButton
+ KeyNavigation.down: movieImagesView.count > 0 ? movieImagesView : null
+
+ onClicked: {
+ if (movieQuery.imdbId !== "") {
+ webViewOverlay.url = "http://www.imdb.com/title/%1".arg(movieQuery.imdbId)
+ } else {
+ webViewOverlay.url = "https://www.themoviedb.org/movie/%1".arg(selectedMovie.movieId)
+ }
+ webViewOverlay.open()
+ }
+ }
+ }
+ }
+
+ MoviePoster {
+ id: moviePosterImage
+
+ anchors.left: parent.left
+ anchors.top: toolBar.bottom
+ anchors.bottom: movieImagesView.top
+ anchors.leftMargin: 80 * dp
+ anchors.topMargin: 20 * dp
+ anchors.bottomMargin: 40 * dp
+
+ width: height * 0.66
+
+ source: selectedMovie.imageUrl
+ }
+
+ Label {
+ id: movieTitleLabel
+
+ anchors.left: moviePosterImage.right
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 20 * dp
+ anchors.topMargin: 20 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 50 * dp
+ font.bold: true
+
+ text: selectedMovie.title
+ }
+
+ Row {
+ id: movieInfoRow
+
+ anchors.left: moviePosterImage.right
+ anchors.right: parent.right
+ anchors.top: movieTitleLabel.bottom
+
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 20 * dp
+
+ spacing: 10 * dp
+
+ Label {
+ anchors.verticalCenter: parent.verticalCenter
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ text: selectedMovie.releaseYear
+ }
+
+ Row {
+ anchors.verticalCenter: parent.verticalCenter
+
+ spacing: 5 * dp
+
+ Repeater {
+ id: ratingStarsRepeater
+
+ model: 5
+ delegate: Label {
+ color: colors.yellow1
+ font.family: fonts.fontAwesome
+ font.pixelSize: 30 * dp
+
+ text: {
+ if (index + 1 < movieQuery.vote_average) "\uf005"
+ else if (movieQuery.vote_average - index > 0.25) "\uf123"
+ else "\uf006"
+ }
+ }
+ }
+ }
+
+ AnimatedText {
+ anchors.verticalCenter: parent.verticalCenter
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ text: movieQuery.runtime
+ }
+ }
+
+ AnimatedText {
+ id: movieGenresLabel
+
+ anchors.left: moviePosterImage.right
+ anchors.right: parent.right
+ anchors.top: movieInfoRow.bottom
+
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 20 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.italic: true
+
+ text: movieQuery.genres
+ }
+
+ AnimatedText {
+ id: movieDescriptionLabel
+
+ anchors.left: moviePosterImage.right
+ anchors.right: parent.right
+ anchors.top: movieGenresLabel.bottom
+ anchors.bottom: movieImagesView.bottom
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 20 * dp
+ anchors.topMargin: 20 * dp
+ anchors.bottomMargin: 20 * dp
+
+ wrapMode: Text.Wrap
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+
+ text: movieQuery.synopsis
+ }
+
+ MovieImagesView {
+ id: movieImagesView
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: 80 * dp
+ anchors.rightMargin: 80 * dp
+ anchors.bottomMargin: 40 * dp
+
+ KeyNavigation.up: toolBar
+ KeyNavigation.priority: KeyNavigation.BeforeItem
+
+ onClicked: {
+ imagePreviewOverlay.model = movieQuery.images
+ imagePreviewOverlay.currentIndex = currentIndex
+ imagePreviewOverlay.open()
+ }
+
+ onSwipedLeft: {
+ movieImagesView.decrementCurrentIndex()
+ }
+
+ onSwipedRight: {
+ movieImagesView.incrementCurrentIndex()
+ }
+
+ onSwipedUp: {
+ var item = movieImagesView.KeyNavigation.up
+ if (item && item.enabled) {
+ item.forceActiveFocus()
+ }
+ }
+
+ onSwipedDown: {
+ var item = movieImagesView.KeyNavigation.down
+ if (item && item.enabled) {
+ item.forceActiveFocus()
+ }
+ }
+ }
+
+ JSONQuery {
+ id: movieQuery
+
+ property string synopsis
+ property string youtubeId
+ property real vote_average
+ property int vote_count
+ property string imdbId
+ property string genres
+ property string runtime
+ property var images: []
+
+ source: DataModels.formatQuery("movie/%1".arg(selectedMovie.movieId), { append_to_response: "trailers,images"} )
+
+ onResultChanged: {
+ var i
+
+ // Extract genres
+ if (result.genres) {
+ var genresArray = []
+
+ for (i = 0; i < result.genres.length; i++) {
+ genresArray.push(result.genres[i].name)
+ }
+
+ genres = genresArray.join(", ")
+ }
+
+ // Extract trailer if available
+ var trailer
+ if (result.trailers) {
+ for (i = 0; i < result.trailers.youtube.length; i++) {
+ trailer = result.trailers.youtube[i].source
+ break
+ }
+ }
+
+ youtubeId = trailer ? trailer : ""
+
+ // Extract previews
+ if (result.images) {
+ var backdrops = result.images.backdrops
+
+ for (i = 0; i < backdrops.length; i++) {
+ images.push(backdrops[i].file_path)
+ }
+ }
+
+ // Extract overview
+ if (result.overview) {
+ synopsis = result.overview
+ } else {
+ synopsis = qsTr("No synopsis available")
+ }
+
+ if (result.imdb_id) {
+ imdbId = result.imdb_id
+ }
+
+ if (result.vote_average) {
+ vote_average = result.vote_average / 2
+ } else {
+ vote_average = 0
+ }
+
+ // Extract runtime
+ if (result.runtime) {
+ var hours = Math.floor(result.runtime / 60)
+ var minutes = result.runtime - hours * 60
+ if (hours > 0) {
+ runtime = "%1h %2m".arg(hours).arg(minutes)
+ } else {
+ runtime = "%1m".arg(minutes)
+ }
+ }
+
+ movieImagesView.model = images
+ }
+ }
+
+ ImagePreviewOverlay {
+ id: imagePreviewOverlay
+ }
+
+ WebViewOverlay {
+ id: webViewOverlay
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/AnimatedText.qml b/ui/qml/screens/MoviesControls/AnimatedText.qml
new file mode 100644
index 0000000..2717fcd
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/AnimatedText.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+
+Label {
+ id: animatedText
+
+ onTextChanged: {
+ animation.restart()
+ }
+
+ NumberAnimation {
+ id: animation
+
+ target: animatedText
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ easing.type: Easing.InSine
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/BackgroundPoster.qml b/ui/qml/screens/MoviesControls/BackgroundPoster.qml
new file mode 100644
index 0000000..efacb16
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/BackgroundPoster.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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
+
+Image {
+ id: backgroundPoster
+
+ fillMode: Image.PreserveAspectCrop
+
+ ParallelAnimation {
+ id: opacityAnimation
+
+ NumberAnimation {
+ target: backgroundPoster
+ property: "opacity"
+ from: 0
+ to: 0.05
+ duration: 1000
+ easing.type: Easing.InOutCubic
+ }
+
+ NumberAnimation {
+ target: backgroundPoster
+ property: "scale"
+ from: 1.3
+ to: 1
+ duration: 10000
+ easing.type: Easing.OutSine
+ }
+ }
+
+ onStatusChanged: {
+ if (status == Image.Ready) {
+ opacityAnimation.restart()
+ }
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/ImageButton.qml b/ui/qml/screens/MoviesControls/ImageButton.qml
new file mode 100644
index 0000000..28c532c
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/ImageButton.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+
+AbstractButton {
+ id: imageButton
+
+ implicitWidth: 540 * dp
+ implicitHeight: 321 * dp
+
+ property alias imageSource: image.source
+
+ states: [
+ State {
+ name: ""
+
+ PropertyChanges {
+ target: imageButton
+ scale: 1
+ }
+ },
+ State {
+ name: "selected"
+ when: imageButton.activeFocus
+
+ PropertyChanges {
+ target: imageButton
+ scale: 1.07
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "selected"
+ to: ""
+
+ PropertyAnimation {
+ property: "scale"
+ duration: 160
+ easing.type: Easing.InOutQuad
+ }
+ }
+ ]
+
+ Rectangle {
+ id: backgroundRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.gray1
+ }
+
+ Rectangle {
+ id: focusRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.transparent
+ border.width: Math.round(3 * dp)
+ border.color: colors.green1
+
+ visible: imageButton.activeFocus
+ }
+
+ Image {
+ id: image
+
+ anchors.fill: parent
+ anchors.margins: 20 * dp
+
+ height: width
+
+ visible: status === Image.Ready
+ opacity: status === Image.Ready ? 1 : 0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 1000
+ }
+ }
+
+ fillMode: Image.PreserveAspectCrop
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml b/ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml
new file mode 100644
index 0000000..5e1967f
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** 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 "../../scripts/datamodels.js" as DataModels
+import "../../controls"
+
+OverlayItem {
+ id: imagePreviewOverlay
+
+ property int currentIndex: -1
+ property alias model: listView.model
+
+ onCurrentIndexChanged: {
+ listView.positionViewAtIndex(currentIndex, ListView.Center)
+ listView.currentIndex = currentIndex
+ }
+
+ Rectangle {
+ anchors.fill: parent
+
+ color: colors.gray2
+ }
+
+ ListView {
+ id: listView
+
+ anchors.fill: parent
+
+ focus: true
+
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapToItem
+ boundsBehavior: Flickable.StopAtBounds
+ highlightMoveDuration: 300
+ cacheBuffer: width * 2
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: width
+
+ delegate: Item {
+ width: listView.width
+ height: listView.height
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select) {
+ imagePreviewOverlay.close()
+ }
+ }
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ mode: manualFocusMode
+
+ onSwipedLeft: {
+ listView.decrementCurrentIndex()
+ }
+
+ onSwipedRight: {
+ listView.incrementCurrentIndex()
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ imagePreviewOverlay.close()
+ }
+ }
+
+ BusyIndicator {
+ id: busyIndicator
+
+ anchors.centerIn: parent
+
+ visible: image.status !== Image.Ready
+ }
+
+ Rectangle {
+ anchors.fill: image
+ anchors.margins: -8 * dp
+
+ radius: 8 * dp
+ color: colors.white2
+
+ visible: image.status === Image.Ready
+ }
+
+ Image {
+ id: image
+
+ anchors.centerIn: parent
+
+ property real aspectRatio: sourceSize.width / sourceSize.height
+ width: parent.width * 0.8
+ height: width / aspectRatio
+
+ source: DataModels.posterPathURL(modelData, 1000)
+ }
+ }
+ }
+
+ Item {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ // distance between bottom side of the image and bottom side of the screen
+ height: (parent.height - (parent.width * 0.8 / 1.78)) / 2
+
+ PageIndicator {
+ anchors.centerIn: parent
+
+ count: listView.count
+ currentIndex: listView.currentIndex
+ }
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/MovieCatalogButton.qml b/ui/qml/screens/MoviesControls/MovieCatalogButton.qml
new file mode 100644
index 0000000..5438448
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/MovieCatalogButton.qml
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+
+AbstractButton {
+ id: movieCatalogButton
+
+ implicitWidth: 100 * dp
+ implicitHeight: 100 * dp
+
+ property alias thumbnailSource: thumbnail.source
+ property alias text: label.text
+
+ states: [
+ State {
+ name: ""
+
+ PropertyChanges {
+ target: movieCatalogButton
+ scale: 1
+ }
+ },
+ State {
+ name: "selected"
+ when: movieCatalogButton.activeFocus
+
+ PropertyChanges {
+ target: movieCatalogButton
+ scale: 1.07
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "selected"
+ to: ""
+
+ PropertyAnimation {
+ property: "scale"
+ duration: 160
+ easing.type: Easing.InOutQuad
+ }
+ }
+ ]
+
+ Rectangle {
+ id: backgroundRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.gray1
+ }
+
+ Rectangle {
+ id: focusRectangle
+
+ anchors.fill: parent
+
+ radius: Math.round(8 * dp)
+
+ color: colors.transparent
+ border.width: Math.round(3 * dp)
+ border.color: colors.green1
+
+ visible: movieCatalogButton.activeFocus
+ }
+
+ Image {
+ id: thumbnail
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 20 * dp
+
+ height: width
+
+ visible: status === Image.Ready
+ opacity: status === Image.Ready ? 1 : 0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 1000
+ }
+ }
+
+ fillMode: Image.PreserveAspectCrop
+ }
+
+ Label {
+ id: label
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: thumbnail.bottom
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: 20 * dp
+ anchors.rightMargin: 20 * dp
+ anchors.topMargin: 10 * dp
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignTop
+ wrapMode: Text.Wrap
+ maximumLineCount: 2
+
+ font.family: fonts.titillium
+ font.pixelSize: height / 4
+ font.bold: true
+
+ color: movieCatalogButton.activeFocus ? colors.green1
+ : colors.white2
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/MovieCatalogView.qml b/ui/qml/screens/MoviesControls/MovieCatalogView.qml
new file mode 100644
index 0000000..f2b2c66
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/MovieCatalogView.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+import "../../scripts/datamodels.js" as DataModels
+
+ListView {
+ id: movieCatalogView
+
+ property alias title: titleLabel.text
+
+ property int itemsOnScreen: 7
+ property real delegateSizeAspectRatio: 0.7
+ spacing: 30 * dp
+ property int spacesOnScreen: Math.max(itemsOnScreen - 1, 0)
+ property real delegateWidth: spacesOnScreen > 0 ? width / itemsOnScreen - spacing * spacesOnScreen / itemsOnScreen
+ : 200 * dp
+ property real delegateHeight: delegateWidth / delegateSizeAspectRatio
+ property int firstVisibleItemIndex: Math.round(Math.abs(contentX / (delegateWidth + spacing)))
+
+ height: customHeaderItem.height + delegateHeight
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapToItem
+ boundsBehavior: Flickable.StopAtBounds
+ highlightMoveDuration: 200
+ displayMarginBeginning: delegateWidth
+ displayMarginEnd: delegateWidth
+
+ signal clicked()
+ signal swipedLeft()
+ signal swipedRight()
+ signal swipedUp()
+ signal swipedDown()
+
+ Item {
+ id: customHeaderItem
+
+ height: 80 * dp
+
+ Label {
+ id: titleLabel
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 10 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+ }
+ }
+
+ delegate: MovieCatalogButton {
+ anchors.bottom: movieCatalogView.contentItem.bottom
+
+ width: movieCatalogView.delegateWidth
+ height: movieCatalogView.delegateHeight
+
+ thumbnailSource: DataModels.posterPathURL(model.poster_path, 92)
+ text: model.title ? model.title : ""
+
+ onPressedChanged: {
+ if (pressed) {
+ movieCatalogView.currentIndex = index
+ }
+ }
+
+ onClicked: movieCatalogView.clicked()
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ mode: manualFocusMode
+
+ onSwipedLeft: {
+ movieCatalogView.swipedLeft()
+ }
+
+ onSwipedRight: {
+ movieCatalogView.swipedRight()
+ }
+
+ onSwipedUp: {
+ movieCatalogView.swipedUp()
+ }
+
+ onSwipedDown: {
+ movieCatalogView.swipedDown()
+ }
+ }
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/MovieImagesView.qml b/ui/qml/screens/MoviesControls/MovieImagesView.qml
new file mode 100644
index 0000000..daccfd0
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/MovieImagesView.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+import "../../scripts/datamodels.js" as DataModels
+
+ListView {
+ id: movieImagesView
+
+ property int itemsOnScreen: 5
+ property real delegateSizeAspectRatio: 1.4
+ spacing: 30 * dp
+ property int spacesOnScreen: Math.max(itemsOnScreen - 1, 0)
+ property real delegateWidth: spacesOnScreen > 0 ? width / itemsOnScreen - spacing * spacesOnScreen / itemsOnScreen
+ : 200 * dp
+ property real delegateHeight: delegateWidth / delegateSizeAspectRatio
+ property int firstVisibleItemIndex: Math.round(Math.abs(contentX / (delegateWidth + spacing)))
+
+ signal clicked()
+ signal swipedLeft()
+ signal swipedRight()
+ signal swipedUp()
+ signal swipedDown()
+
+ height: delegateHeight
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapToItem
+ boundsBehavior: Flickable.StopAtBounds
+ highlightMoveDuration: 200
+ displayMarginBeginning: delegateWidth
+ displayMarginEnd: delegateWidth
+
+ delegate: ImageButton {
+ width: movieImagesView.delegateWidth
+ height: movieImagesView.delegateHeight
+
+ imageSource: DataModels.posterPathURL(modelData, 300)
+
+ onClicked: {
+ movieImagesView.currentIndex = index
+ movieImagesView.clicked()
+ }
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ mode: manualFocusMode
+
+ onSwipedLeft: {
+ movieImagesView.swipedLeft()
+ }
+
+ onSwipedRight: {
+ movieImagesView.swipedRight()
+ }
+
+ onSwipedUp: {
+ movieImagesView.swipedUp()
+ }
+
+ onSwipedDown: {
+ movieImagesView.swipedDown()
+ }
+ }
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/MoviePoster.qml b/ui/qml/screens/MoviesControls/MoviePoster.qml
new file mode 100644
index 0000000..aad6065
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/MoviePoster.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+
+Item {
+ id: moviePoster
+
+ property string source: ""
+
+ Rectangle {
+ id: backgroundRectangle
+
+ anchors.fill: parent
+
+ color: colors.gray1
+ }
+
+ Label {
+ anchors.fill: parent
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ visible: moviePoster.source === ""
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+
+ text: qsTr("No poster found")
+ }
+
+ Image {
+ id: image
+
+ anchors.fill: parent
+
+ source: moviePoster.source
+
+ onStatusChanged: {
+ if (status === Image.Ready) {
+ animation.restart()
+ }
+ }
+
+ NumberAnimation {
+ id: animation
+
+ target: image
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ easing.type: Easing.InSine
+ }
+ }
+}
diff --git a/ui/qml/screens/MoviesControls/WebViewOverlay.qml b/ui/qml/screens/MoviesControls/WebViewOverlay.qml
new file mode 100644
index 0000000..ac63af9
--- /dev/null
+++ b/ui/qml/screens/MoviesControls/WebViewOverlay.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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 "../../controls"
+
+OverlayItem {
+ id: webBrowserOverlay
+
+ property alias url: webView.url
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Enter ||
+ event.key === Qt.Key_Return ||
+ event.key === Qt.Key_Select) {
+ close()
+ }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+
+ color: colors.gray2
+ }
+
+ Rectangle {
+ anchors.fill: webView
+ anchors.margins: -8 * dp
+
+ radius: 8 * dp
+ color: colors.white2
+ }
+
+ WebView {
+ id: webView
+
+ anchors.centerIn: parent
+
+ width: parent.width * 0.8
+ height: parent.height * 0.8
+
+ focus: true
+ }
+}
diff --git a/ui/qml/screens/MoviesScreen.qml b/ui/qml/screens/MoviesScreen.qml
new file mode 100644
index 0000000..fa12de2
--- /dev/null
+++ b/ui/qml/screens/MoviesScreen.qml
@@ -0,0 +1,379 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+import "../scripts/datamodels.js" as DataModels
+import "../controls"
+import "../components"
+import "MoviesControls"
+
+BaseScreen {
+ id: moviesScreen
+
+ QtObject {
+ id: selectedMovie
+
+ property string movieId
+ property string title
+ property string synopsis
+ property string imageUrl
+ property string releaseYear
+
+ function update(data) {
+ if (data) {
+ selectedMovie.title = data.title ? data.title : ""
+ selectedMovie.imageUrl = data.poster_path ? DataModels.posterPathURL(data.poster_path, 500) : ""
+ selectedMovie.releaseYear = data.release_date ? new Date(data.release_date).getFullYear() : ""
+ selectedMovie.movieId = data.id
+ }
+ }
+ }
+
+ ToolBar {
+ id: toolBar
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ height: 170 * dp
+
+ focus: true
+
+ RoundButton {
+ id: backButton
+
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 40 * dp
+
+ focus: true
+
+ icon: "\uf060"
+
+ KeyNavigation.right: searchInputField
+ KeyNavigation.down: if (catalogsListView.visible && catalogsListView.count > 0) {
+ catalogsListView
+ } else if (searchCatalogView.visible && searchCatalogView.count > 0) {
+ searchCatalogView
+ } else {
+ null
+ }
+
+ onClicked: {
+ stackView.pop()
+ }
+ }
+
+ TextInputField {
+ id: searchInputField
+
+ anchors.left: backButton.right
+ anchors.right: clearButton.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 50 * dp
+ anchors.rightMargin: 50 * dp
+
+ placeholderText: qsTr("Search")
+
+ KeyNavigation.left: backButton
+ KeyNavigation.right: clearButton
+ KeyNavigation.down: if (catalogsListView.visible && catalogsListView.count > 0) {
+ catalogsListView
+ } else if (searchCatalogView.visible && searchCatalogView.count > 0) {
+ searchCatalogView
+ } else {
+ null
+ }
+
+ Timer {
+ id: searchInputTimer
+
+ interval: 2000
+ running: searchInputField.acceptingInput
+ repeat: true
+ triggeredOnStart: true
+
+ onTriggered: {
+ searchModel.source = DataModels.formatQuery("search/movie", { "query" : searchInputField.text })
+ }
+ }
+ }
+
+ TextButton {
+ id: clearButton
+
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.rightMargin: 40 * dp
+
+ text: qsTr("Clear")
+
+ KeyNavigation.left: searchInputField
+ KeyNavigation.down: if (catalogsListView.visible && catalogsListView.count > 0) {
+ catalogsListView
+ } else if (searchCatalogView.visible && searchCatalogView.count > 0) {
+ searchCatalogView
+ } else {
+ null
+ }
+
+ onClicked: {
+ searchInputField.text = ""
+ }
+ }
+ }
+
+ MovieCatalogView {
+ id: searchCatalogView
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 40 * dp
+ anchors.bottomMargin: 40 * dp
+
+ visible: searchInputField.text !== ""
+
+ displayMarginBeginning: anchors.leftMargin
+ displayMarginEnd: anchors.rightMargin
+
+ title: qsTr("Search Results")
+ model: searchModel
+
+ onCurrentIndexChanged: {
+ var data = model.get(currentIndex)
+ selectedMovie.update(data)
+ }
+
+ onClicked: {
+ stackView.push({
+ item: Qt.resolvedUrl("qrc:/qml/screens/MovieDetailsScreen.qml"),
+ properties: {
+ "selectedMovie" : selectedMovie
+ }
+ })
+ }
+
+ KeyNavigation.up: toolBar
+ KeyNavigation.priority: KeyNavigation.BeforeItem
+ }
+
+ Item {
+ id: catalogsListViewArea
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 30 * dp
+
+ layer.enabled: true
+ layer.samplerName: "source"
+ layer.effect: VerticalDissolveEffect {
+ length: 150 * dp
+ sourceHeight: catalogsListViewArea.height
+ }
+
+ ListView {
+ id: catalogsListView
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 40 * dp
+ anchors.topMargin: 20 * dp
+ anchors.bottomMargin: 80 * dp
+
+ visible: searchInputField.text === ""
+
+ orientation: ListView.Vertical
+ snapMode: ListView.SnapToItem
+ boundsBehavior: Flickable.StopAtBounds
+ highlightMoveDuration: 200
+ cacheBuffer: currentItem ? (currentItem.height * count - height)
+ : 0
+ displayMarginBeginning: currentItem ? currentItem.delegateHeight : 0
+ displayMarginEnd: currentItem ? currentItem.delegateHeight : 0
+
+ readonly property real delegateWidth: currentItem ? currentItem.width : 0
+ readonly property real delegateHeight: currentItem ? currentItem.height : 0
+ function item(index) {
+ return itemAt(delegateWidth / 2, delegateHeight * (index + 1) + spacing * index - delegateHeight / 2)
+ }
+
+ onActiveFocusChanged: {
+ if (activeFocus) {
+ var data = currentItem.model.get(currentItem.currentIndex)
+ selectedMovie.update(data)
+ }
+ }
+
+ // different catalog is selected
+ onCurrentIndexChanged: {
+ if (activeFocus && currentItem !== null) {
+ var data = currentItem.model.get(currentItem.currentIndex)
+ selectedMovie.update(data)
+ }
+ }
+
+ model: ListModel {
+ // https://developers.themoviedb.org/3/movies
+ ListElement { titleText: QT_TR_NOOP("Popular"); query: "movie/popular" }
+ ListElement { titleText: QT_TR_NOOP("Now Playing"); query: "movie/now_playing" }
+ ListElement { titleText: QT_TR_NOOP("Upcoming"); query: "movie/upcoming" }
+ ListElement { titleText: QT_TR_NOOP("Top Rated"); query: "movie/top_rated" }
+ // https://www.themoviedb.org/genres
+ ListElement { titleText: QT_TR_NOOP("Action"); query: "genre/28/movies" }
+ ListElement { titleText: QT_TR_NOOP("Adventure"); query: "genre/12/movies" }
+ ListElement { titleText: QT_TR_NOOP("Animation"); query: "genre/16/movies" }
+ ListElement { titleText: QT_TR_NOOP("Comedy"); query: "genre/35/movies" }
+ ListElement { titleText: QT_TR_NOOP("Crime"); query: "genre/80/movies" }
+ ListElement { titleText: QT_TR_NOOP("Documentary"); query: "genre/99/movies" }
+ ListElement { titleText: QT_TR_NOOP("Drama"); query: "genre/18/movies" }
+ ListElement { titleText: QT_TR_NOOP("Fantasy"); query: "genre/14/movies" }
+ ListElement { titleText: QT_TR_NOOP("History"); query: "genre/36/movies" }
+ ListElement { titleText: QT_TR_NOOP("Horror"); query: "genre/27/movies" }
+ ListElement { titleText: QT_TR_NOOP("Music"); query: "genre/10402/movies" }
+ ListElement { titleText: QT_TR_NOOP("Mystery"); query: "genre/9648/movies" }
+ ListElement { titleText: QT_TR_NOOP("Romance"); query: "genre/10749/movies" }
+ ListElement { titleText: QT_TR_NOOP("Science Fiction"); query: "genre/878/movies" }
+ ListElement { titleText: QT_TR_NOOP("TV Movie"); query: "genre/10770/movies" }
+ ListElement { titleText: QT_TR_NOOP("Thriller"); query: "genre/53/movies" }
+ ListElement { titleText: QT_TR_NOOP("War"); query: "genre/10752/movies" }
+ ListElement { titleText: QT_TR_NOOP("Western"); query: "genre/37/movies" }
+ }
+
+ function moveFocusUp() {
+ var screenFocusIndex = currentItem.currentIndex - currentItem.firstVisibleItemIndex
+ var previousCatalog = item(currentIndex - 1)
+ previousCatalog.currentIndex = previousCatalog.firstVisibleItemIndex + screenFocusIndex
+ decrementCurrentIndex()
+ }
+
+ function moveFocusDown() {
+ var screenFocusIndex = currentItem.currentIndex - currentItem.firstVisibleItemIndex
+ var nextCatalog = item(currentIndex + 1)
+ nextCatalog.currentIndex = nextCatalog.firstVisibleItemIndex + screenFocusIndex
+ incrementCurrentIndex()
+ }
+
+ KeyNavigation.up: toolBar
+ Keys.onPressed: {
+ var screenFocusIndex
+
+ switch (event.key) {
+ case Qt.Key_Up:
+ if (currentIndex > 0) {
+ moveFocusUp()
+ event.accepted = true
+ }
+ break
+ case Qt.Key_Down:
+ if (currentIndex < count - 1) {
+ moveFocusDown()
+ event.accepted = true
+ }
+ break
+ }
+ }
+
+ delegate: MovieCatalogView {
+ id: movieCatalogView
+
+ anchors.left: catalogsListView.contentItem.left
+ anchors.right: catalogsListView.contentItem.right
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 40 * dp
+
+ title: titleText
+
+ model: JSONListModel {
+ arrayPropertyName: "results"
+ source: DataModels.formatQuery(query)
+ }
+
+ // different movie is selected
+ onCurrentIndexChanged: {
+ if (activeFocus && currentItem !== null) {
+ var data = model.get(currentIndex)
+ selectedMovie.update(data)
+ }
+ }
+
+ onClicked: {
+ catalogsListView.currentIndex = index
+
+ stackView.push({
+ item: Qt.resolvedUrl("qrc:/qml/screens/MovieDetailsScreen.qml"),
+ properties: {
+ "selectedMovie" : selectedMovie
+ }
+ })
+ }
+
+ onSwipedLeft: {
+ movieCatalogView.decrementCurrentIndex()
+ }
+
+ onSwipedRight: {
+ movieCatalogView.incrementCurrentIndex()
+ }
+
+ onSwipedUp: {
+ if (catalogsListView.currentIndex > 0) {
+ catalogsListView.moveFocusUp()
+ } else {
+ var item = catalogsListView.KeyNavigation.up
+ if (item && item.enabled) {
+ item.forceActiveFocus()
+ }
+ }
+ }
+
+ onSwipedDown: {
+ if (catalogsListView.currentIndex < catalogsListView.count - 1) {
+ catalogsListView.moveFocusDown()
+ } else {
+ var item = catalogsListView.KeyNavigation.down
+ if (item && item.enabled) {
+ item.forceActiveFocus()
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JSONListModel {
+ id: searchModel
+
+ arrayPropertyName: "results"
+ }
+}
diff --git a/ui/qml/screens/SettingsScreen.qml b/ui/qml/screens/SettingsScreen.qml
new file mode 100644
index 0000000..c2d9d18
--- /dev/null
+++ b/ui/qml/screens/SettingsScreen.qml
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+import "../controls"
+
+BaseScreen {
+ id: settingsScreen
+
+ ToolBar {
+ id: toolBar
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ height: 170 * dp
+
+ focus: true
+
+ RoundButton {
+ id: backButton
+
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 40 * dp
+
+ focus: true
+
+ icon: "\uf060"
+
+ KeyNavigation.down: youTubeKeyInputField
+
+ onClicked: {
+ stackView.pop()
+ }
+ }
+
+ Label {
+ anchors.left: backButton.right
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 40 * dp
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 50 * dp
+ font.bold: true
+
+ text: qsTr("Settings")
+ }
+ }
+
+ Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.leftMargin: 40 * dp
+ anchors.rightMargin: 40 * dp
+
+ Label {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+
+ text: qsTr("YouTube Data Key")
+ }
+
+ VerticalSpacer {
+ height: 10 * dp
+ }
+
+ TextInputField {
+ id: youTubeKeyInputField
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ text: settings.youTubeKey
+
+ onTextChanged: {
+ settings.youTubeKey = text
+ }
+
+ KeyNavigation.up: backButton
+ KeyNavigation.down: tmbKeyInputField
+ }
+
+ VerticalSpacer {
+ height: 20 * dp
+ }
+
+ Label {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ color: colors.white2
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+
+ text: qsTr("TMDb API Key")
+ }
+
+ VerticalSpacer {
+ height: 10 * dp
+ }
+
+ TextInputField {
+ id: tmbKeyInputField
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ text: settings.tmdbKey
+
+ onTextChanged: {
+ settings.tmdbKey = text
+ }
+
+ KeyNavigation.up: youTubeKeyInputField
+ }
+ }
+}
diff --git a/ui/qml/screens/TrailerScreen.qml b/ui/qml/screens/TrailerScreen.qml
new file mode 100644
index 0000000..27ad8e2
--- /dev/null
+++ b/ui/qml/screens/TrailerScreen.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+import QtMultimedia 5.5
+import "../scripts/3rdparty/YoutubeClientV3.js" as YoutubeClient
+import "../controls"
+
+BaseScreen {
+ id: trailerScreen
+
+ property string movieTitle
+ property string movieId
+
+ function onFailure(error) {
+ busyIndicator.visible = false
+ errorLabel.text = error.details
+ }
+
+ function onVideoUrlObtained(url) {
+ videoPlayer.source = url
+ busyIndicator.visible = false
+ }
+
+ Component.onCompleted: {
+ YoutubeClient.getVideoUrl(movieId, onVideoUrlObtained, onFailure)
+ }
+
+ Rectangle {
+ anchors.fill: parent
+
+ color: colors.black
+ }
+
+ BusyIndicator {
+ id: busyIndicator
+
+ anchors.centerIn: parent
+ }
+
+ Label {
+ id: errorLabel
+
+ anchors.fill: parent
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ wrapMode: Text.Wrap
+
+ color: colors.white1
+ font.family: fonts.titillium
+ font.pixelSize: 30 * dp
+ font.bold: true
+ }
+
+ VideoPlayer {
+ id: videoPlayer
+
+ anchors.fill: parent
+
+ focus: true
+
+ onClosePressed: {
+ stackView.pop()
+ }
+ }
+}
diff --git a/ui/qml/screens/WebBrowserScreen.qml b/ui/qml/screens/WebBrowserScreen.qml
new file mode 100644
index 0000000..3bf8932
--- /dev/null
+++ b/ui/qml/screens/WebBrowserScreen.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** 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.Controls 1.4
+import "../controls"
+
+BaseScreen {
+ id: webBrowserScreen
+
+ property alias url: webView.url
+
+ ToolBar {
+ id: toolBar
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ height: 170 * dp
+
+ focus: true
+
+ RoundButton {
+ id: backButton
+
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 40 * dp
+
+ focus: true
+
+ icon: "\uf060"
+
+ KeyNavigation.right: urlInputField
+ KeyNavigation.down: webView
+
+ onClicked: {
+ stackView.pop()
+ }
+ }
+
+ UrlInputField {
+ id: urlInputField
+
+ anchors.left: backButton.right
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 50 * dp
+ anchors.rightMargin: 40 * dp
+
+ progress: webView.loadProgress / 100
+ loading: webView.loading
+
+ placeholderText: qsTr("Type URL")
+ text: webBrowserScreen.url
+
+ KeyNavigation.left: backButton
+ KeyNavigation.down: webView
+
+ onAcceptingInputChanged: {
+ if (!acceptingInput) {
+ var oldUrl = webBrowserScreen.url
+ webBrowserScreen.url = webUtils.fromUserInput(text)
+
+ if (oldUrl === webBrowserScreen.url) {
+ webView.reload()
+ }
+ }
+ }
+ }
+ }
+
+ FocusScope {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.bottom: parent.bottom
+
+ KeyNavigation.up: toolBar
+
+ WebView {
+ id: webView
+
+ anchors.fill: parent
+ focus: true
+
+ url: "https://youtube.com/"
+
+ property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod {
+ item: webView
+ }
+ }
+ }
+}
diff --git a/ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt b/ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt
new file mode 100644
index 0000000..b18ad22
--- /dev/null
+++ b/ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt
@@ -0,0 +1,26 @@
+Copyright (c) 2014 Peter Tworek
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+3. Neither the name of the author nor the names of any co-contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/ui/qml/scripts/3rdparty/YoutubeClientV3.js b/ui/qml/scripts/3rdparty/YoutubeClientV3.js
new file mode 100644
index 0000000..4ceb0f1
--- /dev/null
+++ b/ui/qml/scripts/3rdparty/YoutubeClientV3.js
@@ -0,0 +1,276 @@
+/*-
+ * Copyright (c) 2014 Peter Tworek
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+.pragma library
+
+var _youtube_data_v3_url = "https://www.googleapis.com/youtube/v3/";
+
+//Replace this line with your own key
+var youTubeDataKey = ""
+
+function getYoutubeV3Url(reference, queryParams)
+{
+ var locale = Qt.locale().name;
+ if (locale === "C") {
+ locale = "en_US";
+ }
+
+ var url = _youtube_data_v3_url + reference +
+ "?regionCode=" + regionCode +
+ "&key=" + youTubeDataKey +
+ "&hl=" + locale +
+ "&maxResults=" + 25
+
+ for (var key in queryParams) {
+ if (queryParams.hasOwnProperty(key)) {
+ url += "&" + key + "=" + queryParams[key];
+ }
+ }
+ return url;
+}
+
+function getVideoCategories(onSuccess, onFailure)
+{
+ var url = getYoutubeV3Url("videoCategories", {"part" : "snippet"});
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status == 200) {
+ var categories = JSON.parse(xhr.responseText)["items"];
+ onSuccess(categories);
+ } else {
+ var details = xhr.responseText ? JSON.parse(xhr.responseText) : undefined;
+ onFailure({"code" : xhr.status, "details" : details});
+ }
+ }
+ }
+ xhr.open("GET", url);
+ xhr.send();
+}
+
+function getVideosInCategory(categoryId, onSuccess, onFailure, pageToken)
+{
+ var qParams = {};
+
+ qParams["part"] = "snippet";
+ //qParams["maxResults"] = resultsPerPage;
+ qParams["chart"] = "mostPopular";
+ qParams["videoCategoryId"] = categoryId;
+
+ var url = getYoutubeV3Url("videos", qParams);
+
+ if (pageToken !== undefined) {
+ url += "&pageToken=" + pageToken;
+ }
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status == 200) {
+ onSuccess(JSON.parse(xhr.responseText));
+ } else {
+ var details = xhr.responseText ? JSON.parse(xhr.responseText) : "";
+ onFailure({"code" : xhr.status, "details" : details});
+ }
+ }
+ }
+ xhr.open("GET", url);
+ xhr.send();
+}
+
+function getVideosInPlaylist(playlistId, onSuccess, onFailure)
+{
+ var url = getYoutubeV3Url("playlistItems",{"part" : "snippet", "playlistId" : playlistId});
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status !== 200) {
+ var errDetails = xhr.responseText ? JSON.parse(xhr.responseText) : undefined;
+ onFailure({"code" : xhr.status, "details" : errDetails});
+ return;
+ }
+ var response = JSON.parse(xhr.responseText);
+ onSuccess(response);
+ }
+ }
+ xhr.open("GET", url);
+ xhr.send()
+}
+
+function getVideoDetails(videoId, onSuccess, onFailure)
+{
+ var url = getYoutubeV3Url("videos", {"part" : "contentDetails, snippet, statistics",
+ "id" : videoId});
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status !== 200) {
+ var errDetails = xhr.responseText ? JSON.parse(xhr.responseText) : undefined;
+ onFailure({"code" : xhr.status, "details" : errDetails});
+ return;
+ }
+ var details = JSON.parse(xhr.responseText);
+ onSuccess(details.items[0]);
+ }
+ }
+ xhr.open("GET", url);
+ xhr.send();
+}
+
+function getChannelDetails(channelId, onSuccess, onFailure)
+{
+ var url = getYoutubeV3Url("channels",
+ {"part" : "snippet,statistics,contentDetails", "id" : channelId});
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status !== 200) {
+ var errDetails = xhr.responseText ? JSON.parse(xhr.responseText) : undefined;
+ onFailure({"code" : xhr.status, "details" : errDetails});
+ return;
+ }
+ var response = JSON.parse(xhr.responseText);
+ onSuccess(response);
+ }
+ }
+ xhr.open("GET", url);
+ xhr.send();
+}
+
+function getSearchResults(query, onSuccess, onFailure, pageToken)
+{
+ var qParams = {};
+ qParams["q"] = query;
+ qParams["part"] = "snippet";
+ qParams["type"] = "video,channel";
+ qParams["safeSearch"] = "none";
+
+ if (pageToken) {
+ qParams["pageToken"] = pageToken;
+ }
+
+ var url = getYoutubeV3Url("search", qParams);
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ if (xhr.status !== 200) {
+ var details = xhr.responseText ? JSON.parse(xhr.responseText) : undefined;
+ onFailure({"code" : xhr.status, "details" : details});
+ return;
+ }
+ var response = JSON.parse(xhr.responseText);
+ onSuccess(response);
+ }
+ }
+ xhr.open("GET", url);
+ xhr.send();
+}
+
+function getVideoUrl(videoId, onSuccess, onFailure)
+{
+ var req = "https://www.youtube.com/get_video_info?video_id=" + videoId +
+ "&el=player_embedded&gl=US&hl=en&eurl=https://youtube.googleapis.com/v/&asf=3&sts=1588";
+ var availableSizes = [];
+
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (xhr.status !== 200) {
+ onFailure({"code" : xhr.status, "details" : JSON.parse(xhr.responseText)});
+ return;
+ }
+ var stream_map_str = undefined;
+ var tokens = xhr.responseText.split("&");
+ for (var i = 0; i < tokens.length; i++) {
+ var pair = tokens[i].split("=");
+ if (pair[0] === "url_encoded_fmt_stream_map") {
+ stream_map_str = decodeURIComponent(pair[1]);
+ break;
+ }
+ }
+
+ if (stream_map_str === undefined) {
+ onFailure({"code" : 0, "details" : "No video streams found!"});
+ return;
+ }
+
+ var stream_map_array = [];
+ tokens = stream_map_str.split(',');
+ for (var i = 0; i < tokens.length; i++) {
+ var map_elements = tokens[i].split('&');
+ var map = {};
+ for (var k = 0; k < map_elements.length; k++) {
+ var map_entry = map_elements[k].split('=');
+ if ( map_entry[0] == "itag" ) { // get sizes
+ availableSizes.push(map_entry[1])
+ }
+
+ if (map_entry[0] === 'url') {
+ map[map_entry[0]] = decodeURIComponent(map_entry[1]);
+ } else {
+ map[map_entry[0]] = map_entry[1];
+ }
+ }
+ stream_map_array[i] = map;
+ }
+
+ var selected_url = undefined;
+ for (var i = 0; i < stream_map_array.length; i++) {
+ var size = availableSizes.indexOf("22") !== -1 ? "22" : "18"
+ if (stream_map_array[i].itag === size) { // 22
+ if ("s" in stream_map_array[i]) {
+ onFailure({"code" : 0, "details" : "Encrypted signature detected, can't play video directly"});
+ return
+ } else if ("sig" in stream_map_array[i]) {
+ selected_url = stream_map_array[i].url +
+ "&signature=" + stream_map_array[i].sig;
+ } else {
+ selected_url = stream_map_array[i].url;
+ }
+
+ break;
+ }
+ }
+
+ if (selected_url === undefined) {
+ onFailure({"code" : 0, "details" : "No 360p video stream found!"});
+ return;
+ }
+
+ onSuccess(selected_url);
+ }
+ }
+ xhr.open("GET", req);
+ xhr.send();
+}
diff --git a/ui/qml/scripts/3rdparty/qt_attribution.json b/ui/qml/scripts/3rdparty/qt_attribution.json
new file mode 100644
index 0000000..593fb9e
--- /dev/null
+++ b/ui/qml/scripts/3rdparty/qt_attribution.json
@@ -0,0 +1,10 @@
+{
+ "Id": "youtubeclient",
+ "Name": "YoutubeClientV3",
+ "QDocModule": "-",
+ "QtUsage": "Used in set top box demo.",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "YoutubeClientV3-License.txt",
+ "Copyright": "Copyright (c) 2014 Peter Tworek"
+}
diff --git a/ui/qml/scripts/XMLHttpRequestCache.js b/ui/qml/scripts/XMLHttpRequestCache.js
new file mode 100644
index 0000000..5c204c1
--- /dev/null
+++ b/ui/qml/scripts/XMLHttpRequestCache.js
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** 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.
+**
+****************************************************************************/
+
+.pragma library
+
+var cache = []
diff --git a/ui/qml/scripts/datamodels.js b/ui/qml/scripts/datamodels.js
new file mode 100644
index 0000000..180359b
--- /dev/null
+++ b/ui/qml/scripts/datamodels.js
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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.
+**
+****************************************************************************/
+
+.pragma library
+
+var baseurl = "https://api.themoviedb.org/3/"
+var apiKey = ""
+
+function formatQuery(query, arguments) {
+ var result = "%1%2?api_key=%3".arg(baseurl).arg(query).arg(apiKey)
+
+ for (var key in arguments) {
+ result += "&%1=%2".arg(key).arg(arguments[key])
+ }
+
+ return result
+}
+
+function posterPathURL(posterPath, size) {
+ return posterPath ? "https://image.tmdb.org/t/p/w%1%2".arg(size).arg(posterPath) : ""
+}
diff --git a/ui/ui.pro b/ui/ui.pro
new file mode 100644
index 0000000..03bd320
--- /dev/null
+++ b/ui/ui.pro
@@ -0,0 +1,54 @@
+TEMPLATE = app
+QT += core gui qml quick network multimedia
+qtHaveModule(webengine): QT += webengine
+qtHaveModule(webview): QT += webview
+
+darwin: \
+ TARGET = "Qt TV"
+else: \
+ TARGET = qt-tv
+
+darwin: QMAKE_RPATHDIR += @loader_path/../Frameworks
+
+SOURCES += \
+ cpp/cuterectangle.cpp \
+ cpp/main.cpp \
+ cpp/processcontroller.cpp \
+ cpp/webutils.cpp
+
+HEADERS += \
+ cpp/cuterectangle.h \
+ cpp/processcontroller.h \
+ cpp/webutils.h
+
+RESOURCES += \
+ ../assets/assets.qrc \
+ ../assets/shared.qrc \
+ qml/qml.qrc
+
+exists(../secrets/TMDb.qml):exists(../secrets/YouTube.qml): \
+ RESOURCES += ../APIKeys.qrc
+
+macos: QMAKE_INFO_PLIST = Info.plist
+ios|tvos: QMAKE_INFO_PLIST = Info-ios.plist
+
+qtHaveModule(webkit):macos {
+ plugin_exe.files = "$$OUT_PWD/../plugin/qt-tv-npapi-host"
+ plugin_exe.path = Contents/Executables
+ QMAKE_BUNDLE_DATA += plugin_exe
+}
+
+darwin: \
+ target.path = /Applications
+else: \
+ target.path = /bin
+INSTALLS += target
+
+android {
+ DISTFILES += \
+ android/AndroidManifest.xml \
+ android/res/values/libs.xml \
+ android/build.gradle
+
+ ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
+}
diff --git a/ui/ui.qbs b/ui/ui.qbs
new file mode 100644
index 0000000..1779748
--- /dev/null
+++ b/ui/ui.qbs
@@ -0,0 +1,172 @@
+import qbs
+import qbs.File
+import qbs.FileInfo
+import qbs.Utilities
+
+Project {
+ AndroidApk {
+ condition: qbs.targetOS.contains("android")
+ name: "qt-tv"
+ packageName: "io.qt.stbdemo"
+ targetName: "qt-tv"
+ Depends {
+ productTypes: ["android.nativelibrary"]
+ limitToSubProject: true
+ }
+ }
+
+ QtGuiApplication {
+ Depends { name: "Android.ndk"; required: false }
+
+ Depends { name: "Qt.core"; versionAtLeast: project.minimumQtVersion }
+ Depends { name: "Qt"; submodules: ["gui", "qml", "quick", "network", "multimedia"] }
+ Depends { name: "openssl"; profiles: [] }
+
+ Depends { name: "Qt.webengine"; required: false }
+ Depends { name: "Qt.webview"; required: false }
+
+ Properties {
+ condition: qbs.targetOS.contains("android")
+ architectures: ["x86", "armv7"]
+ Android.ndk.appStl: "gnustl_shared"
+ }
+
+ architectures: undefined
+ cpp.minimumIosVersion: "8.0"
+ cpp.cxxLanguageVersion: "c++11"
+ cpp.rpaths: qbs.targetOS.contains("darwin") ? ["@loader_path/../Frameworks"] : undefined
+ bundle.isBundle: qbs.targetOS.contains("darwin")
+ targetName: bundle.isBundle ? "Qt TV" : "qt-tv"
+
+ files: [
+ "Info.plist",
+ ]
+
+ Group {
+ name: "C++"
+ prefix: "cpp/"
+ files: [
+ "main.cpp",
+ "processcontroller.cpp",
+ "processcontroller.h",
+ "cuterectangle.cpp",
+ "cuterectangle.h",
+ "webutils.cpp",
+ "webutils.h",
+ ]
+ }
+
+ Group {
+ name: "Resources"
+ files: [
+ "../assets/assets.qrc",
+ "../assets/shared.qrc",
+ ]
+ }
+
+ QMLGroup {
+ name: "API Keys"
+ condition: files.every(function (f) {
+ return File.exists(FileInfo.joinPaths(product.sourceDirectory, prefix, f));
+ })
+ prefix: "../secrets/"
+ files: [
+ "TMDb.qml",
+ "YouTube.qml"
+ ]
+
+ Qt.core.resourceSourceBase: "../secrets"
+ Qt.core.resourcePrefix: "/secrets"
+ }
+
+ QMLGroup {
+ name: "QML"
+ prefix: "qml/"
+ files: [
+ "main.qml",
+ ]
+ }
+
+ QMLGroup {
+ name: "QML - Components"
+ prefix: "qml/components/"
+ files: [
+ "Colors.qml",
+ "Fonts.qml",
+ "JSONListModel.qml",
+ "JSONQuery.qml",
+ "Settings.qml",
+ ]
+ }
+
+ QMLGroup {
+ name: "QML - Controls"
+ prefix: "qml/controls/"
+ files: [
+ "+webengine/WebView.qml",
+ "+webview/WebView.qml",
+ "AbstractButton.qml",
+ "ApplicationButton.qml",
+ "ApplicationWindow.qml",
+ "BaseScreen.qml",
+ "BusyIndicator.qml",
+ "InvalidSettingsOverlay.qml",
+ "Label.qml",
+ "NavigationStack.qml",
+ "RoundButton.qml",
+ "TextButton.qml",
+ "TextInputField.qml",
+ "VideoPlayer.qml",
+ "VerticalSpacer.qml",
+ "UrlInputField.qml",
+ "SeekSlider.qml",
+ "VideoPlayerButton.qml",
+ "HorizontalSpacer.qml",
+ "WebView.qml",
+ "VerticalDissolveEffect.qml",
+ "OverlayItem.qml",
+ "ToolBar.qml",
+ "PageIndicator.qml",
+ ]
+ }
+
+ QMLGroup {
+ name: "QML - Screens"
+ prefix: "qml/screens/"
+ files: [
+ "MainScreen.qml",
+ "MoviesControls/AnimatedText.qml",
+ "MoviesControls/BackgroundPoster.qml",
+ "MoviesControls/MovieCatalogButton.qml",
+ "MoviesControls/MoviePoster.qml",
+ "MoviesControls/ImageButton.qml",
+ "MoviesControls/MovieCatalogView.qml",
+ "MoviesControls/ImagePreviewOverlay.qml",
+ "MoviesControls/MovieImagesView.qml",
+ "MoviesControls/WebViewOverlay.qml",
+ "MoviesScreen.qml",
+ "SettingsScreen.qml",
+ "TrailerScreen.qml",
+ "WebBrowserScreen.qml",
+ "MovieDetailsScreen.qml",
+ ]
+ }
+
+ QMLGroup {
+ name: "Scripts"
+ prefix: "qml/scripts/"
+ files: [
+ "datamodels.js",
+ "3rdparty/YoutubeClientV3.js",
+ "XMLHttpRequestCache.js",
+ ]
+ }
+
+ Group {
+ fileTagsFilter: ["application", "aggregate_infoplist", "pkginfo"]
+ qbs.install: true
+ qbs.installDir: bundle.isBundle ? "Applications" : "bin"
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+}