diff --git a/icon.svg b/icons/vplayer.svg
similarity index 100%
rename from icon.svg
rename to icons/vplayer.svg
diff --git a/qml/AboutPage.qml b/qml/AboutPage.qml
index e437c18..996f256 100644
--- a/qml/AboutPage.qml
+++ b/qml/AboutPage.qml
@@ -21,96 +21,96 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Window 2.1
-
-import org.kde.kirigami 1.0 as Kirigami
+import QtQuick.Controls 2.0 as Controls
+import org.kde.kirigami 2.0 as Kirigami
Kirigami.ScrollablePage {
id: aboutPage
title: qsTr("About")
-
- Flickable {
- id: flick
- width:parent.width
- height: parent.height
- anchors.top: parent.top
- contentHeight: column1.height
-
- Column{
- id: column1
- width: parent.width
- spacing: 15
-
- Image{
- source: mainWindow.appIcon
- height: 128
- width: 128
- fillMode: Image.PreserveAspectFit
- anchors {
- horizontalCenter: parent.horizontalCenter
- }
+
+ Column {
+ width: parent.width
+ spacing: 15
+
+ Image {
+ source: mainWindow.appIcon
+ height: 128
+ width: 128
+ fillMode: Image.PreserveAspectFit
+
+ anchors {
+ horizontalCenter: parent.horizontalCenter
}
- Kirigami.Label {
- font.bold: true
- text: mainWindow.appName+" v"+mainWindow.version
- anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Kirigami.Heading {
+ text: mainWindow.appName+" v" + mainWindow.version
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Kirigami.Label {
+ text: qsTr("License: ") + "LGPLv2"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Rectangle {
+ height: 3
+ width: parent.width-64
- }
- Kirigami.Label {
- text: qsTr("License: LGPLv2")
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Rectangle{
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#333333" }
- GradientStop { position: 1.0; color: "#777777" }
- }
- anchors {
- horizontalCenter: parent.horizontalCenter
- }
- height: 3
- width: parent.width-64
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#333333" }
+ GradientStop { position: 1.0; color: "#777777" }
}
- Kirigami.Label {
- width: aboutPage.width
- font.bold: true
- text: qsTr("Copyright (c) 2014-2015 Leszek Lesner <leszek@zevenos.com>
Copyright (c) 2016 JBBGameich <jbb.mail@gmx.de>") // JBBgameich: I'm still not sure how I should write this text, maybe just "developed by Leszek Lesner, contributors: JBBgameich..."
- anchors.horizontalCenter: parent.horizontalCenter
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignHCenter
+ anchors {
+ horizontalCenter: parent.horizontalCenter
}
- Rectangle{
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#333333" }
- GradientStop { position: 1.0; color: "#777777" }
- }
- anchors {
- horizontalCenter: parent.horizontalCenter
- }
- height: 3
- width: parent.width-64
+ }
+
+ Kirigami.Label {
+ width: aboutPage.width
+ font.bold: true
+ text: qsTr("Copyright (c) 2014-2015 Leszek Lesner <leszek@zevenos.com>
Copyright (c) 2016 JBBGameich <jbb.mail@gmx.de>")
+ anchors.horizontalCenter: parent.horizontalCenter
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignHCenter
+ }
+
+ Rectangle {
+ height: 3
+ width: parent.width-64
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#333333" }
+ GradientStop { position: 1.0; color: "#777777" }
}
- Button {
- id: homepage
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Sourcecode on Github")
- onClicked: {
- Qt.openUrlExternally("https://github.com/llelectronics/videoPlayer/tree/plasma");
- }
+ anchors {
+ horizontalCenter: parent.horizontalCenter
}
-
- Kirigami.Label {
- width: parent.width-70
- text: qsTr("A simple videoplayer based on gstreamer.")
- anchors.horizontalCenter: parent.horizontalCenter
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignHCenter
- height: 200
- wrapMode: Text.WordWrap
+ }
+
+ Controls.ToolButton {
+ id: homepage
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Sourcecode on Github")
+ onClicked: {
+ Qt.openUrlExternally("https://github.com/llelectronics/videoPlayer/tree/plasma");
}
}
+
+ Kirigami.Label {
+ width: parent.width-70
+ text: qsTr("A simple videoplayer based on gstreamer.")
+ anchors.horizontalCenter: parent.horizontalCenter
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignHCenter
+ }
+
+ Controls.Button {
+ text: qsTr("Close")
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: pageStack.replace(openDialogComponent)
+ }
}
}
diff --git a/qml/GlobalDrawer.qml b/qml/GlobalDrawer.qml
new file mode 100644
index 0000000..1f23e5f
--- /dev/null
+++ b/qml/GlobalDrawer.qml
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 JBBgameich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) version 3, or any
+ * later version accepted by the membership of KDE e.V. (or its
+ * successor approved by the membership of KDE e.V.), which shall
+ * act as a proxy defined in Section 6 of version 3 of the license.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+import org.kde.kirigami 2.0 as Kirigami
+
+Kirigami.GlobalDrawer {
+ title: "Video Player"
+ titleIcon: "vplayer"
+
+ drawerOpen: false
+ // show open button on the left side
+ handleVisible: true
+ modal: true
+
+ actions: [
+ Kirigami.Action {
+ text: qsTr("History")
+ iconName: "view-list-icons"
+ onTriggered: pageStack.replace(historyPageComponent)
+ },
+ Kirigami.Action {
+ text: qsTr("Youtube Search")
+ iconName: "smtube"
+ onTriggered: pageStack.replace(youtubeSearchComponent)
+ },
+ Kirigami.Action {
+ text: qsTr("Open File")
+ iconName: "document-open"
+ onTriggered: pageStack.replace(openDialogComponent)
+ },
+ Kirigami.Action {
+ text: qsTr("Open Url")
+ iconName: "applications-internet"
+ onTriggered: pageStack.replace(openUrlComponent)
+ },
+ Kirigami.Action {
+ text: qsTr("About Video Player")
+ iconName: "help-about"
+ onTriggered: pageStack.replace(aboutPageComponent)
+ }
+ ]
+}
+
diff --git a/qml/HistoryPage.qml b/qml/HistoryPage.qml
index b8eacf8..daf0320 100644
--- a/qml/HistoryPage.qml
+++ b/qml/HistoryPage.qml
@@ -21,33 +21,29 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.0
+import QtQuick.Controls 2.0
import QtQuick.Window 2.1
-
-import org.kde.kirigami 1.0 as Kirigami
+import org.kde.kirigami 2.0 as Kirigami
Kirigami.ScrollablePage {
id: historyPage
title: qsTr("History")
ListView {
- anchors.fill: historyPage
+ anchors.fill: parent
model: mainWindow.historyModel
+
delegate: Kirigami.BasicListItem {
- width: parent.width - (parent.width / 32)
- height: implicitHeight
- anchors.horizontalCenter: parent.horizontalCenter
- onClicked: {
- console.debug("Clicked " + htitle + " with url: " + hurl)
- mainWindow.loadPlayer(htitle,hurl)
- }
- Kirigami.Label {
- anchors.left: parent.left
- anchors.right: parent.right
- height: implicitHeight
+ width: parent.width
+ reserveSpaceForIcon: true
+
+ icon: "video-mp4"
+ label: htitle
- elide: Text.ElideRight
- text: htitle
+ onClicked: {
+ console.debug("Clicked " + htitle + " with url: " + hurl);
+ mainWindow.loadPlayer(htitle,hurl);
+ pageStack.pop(historyPage);
}
}
}
diff --git a/qml/OpenDialog.qml b/qml/OpenDialog.qml
index 3f1f742..1c272bb 100644
--- a/qml/OpenDialog.qml
+++ b/qml/OpenDialog.qml
@@ -21,14 +21,10 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.2
-import QtQuick.Window 2.1
+import org.kde.kirigami 2.0 as Kirigami
+import Qt.labs.folderlistmodel 2.2
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kirigami 1.0 as Kirigami
-import Qt.labs.folderlistmodel 2.1
-
-Kirigami.Page {
+Kirigami.ScrollablePage {
id: page
title: qsTr("Open File")
@@ -88,26 +84,11 @@ Kirigami.Page {
anchors.fill: parent
delegate: Kirigami.BasicListItem {
- id: delegate
width: parent.width
- enabled: true
-
- Column {
- width: parent.width
-
- Kirigami.Label {
- anchors.left: parent.left
- anchors.leftMargin: units.largeSpacing
- text: fileName + (fileIsDir ? "/" : "")
- }
+ reserveSpaceForIcon: true
- Kirigami.Label {
- visible: !fileIsDir
- anchors.left: parent.left
- text: fileSize + ", " + fileModified
- color: theme.linkColor
- }
- }
+ icon: (fileIsDir ? "folder" : "text-x-plain")
+ label: fileName + (fileIsDir ? "/" : "")
onClicked: {
if (fileIsDir) {
@@ -119,13 +100,5 @@ Kirigami.Page {
}
}
}
-
- PlasmaComponents.ScrollBar {
- id: scrollBar
- flickableItem: view
- anchors.right: parent.right
- width: parent.width / 64
- interactive: true
- }
}
}
diff --git a/qml/OpenUrl.qml b/qml/OpenUrl.qml
index bfc1f72..d1e9f96 100644
--- a/qml/OpenUrl.qml
+++ b/qml/OpenUrl.qml
@@ -21,15 +21,11 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.0
+import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.1
-
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.plasma.core 2.0
-import org.kde.plasma.extras 2.0
-import org.kde.kirigami 1.0 as Kirigami
+import org.kde.kirigami 2.0 as Kirigami
import Qt.labs.folderlistmodel 2.1
-
+import org.kde.plasma.core 2.0
Kirigami.Page {
id: page
@@ -39,49 +35,44 @@ Kirigami.Page {
mainWindow.loadPlayer("",path);
}
- PlasmaComponents.TextField {
- id: urlField
- clearButtonShown: true
- placeholderText: qsTr("Enter a streaming url starting with 'http://' or similar")
- width: parent.width / 1.15
- height: units.gridUnit * 2
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: header.bottom
- anchors.topMargin: units.largeSpacing
- }
-
- PlasmaComponents.ListItem {
- height: units.gridUnit * 2
- width: urlField.width
- anchors.margins: units.gridUnit
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: urlField.bottom
- enabled: true
+ Column {
+ anchors.fill: parent
+ spacing: 50
- IconItem {
- id: openIcon
- width: units.gridUnit * 2
- height: width
- source: "dialog-ok"
- anchors {
- verticalCenter: parent.verticalCenter
- left: parent.left
- margins: units.gridUnit
- rightMargin: 0
+ Controls.TextField {
+ id: urlField
+ placeholderText: qsTr("Enter a streaming url")
+ width: parent.width / 1.15
+ anchors.horizontalCenter: parent.horizontalCenter
+ selectByMouse: true
+
+ Controls.ToolButton {
+ height: parent.height
+ width: clearIcon. width
+ anchors.right: parent.right
+
+ visible: urlField.length > 0
+
+ IconItem {
+ id: clearIcon
+ source: "edit-clear"
+ height: parent.height
+ }
+
+ onClicked: urlField.text = "";
}
}
-
- Heading {
- id: openLbl
- text: qsTr("Load Url")
- elide: Text.ElideRight
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.right
- level: 4
- }
-
- onClicked: {
- openUrl(urlField.text)
+
+ Controls.Button {
+ text: "Load URL"
+ enabled: urlField.length > 0
+ height: units.gridUnit * 3
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: units.gridUnit * 2
+
+ onClicked: {
+ openUrl(urlField.text)
+ }
}
}
}
diff --git a/qml/PlayerPage.qml b/qml/PlayerPage.qml
index d12634c..c6e349f 100644
--- a/qml/PlayerPage.qml
+++ b/qml/PlayerPage.qml
@@ -21,28 +21,33 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.2
+import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.1
-import QtMultimedia 5.0
+import QtMultimedia 5.7
+import org.kde.plasma.core 2.0
+import org.kde.kirigami 2.0 as Kirigami
+
import "helper/timeFormat.js" as TimeHelper
import "helper/db.js" as DB
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.plasma.core 2.0
-import org.kde.kirigami 1.0 as Kirigami
-
Kirigami.Page {
- implicitWidth: 2000 // This number is just the with of this page until it will be tiled.
+ implicitWidth: 5000
leftPadding: 0
rightPadding: 0
bottomPadding: 0
topPadding: 0
+ title: {
+ if (title != "") return title
+ else if (streamTitle != "") return streamTitle
+ else return streamUrl
+ }
+
Component.onCompleted: {
// Automaticly start playing
videoWindow.play();
}
-
+
onStreamUrlChanged: {
// TODO: maybe youtube or other url checks
videoWindow.source = streamUrl;
@@ -53,13 +58,8 @@ Kirigami.Page {
// Don't forgt to write it to the List aswell
mainWindow.add2History(streamUrl,videoPlayerPage.text);
}
-
+
id: videoPlayerPage
- title: {
- if (title != "") return title
- else if (streamTitle != "") return streamTitle
- else return streamUrl
- }
property string originalUrl: mainWindow.originalUrl
property string streamUrl: mainWindow.streamUrl
@@ -79,7 +79,7 @@ Kirigami.Page {
property bool autoplay: mainWindow.autoplay
actions {
- main: Action {
+ main: Kirigami.Action {
iconName: {
if (videoWindow.playbackState != MediaPlayer.PlayingState) return "media-playback-start"
else return "media-playback-pause"
@@ -90,15 +90,15 @@ Kirigami.Page {
}
shortcut: "Space"
}
- left: Action {
+ left: Kirigami.Action {
iconName: "view-fullscreen"
onTriggered: toggleControls()
}
- right: Action {
+ right: Kirigami.Action {
iconName: "media-playback-stop"
onTriggered: {
- applicationWindow().pageStack.pop;
videoWindow.stop();
+ pageStack.pop()
}
}
}
@@ -120,14 +120,13 @@ Kirigami.Page {
function showControls() {
timeLine.visible = true;
timeLineLbl.visible = true;
- // globalDrawer.opened = true;
- applicationWindow().controlsVisible = true;
+ controlsVisible = true;
}
function hideControls() {
timeLine.visible = false;
timeLineLbl.visible = false;
- globalDrawer.opened = false;
+ globalDrawer.drawerOpen = false;
applicationWindow().controlsVisible = false;
}
@@ -141,14 +140,19 @@ Kirigami.Page {
Video {
id: videoWindow
anchors.fill: parent
- onDurationChanged: timeLine.maximumValue = duration / 1000
+ onDurationChanged: timeLine.to = duration / 1000
onPositionChanged: timeLine.value = position / 1000
+
MouseArea {
anchors.fill: parent
onClicked: toggleControls()
}
- onStopped: showControls()
- }
+
+ onStopped: {
+ showControls()
+ pageStack.pop()
+ }
+ }
Kirigami.Label {
id: timeLineLbl
@@ -157,11 +161,9 @@ Kirigami.Page {
anchors.right: videoWindow.right
}
- Slider {
+ Controls.Slider {
id: timeLine
- minimumValue: 0
- value: 0
- stepSize: 1.0
+ from: 1
width: parent.width
onPressedChanged: {
if (!pressed) {
diff --git a/qml/YoutubeSearch.qml b/qml/YoutubeSearch.qml
index 2bc0cf5..69aea76 100644
--- a/qml/YoutubeSearch.qml
+++ b/qml/YoutubeSearch.qml
@@ -24,13 +24,11 @@ import QtWebKit 3.0
import QtWebKit.experimental 1.0
import QtMultimedia 5.0
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.plasma.core 2.0
-import org.kde.kirigami 1.0 as Kirigami
+import org.kde.kirigami 2.0 as Kirigami
import "helper/yt.js" as YT
-Kirigami.Page {
+Kirigami.ScrollablePage {
leftPadding: 0
rightPadding: 0
bottomPadding: 0
@@ -40,19 +38,17 @@ Kirigami.Page {
id: searchResultsDialog
property string searchTerm
property bool ytDetect: true
- property string websiteUrl: "http://m.youtube.com/"
- property string searchUrl: "http://m.youtube.com/results?q="
+ property string websiteUrl: "https://youtube.com/"
+ property string searchUrl: "https://m.youtube.com/results?q="
property string uA: "Mozilla/5.0 (Linux; U; Android 2.3; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
-
WebView {
id: ytView
- anchors.centerIn: parent
+ anchors.fill: parent
// Width and height for scale=2.0
// width: searchResultsDialog.orientation === Orientation.Portrait ? Screen.width / 2 : (Screen.height - 100) / 2
// height: Screen.height / 2
focus: true
- anchors.fill: parent
experimental.userAgent: uA
experimental.userScripts: [Qt.resolvedUrl("helper/userscript.js")]
@@ -78,30 +74,5 @@ Kirigami.Page {
}
Component.onCompleted: url = websiteUrl
-
-// Rectangle {
-// anchors.left: parent.left
-// anchors.bottom: parent.bottom
-// visible: ytView.canGoBack
-// width: parent.width / 8
-// height: parent.height / 16
-// gradient: Gradient {
-// GradientStop { position: 1.0; color: "black" }
-// GradientStop { position: 0.0; color: "transparent" } //Theme.highlightColor} // Black seems to look and work better
-// }
-// IconItem {
-// id: backBtn
-// source: "arrow-left"
-// enabled: ytView.canGoBack
-// visible: ytView.canGoBack
-// anchors.centerIn: parent
-// MouseArea {
-// anchors.fill: parent
-// onClicked: {
-// ytView.goBack();
-// }
-// }
-// }
-// }
}
}
diff --git a/qml/main.qml b/qml/main.qml
index c9d1e30..113edab 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -21,10 +21,9 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.0
+import QtQuick.Controls 2.0
import QtQuick.Window 2.1
-
-import org.kde.kirigami 1.0 as Kirigami
+import org.kde.kirigami 2.0 as Kirigami
import "helper/db.js" as DB
@@ -36,7 +35,7 @@ Kirigami.ApplicationWindow {
property string appIcon: "/usr/share/icons/hicolor/64x64/apps/vplayer.png" //TODO: use xdg somehow
property string appName: "LLs vPlayer"
- property string version: "0.2-plasma-mobile"
+ property string version: "0.2"
property alias historyModel: historyModel
// Settings /////////////////////////////////////////
@@ -65,61 +64,33 @@ Kirigami.ApplicationWindow {
//property string homePath // Use from C++ QStandardsPath
//property string videoPath
-
- globalDrawer: Kirigami.GlobalDrawer {
- title: "Video Player"
- titleIcon: "vplayer"
- actions: [
- Kirigami.Action {
- text: qsTr("History")
- iconName: "view-list-icons"
- onTriggered: applicationWindow().pageStack.replace(historyPageComponent)
- },
- Kirigami.Action {
- text: qsTr("Youtube Search")
- iconName: "smtube"
- onTriggered: applicationWindow().pageStack.replace(youtubeSearchComponent)
- },
- Kirigami.Action {
- text: qsTr("Open File")
- iconName: "document-open"
- onTriggered: applicationWindow().pageStack.replace(openDialogComponent)
- },
- Kirigami.Action {
- text: qsTr("Open Url")
- iconName: "applications-internet"
- onTriggered: applicationWindow().pageStack.replace(openUrlComponent)
- },
- Kirigami.Action {
- text: qsTr("About Video Player")
- iconName: "help-about"
- onTriggered: applicationWindow().pageStack.replace(aboutPageComponent)
- }
- ]
+
+ header: Kirigami.ApplicationHeader {
+ preferredHeight: Kirigami.Units.gridUnit * 2.25
}
-
+
+ globalDrawer: GlobalDrawer {}
+
contextDrawer: Kirigami.ContextDrawer {
id: contextDrawer
}
-
- pageStack.initialPage: openDialogComponent
// drawer components
Component {
id: historyPageComponent
HistoryPage {}
}
-
+
Component {
id: youtubeSearchComponent
YoutubeSearch {}
}
-
+
Component {
id: openDialogComponent
OpenDialog {}
}
-
+
Component {
id: openUrlComponent
OpenUrl {}
@@ -129,9 +100,9 @@ Kirigami.ApplicationWindow {
id: aboutPageComponent
AboutPage {}
}
-
+
// components not needed for the drawer
-
+
Component {
id: playerPageComponent
PlayerPage {}
@@ -147,7 +118,7 @@ Kirigami.ApplicationWindow {
function showPlayer() {
applicationWindow().pageStack.push(playerPageComponent);
}
-
+
function addHistory(url,title) {
//console.debug("Adding " + url + " with title " + title);
historyModel.append({"hurl": url, "htitle": title});
@@ -160,7 +131,7 @@ Kirigami.ApplicationWindow {
if (title == "" || title == undefined) title = url
historyModel.append({"hurl": url, "htitle": title});
}
-
+
ListModel {
id: historyModel
@@ -189,10 +160,11 @@ Kirigami.ApplicationWindow {
return;
}
}
-
+
Component.onCompleted: {
// Intitialize DB
DB.initialize();
DB.getHistory();
+ pageStack.push(openDialogComponent);
}
}