[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:23:19 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=1804a91

The following commit has been merged in the master branch:
commit 1804a912d646ebb7cf2cb016f569ae3c9b02a1be
Author: Lasath Fernando <kde at lasath.org>
Date:   Wed Aug 8 17:07:12 2012 +1000

    Implementt Youtube Filter
    
    Currently, it embeds it using HTML5. This won't work with the chat
    plasmoid, but it appears to ignore it gracefully, so I'll let it be.
    
    And besides, I think it's better that way, because giving a preview
    of a video that you can't play would probably only strive to anger
    users.
    
    Conflicts:
    	filters/CMakeLists.txt
    	tests/message-processor-basic-tests.cpp
    	tests/message-processor-basic-tests.h
---
 filters/CMakeLists.txt                             |  1 +
 filters/youtube/CMakeLists.txt                     | 26 +++++++++
 .../ktptextui_message_filter_youtube.desktop       | 15 +++++
 filters/youtube/youtube-filter.cpp                 | 64 ++++++++++++++++++++++
 .../youtube/youtube-filter.h                       | 18 +++---
 5 files changed, 116 insertions(+), 8 deletions(-)

diff --git a/filters/CMakeLists.txt b/filters/CMakeLists.txt
index 2f88157..77155e0 100644
--- a/filters/CMakeLists.txt
+++ b/filters/CMakeLists.txt
@@ -15,3 +15,4 @@ if(HAS_KTTS)
 endif(HAS_KTTS)
 
 macro_log_feature(HAS_KTTS "KTTSD" "KDE Text to Speech Deamon" "" FALSE "" "Needed for optional tts message plugin")
+add_subdirectory(youtube)
diff --git a/filters/youtube/CMakeLists.txt b/filters/youtube/CMakeLists.txt
new file mode 100644
index 0000000..69f73ec
--- /dev/null
+++ b/filters/youtube/CMakeLists.txt
@@ -0,0 +1,26 @@
+set (ktptextui_message_filter_youtube_SRCS
+     youtube-filter.cpp
+)
+
+kde4_add_plugin (ktptextui_message_filter_youtube
+                 ${ktptextui_message_filter_youtube_SRCS}
+)
+
+target_link_libraries (ktptextui_message_filter_youtube
+    ktpchat
+    ${QT_LIBRARIES}
+    ${KDE4_KDEUI_LIBS}
+    ${KDE4_KIO_LIBS}
+    ${TELEPATHY_QT4_LIBRARIES}
+    ${KDE4_KEMOTICONS_LIBS}
+)
+
+# Install:
+install (TARGETS ktptextui_message_filter_youtube
+         DESTINATION ${PLUGIN_INSTALL_DIR}
+)
+
+install (FILES ktptextui_message_filter_youtube.desktop
+         DESTINATION ${SERVICES_INSTALL_DIR}
+)
+
diff --git a/filters/youtube/ktptextui_message_filter_youtube.desktop b/filters/youtube/ktptextui_message_filter_youtube.desktop
new file mode 100644
index 0000000..b2ed0d9
--- /dev/null
+++ b/filters/youtube/ktptextui_message_filter_youtube.desktop
@@ -0,0 +1,15 @@
+[Desktop Entry]
+Name=Youtube Preview
+Comment=If any messages contains a link to a youtube video, it'll embedd a preivew in the chat
+Encoding=UTF-8
+Type=Service
+ServiceTypes=KTpTextUi/MessageFilter
+
+X-KDE-Library=ktptextui_message_filter_youtube
+X-KDE-PluginInfo-Author=Lasath Fernando
+X-KDE-PluginInfo-Email=kde at lasath.org
+X-KDE-PluginInfo-Name=youtube
+X-KDE-PluginInfo-Version=0.4
+X-KDE-PluginInfo-Website=http://community.kde.org/Real-Time_Communication_and_Collaboration
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
diff --git a/filters/youtube/youtube-filter.cpp b/filters/youtube/youtube-filter.cpp
new file mode 100644
index 0000000..43af3ba
--- /dev/null
+++ b/filters/youtube/youtube-filter.cpp
@@ -0,0 +1,64 @@
+/*
+ *    Copyright (C) 2012  Lasath Fernando <kde at lasath.org>
+ *
+ *    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) any later version.
+ *
+ *    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, write to the Free Software
+ *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#include "youtube-filter.h"
+
+#include <KPluginFactory>
+#include <KDebug>
+#include <KUrl>
+#include <KUriFilter>
+
+class YoutubeFilter::Private
+{
+public:
+};
+
+YoutubeFilter::YoutubeFilter(QObject *parent, const QVariantList &) :
+    AbstractMessageFilter(parent), d(new Private)
+{
+}
+
+YoutubeFilter::~YoutubeFilter()
+{
+    delete d;
+}
+
+void YoutubeFilter::filterMessage(Message &message)
+{
+    QString html = QLatin1String(
+        "<iframe class=\"youtube-player\" "
+            "type=\"text/html\""
+            "style=\"max-width:100%;max-height:100%\""
+            "src=\"http://www.youtube.com/embed/%1\" "
+            "frameborder=\"0\">"
+        "</iframe>"
+    );
+
+    Q_FOREACH (QVariant var, message.property("Urls").toList()) {
+        KUrl url = qvariant_cast<KUrl>(var);
+        if (url.host() == QLatin1String("www.youtube.com")) {
+            kDebug() << "found youtube url :" << url.url();
+            kDebug() << "v =" << url.queryItemValue(QLatin1String("v"));
+
+            message.appendMessagePart(html.arg(url.queryItemValue(QLatin1String("v"))));
+        }
+    }
+}
+
+K_PLUGIN_FACTORY(MessageFilterFactory, registerPlugin<YoutubeFilter>();)
+K_EXPORT_PLUGIN(MessageFilterFactory("ktptextui_message_filter_youtube"))
diff --git a/config/messages-config.h b/filters/youtube/youtube-filter.h
similarity index 72%
copy from config/messages-config.h
copy to filters/youtube/youtube-filter.h
index f735443..0dadfed 100644
--- a/config/messages-config.h
+++ b/filters/youtube/youtube-filter.h
@@ -16,21 +16,23 @@
  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */
 
-#ifndef KCM_MESSAGES_H
-#define KCM_MESSAGES_H
+#ifndef YOUTUBE_FILTER_H
+#define YOUTUBE_FILTER_H
 
-#include <KSettings/PluginPage>
+#include <KTp/AbstractMessageFilter>
 
-class MessagesConfig : public KSettings::PluginPage
+class YoutubeFilter : public AbstractMessageFilter
 {
-Q_OBJECT
+    Q_OBJECT
 
 public:
-    explicit MessagesConfig(QWidget *parent = 0, const QVariantList &args = QVariantList());
+    YoutubeFilter(QObject *parent, const QVariantList &);
+    virtual ~YoutubeFilter();
+    virtual void filterMessage(Message &message);
 
 private:
     class Private;
-    Private* d;
+    Private *d;
 };
 
-#endif // KCM_MESSAGES_H
+#endif // YOUTUBE_FILTER_H

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list