Qt/QML App for Friendiqa
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NewsYplayer.qml 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // This file is part of Friendiqa
  2. // https://git.friendi.ca/lubuwest/Friendiqa
  3. // Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
  4. //
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // In addition, as a special exception, the copyright holders give
  11. // permission to link the code of portions of this program with the
  12. // OpenSSL library under certain conditions as described in each
  13. // individual source file, and distribute linked combinations including
  14. // the two.
  15. //
  16. // You must obey the GNU General Public License in all respects for all
  17. // of the code used other than OpenSSL. If you modify file(s) with this
  18. // exception, you may extend this exception to your version of the
  19. // file(s), but you are not obligated to do so. If you do not wish to do
  20. // so, delete this exception statement from your version. If you delete
  21. // this exception statement from all source files in the program, then
  22. // also delete it here.
  23. //
  24. // This program is distributed in the hope that it will be useful,
  25. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. // GNU General Public License for more details.
  28. //
  29. // You should have received a copy of the GNU General Public License
  30. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  31. import QtQuick 2.8
  32. import "qrc:/js/helper.js" as Helperjs
  33. //import QtWebView 1.1
  34. Rectangle{
  35. color:"transparent"
  36. width:newscolumn.width;
  37. height:newscolumn.width/4*3
  38. property string url:""//htmlview.text
  39. WebView {
  40. id: webView
  41. anchors.fill: parent
  42. opacity: 0
  43. url: "qrc:///content/player.html?" + currentVideo.vId
  44. Behavior on opacity { NumberAnimation { duration: 200 } }
  45. onLoadingChanged: {
  46. switch (loadRequest.status)
  47. {
  48. case WebView.LoadSucceededStatus:
  49. opacity = 1
  50. return
  51. case WebView.LoadStartedStatus:
  52. case WebView.LoadStoppedStatus:
  53. break
  54. case WebView.LoadFailedStatus:
  55. topInfo.text = "Failed to load the requested video"
  56. break
  57. }
  58. opacity = 0
  59. }
  60. onTitleChanged: {
  61. currentVideo.status = 1 * title
  62. if (title == videoStatus.paused || title == videoStatus.ready)
  63. panel.state = "list"
  64. else if (title == videoStatus.playing)
  65. panel.state = "hidden"
  66. }
  67. }
  68. Text{id:htmlview
  69. textFormat:Text.RichText
  70. }
  71. // WebView {id:htmlview;
  72. // anchors.fill: parent
  73. // }
  74. Component.onCompleted:{
  75. // Helperjs.friendicaWebRequest(url,parent,function(document){
  76. // print(document);
  77. //// var metas = document.getElementsByTagName('meta'); //get all the meta tag elements
  78. //// //iterate through them
  79. //// for (i=0; i<metas.length; i++) {
  80. //// if (metas[i].getAttribute("name") == "keywords") {
  81. //// print(metas[i].getAttribute("content"));
  82. //// }
  83. //// else if (metas[i].getAttribute("name") == "description") {
  84. //// console.log(metas[i].getAttribute("content"));
  85. //// }
  86. //// }
  87. // //print(html);
  88. // htmlview.text=""
  89. // })
  90. }
  91. }