Message info
 
To:kde-commits@kde.org From:Sinny Kumari Subject:[plasma-mediacenter] /: Let backends specify toolbars to load Date:Sun, 18 Mar 2012 16:36:03 +0100 (CET)
 

Git commit 2c87ec728afa212c7a2d391c207b2ced5bac48a7 by Sinny Kumari.
Committed on 18/03/2012 at 16:35.
Pushed by sinnykumari into branch 'master'.

Let backends specify toolbars to load
Add licenses

A +20 -0 browsingbackends/flickr/CMakeLists.txt
A +52 -0 browsingbackends/flickr/flickrbackend.cpp [License: GPL (v2+)]
A +14 -0 browsingbackends/flickr/flickrbackend.desktop
A +40 -0 browsingbackends/flickr/flickrbackend.h [License: GPL (v2+)]
A +6 -0 browsingbackends/flickr/flickrcomponents/SearchToolbar.qml [License: UNKNOWN] *
A +1 -0 browsingbackends/flickr/flickrcomponents/qmldir
A +132 -0 browsingbackends/flickr/flickrinterface.cpp [License: GPL (v2+)]
A +77 -0 browsingbackends/flickr/flickrinterface.h [License: GPL (v2+)]
A +152 -0 browsingbackends/flickr/flickrmodel.cpp [License: GPL (v2+)]
A +68 -0 browsingbackends/flickr/flickrmodel.h [License: GPL (v2+)]
M +0 -1 components/CMakeLists.txt
M +19 -0 components/mediabrowser/MediaItemDelegate.qml
M +19 -0 components/mediabrowser/MediaItemDelegateLogic.js
M +19 -0 components/mediabrowser/MediaItemHighlight.qml
M +19 -0 components/mediacontroller/MediaController.qml
D +0 -5 components/mediainfobar/MediaInfoBar.qml
M +19 -0 components/mediaplayer/MediaPlayer.qml
M +19 -0 components/runtimedata/RuntimeData.qml
M +12 -0 libs/mediacenter/abstractbrowsingbackend.cpp
M +16 -3 libs/mediacenter/abstractbrowsingbackend.h
M +19 -0 libs/mediacenter/backendsmodel.cpp
M +19 -0 libs/mediacenter/backendsmodel.h
M +31 -4 shells/newshell/package/contents/ui/mediacenter.qml

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/plasma-mediacenter/2c87ec728afa212c7a2d391c207b2ced5bac48a7

diff --git a/browsingbackends/flickr/CMakeLists.txt b/browsingbackends/flickr/CMakeLists.txt
new file mode 100644
index 0000000..7f4dccb
--- /dev/null
+++ b/browsingbackends/flickr/CMakeLists.txt
@@ -0,0 +1,20 @@
+set(flickrbackend_SRCS
+ flickrmodel.cpp
+ flickrbackend.cpp
+)
+
+qt4_automoc(${flickrbackend_SRCS})
+
+kde4_add_plugin(pmc_flickrbackend ${flickrbackend_SRCS})
+
+target_link_libraries(pmc_flickrbackend
+ mediacenterlibs
+ ${KDE4_KDECORE_LIBS}
+ ${KDE4_KIO_LIBS}
+ ${QT_QTXML_LIBRARY}
+)
+
+install(TARGETS pmc_flickrbackend DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES flickrbackend.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+
+install(DIRECTORY flickrcomponents DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
diff --git a/browsingbackends/flickr/flickrbackend.cpp b/browsingbackends/flickr/flickrbackend.cpp
new file mode 100644
index 0000000..d851acc
--- /dev/null
+++ b/browsingbackends/flickr/flickrbackend.cpp
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * Copyright 2009 by Onur-Hayri Bakici <thehayro@gmail.com *
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+#include "flickrbackend.h"
+
+#include "flickrmodel.h"
+
+MEDIACENTER_EXPORT_BROWSINGBACKEND(FlickrBackend)
+
+FlickrBackend::FlickrBackend(QObject* parent, const QVariantList& args)
+ : MediaCenter::AbstractBrowsingBackend(parent, args)
+{
+
+}
+
+
+FlickrBackend::~FlickrBackend()
+{
+
+}
+
+void FlickrBackend::init()
+{
+ setModel(new FlickrModel(this));
+}
+
+bool FlickrBackend::goOneLevelUp()
+{
+ return MediaCenter::AbstractBrowsingBackend::goOneLevelUp();
+}
+
+QString FlickrBackend::bottomToolbar() const
+{
+ return constructQmlSource("flickrcomponents", "0.1", "SearchToolbar");
+}
diff --git a/browsingbackends/flickr/flickrbackend.desktop b/browsingbackends/flickr/flickrbackend.desktop
new file mode 100644
index 0000000..c5ca74a
--- /dev/null
+++ b/browsingbackends/flickr/flickrbackend.desktop
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Type=Service
+Icon=image-x-generic
+Name=Flickr
+
+X-KDE-ServiceTypes=Plasma/MediaCenter/BrowsingBackend
+
+X-KDE-PluginInfo-Author=Sinny Kumari
+X-KDE-PluginInfo-Email=ksinny@gmail.com
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Category=Service
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-Library=pmc_flickrbackend
diff --git a/browsingbackends/flickr/flickrbackend.h b/browsingbackends/flickr/flickrbackend.h
new file mode 100644
index 0000000..89c0edc
--- /dev/null
+++ b/browsingbackends/flickr/flickrbackend.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright 2009 by Onur-Hayri Bakici <thehayro@gmail.com *
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+#ifndef FLICKRBACKEND_H
+#define FLICKRBACKEND_H
+
+#include <libs/mediacenter/abstractbrowsingbackend.h>
+
+class FlickrBackend : public MediaCenter::AbstractBrowsingBackend
+{
+ Q_OBJECT
+public:
+ FlickrBackend (QObject* parent, const QVariantList& args);
+ virtual ~FlickrBackend();
+
+ virtual QString bottomToolbar() const;
+
+public Q_SLOTS:
+ virtual void init();
+ virtual bool goOneLevelUp();
+};
+
+#endif // FLICKRBACKEND_H
diff --git a/browsingbackends/flickr/flickrcomponents/SearchToolbar.qml b/browsingbackends/flickr/flickrcomponents/SearchToolbar.qml
new file mode 100644
index 0000000..7b88aae
--- /dev/null
+++ b/browsingbackends/flickr/flickrcomponents/SearchToolbar.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.1
+
+Text {
+ text: "Hello world"
+ color: "white"
+}
\ No newline at end of file
diff --git a/browsingbackends/flickr/flickrcomponents/qmldir b/browsingbackends/flickr/flickrcomponents/qmldir
new file mode 100644
index 0000000..e738bfb
--- /dev/null
+++ b/browsingbackends/flickr/flickrcomponents/qmldir
@@ -0,0 +1 @@
+SearchToolbar 0.1 SearchToolbar.qml
\ No newline at end of file
diff --git a/browsingbackends/flickr/flickrinterface.cpp b/browsingbackends/flickr/flickrinterface.cpp
new file mode 100644
index 0000000..f3cb87d
--- /dev/null
+++ b/browsingbackends/flickr/flickrinterface.cpp
@@ -0,0 +1,132 @@
+/***************************************************************************
+ * Copyright 2009 by Onur-Hayri Bakici <thehayro@gmail.com *
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+#include "flickrinterface.h"
+
+// QT
+#include <QDomDocument>
+#include <QDomNodeList>
+
+// KDE
+#include <kio/job.h>
+#include <KUrl>
+#include <KDebug>
+
+static const char* s_flickr_rest = "http://www.flickr.com/services/rest/";
+// Flickr API key for Flickr On Plasma
+static const char* s_apikey = "df52d83b7fe03f1de079da2c300f3203";
+//static const char* s_secret = "";
+
+
+FlickrInterface::FlickrInterface(QObject *parent) : QObject(parent)
+{
+}
+
+FlickrInterface::~FlickrInterface()
+{
+}
+
+void FlickrInterface::query(const QString &searchTerm)
+{
+ if ( searchTerm.isEmpty() )
+ return;
+
+ KUrl query(s_flickr_rest);
+ query.addQueryItem("method", "flickr.photos.search");
+ query.addQueryItem("api_key", s_apikey);
+ query.addQueryItem("text", searchTerm);
+
+ KIO::TransferJob *job = KIO::get(query, KIO::NoReload, KIO::HideProgressInfo);
+
+ m_queries[job] = searchTerm;
+ connect ( job, SIGNAL (data(KIO::Job*, const QByteArray &)), this,
+ SLOT(flickrDataReady(KIO::Job*, const QByteArray &)) );
+ connect ( job, SIGNAL( result(KJob*)), this, SLOT (parseResults(KJob*)) );
+}
+
+void FlickrInterface::flickrDataReady(KIO::Job *job, const QByteArray &data)
+{
+ if ( !m_queries.contains(job) )
+ return;
+
+ m_datas[job].append(data);
+
+ qDebug() << QString(data);
+}
+
+
+void FlickrInterface::parseResults(KJob *job)
+{
+ if ( !m_datas.contains(static_cast<KIO::Job*>(job) ) )
+ return;
+
+ listPhotos(job);
+
+}
+
+
+void FlickrInterface::listPhotos(KJob *job)
+{
+ QDomDocument document;
+ if (document.setContent(m_datas[static_cast<KIO::Job*>(job)]))
+ qDebug() << "Set Content Success";
+ else
+ qDebug() << "Set Content Fail";
+
+
+
+ QDomNodeList entries = document.elementsByTagName("photo");
+
+ QString title;
+ QString id;
+ QString owner;
+ QString secret;
+ QString farmID;
+ QString serverID;
+
+ for (int i = 0; i < entries.count(); i++)
+ {
+ QDomNamedNodeMap attr = entries.at(i).attributes();
+ title = attr.namedItem("title").toAttr().value();
+ id = attr.namedItem("id").toAttr().value();
+ owner = attr.namedItem("owner").toAttr().value();
+ secret = attr.namedItem("secret").toAttr().value();
+ farmID = attr.namedItem("farm").toAttr().value();
+ serverID = attr.namedItem("server").toAttr().value();
+
+ Plasma::DataEngine::Data photo;
+ photo["title"] = title;
+ photo["id"] = id;
+ photo["owner"] = owner;
+ photo["secret"] = secret;
+ photo["farmID"] = farmID;
+ photo["serverID"] = serverID;
+ // the "s" at the end stands for "small": 75x75 px
+ photo["link"] = QString("http://farm%1.static.flickr.com/%2/%3_%4_s.jpg")
+ .arg(farmID)
+ .arg(serverID)
+ .arg(id)
+ .arg(secret);
+ emit result(id, photo);
+ }
+
+ m_queries.remove( static_cast<KIO::Job*>(job) );
+ m_datas.remove( static_cast<KIO::Job*>(job) );
+}
diff --git a/browsingbackends/flickr/flickrinterface.h b/browsingbackends/flickr/flickrinterface.h
new file mode 100644
index 0000000..c92fb19
--- /dev/null
+++ b/browsingbackends/flickr/flickrinterface.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright 2009 by Onur-Hayri Bakici <thehayro@gmail.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+
+#ifndef FLICKRINTERFACE_H
+#define FLICKRINTERFACE_H
+
+#include <QObject>
+#include <Plasma/DataEngine>
+#include <QHash>
+
+namespace KIO {
+ class Job;
+}
+
+class QByteArray;
+class KJob;
+
+/**
+ * @class FlickrInterface
+ * @brief The interface that queries Flickr with searchTerms
+ * @author Onur-Hayri Bakici
+ *
+ * This class interfaces Flickr and returns result entries
+ * with the signal result.
+ */
+
+class FlickrInterface : public QObject
+{
+ Q_OBJECT
+
+public:
+ FlickrInterface(QObject *parent = 0);
+ ~FlickrInterface();
+
+ void query(const QString &searchTerm);
+
+
+
+signals:
+ /**
+ * @return the entry as Plasma::DataEnginge::Data
+ * each value can be retrieved by using the following key
+ * "title" for the title of the picture
+
+ * @param searchTerm ist the term to search for
+ */
+ void result(const QString &searchTerm, const Plasma::DataEngine::Data &image);
+protected slots:
+ void flickrDataReady(KIO::Job *job, const QByteArray &data);
+ void parseResults(KJob *job);
+
+private:
+ QHash<KIO::Job*, QString> m_queries;
+ QHash<KIO::Job*, QString> m_datas;
+
+ void listPhotos(KJob *job);
+};
+
+
+#endif //FLICKRINTERFACE_J
diff --git a/browsingbackends/flickr/flickrmodel.cpp b/browsingbackends/flickr/flickrmodel.cpp
new file mode 100644
index 0000000..41d374a
--- /dev/null
+++ b/browsingbackends/flickr/flickrmodel.cpp
@@ -0,0 +1,152 @@
+/***************************************************************************
+ * Copyright 2009 by Onur-Hayri Bakici <thehayro@gmail.com *
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+#include "flickrmodel.h"
+
+#include <libs/mediacenter/mediacenter.h>
+
+#include <KDE/KUrl>
+#include <KDE/KIO/Job>
+#include <KDE/KJob>
+
+#include <QtXml/QDomDocument>
+#include <QtXml/QDomNodeList>
+
+#include <QDebug>
+
+namespace {
+ const char* s_flickr_rest = "http://www.flickr.com/services/rest/";
+ // Flickr API key for Flickr On Plasma
+ const char* s_apikey = "df52d83b7fe03f1de079da2c300f3203";
+ //static const char* s_secret = "";
+}
+
+FlickrModel::FlickrModel (QObject* parent)
+{
+ setRoleNames(MediaCenter::appendAdditionalMediaRoles(roleNames()));
+ query("Aaron Seigo");
+}
+
+FlickrModel::~FlickrModel()
+{
+
+}
+
+void FlickrModel::query (const QString& searchTerm)
+{
+ if ( searchTerm.isEmpty() )
+ return;
+
+ KUrl query(s_flickr_rest);
+ query.addQueryItem("method", "flickr.photos.search");
+ query.addQueryItem("api_key", s_apikey);
+ query.addQueryItem("text", searchTerm);
+
+ KIO::TransferJob *job = KIO::get(query, KIO::NoReload, KIO::HideProgressInfo);
+
+ m_queries[job] = searchTerm;
+ connect ( job, SIGNAL (data(KIO::Job*, const QByteArray &)), this,
+ SLOT(flickrDataReady(KIO::Job*, const QByteArray &)) );
+ connect ( job, SIGNAL( result(KJob*)), this, SLOT (parseResults(KJob*)) );
+}
+
+void FlickrModel::flickrDataReady (KIO::Job* job, const QByteArray& data)
+{
+ if ( !m_queries.contains(job) )
+ return;
+
+ m_datas[job].append(data);
+
+ qDebug() << QString(data);
+}
+
+void FlickrModel::listPhotos (KJob* job)
+{
+ QDomDocument document;
+ if (document.setContent(m_datas[static_cast<KIO::Job*>(job)]))
+ qDebug() << "Set Content Success";
+ else
+ qDebug() << "Set Content Fail";
+
+ QDomNodeList entries = document.elementsByTagName("photo");
+
+ QString title;
+ QString id;
+ QString owner;
+ QString secret;
+ QString farmID;
+ QString serverID;
+
+ for (int i = 0; i < entries.count(); i++)
+ {
+ QDomNamedNodeMap attr = entries.at(i).attributes();
+ title = attr.namedItem("title").toAttr().value();
+ id = attr.namedItem("id").toAttr().value();
+ owner = attr.namedItem("owner").toAttr().value();
+ secret = attr.namedItem("secret").toAttr().value();
+ farmID = attr.namedItem("farm").toAttr().value();
+ serverID = attr.namedItem("server").toAttr().value();
+
+ Photo photo;
+ photo.title = title;
+ photo.id = id;
+ photo.owner= owner;
+ photo.secret = secret;
+ photo.secret = farmID;
+ photo.secret = serverID;
+ // the "s" at the end stands for "small": 75x75 px
+ photo.link = QString("http://farm%1.static.flickr.com/%2/%3_%4_m.jpg")
+ .arg(farmID)
+ .arg(serverID)
+ .arg(id)
+ .arg(secret);
+ m_photos.append(photo);
+ }
+
+ m_queries.remove( static_cast<KIO::Job*>(job) );
+ m_datas.remove( static_cast<KIO::Job*>(job) );
+
+ reset();
+}
+
+void FlickrModel::parseResults (KJob* job)
+{
+ if ( !m_datas.contains(static_cast<KIO::Job*>(job) ) )
+ return;
+
+ listPhotos(job);
+}
+
+QVariant FlickrModel::data (const QModelIndex& index, int role) const
+{
+ switch (role) {
+ case MediaCenter::HideLabelRole:
+ return true;
+ case Qt::DecorationRole:
+ return m_photos.at(index.row()).link;
+ }
+
+ return QVariant();
+}
+
+int FlickrModel::rowCount (const QModelIndex& parent) const
+{
+ return m_photos.count();
+}
diff --git a/browsingbackends/flickr/flickrmodel.h b/browsingbackends/flickr/flickrmodel.h
new file mode 100644
index 0000000..b97ef6c
--- /dev/null
+++ b/browsingbackends/flickr/flickrmodel.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright 2009 by Onur-Hayri Bakici <thehayro@gmail.com *
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+#ifndef FLICKRMODEL_H
+#define FLICKRMODEL_H
+
+#include <QAbstractListModel>
+
+namespace KIO {
+ class Job;
+}
+
+class KJob;
+
+class FlickrModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit FlickrModel (QObject* parent = 0);
+ ~FlickrModel();
+ void query(const QString &searchTerm);
+
+ virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const;
+ virtual int rowCount (const QModelIndex& parent = QModelIndex()) const;
+
+protected slots:
+ void flickrDataReady(KIO::Job *job, const QByteArray &data);
+ void parseResults(KJob *job);
+
+private:
+ struct Photo;
+ QHash<KIO::Job*, QString> m_queries;
+ QHash<KIO::Job*, QString> m_datas;
+ QList<Photo> m_photos;
+
+ void listPhotos(KJob *job);
+};
+
+struct FlickrModel::Photo
+{
+public:
+ QString title;
+ QString id;
+ QString owner;
+ QString secret;
+ QString farmID;
+ QString serverID;
+ QString link;
+};
+
+#endif // FLICKRMODEL_H
diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt
index c02d270..dca26ef 100644
--- a/components/CMakeLists.txt
+++ b/components/CMakeLists.txt
@@ -1,7 +1,6 @@
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
install(DIRECTORY mediabrowser DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
install(DIRECTORY mediacontroller DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
-install(DIRECTORY mediainfobar DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
install(DIRECTORY mediaplayer DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
install(DIRECTORY mediawelcome DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
install(DIRECTORY runtimedata DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents)
diff --git a/components/mediabrowser/MediaItemDelegate.qml b/components/mediabrowser/MediaItemDelegate.qml
index 42d6788..ea480ac 100644
--- a/components/mediabrowser/MediaItemDelegate.qml
+++ b/components/mediabrowser/MediaItemDelegate.qml
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
import QtQuick 1.1
import org.kde.qtextracomponents 0.1 as QtExtraComponents
import org.kde.plasma.components 0.1 as PlasmaComponents
diff --git a/components/mediabrowser/MediaItemDelegateLogic.js b/components/mediabrowser/MediaItemDelegateLogic.js
index eea82ac..3b52c99 100644
--- a/components/mediabrowser/MediaItemDelegateLogic.js
+++ b/components/mediabrowser/MediaItemDelegateLogic.js
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
function checkAndLoad(loader)
{
if (typeof(decoration) == "string") {
diff --git a/components/mediabrowser/MediaItemHighlight.qml b/components/mediabrowser/MediaItemHighlight.qml
index 5d86f08..ff863e1 100644
--- a/components/mediabrowser/MediaItemHighlight.qml
+++ b/components/mediabrowser/MediaItemHighlight.qml
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore

diff --git a/components/mediacontroller/MediaController.qml b/components/mediacontroller/MediaController.qml
index d6582f9..86a32b4 100644
--- a/components/mediacontroller/MediaController.qml
+++ b/components/mediacontroller/MediaController.qml
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
diff --git a/components/mediainfobar/MediaInfoBar.qml b/components/mediainfobar/MediaInfoBar.qml
deleted file mode 100644
index 82d82bb..0000000
--- a/components/mediainfobar/MediaInfoBar.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import QtQuick 1.1
-
-Rectangle {
- color: "red"
-}
\ No newline at end of file
diff --git a/components/mediaplayer/MediaPlayer.qml b/components/mediaplayer/MediaPlayer.qml
index f9a127c..6005cd1 100644
--- a/components/mediaplayer/MediaPlayer.qml
+++ b/components/mediaplayer/MediaPlayer.qml
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
import QtQuick 1.1
import Phonon 1.0 as Phonon

diff --git a/components/runtimedata/RuntimeData.qml b/components/runtimedata/RuntimeData.qml
index 3ea6262..fabe049 100644
--- a/components/runtimedata/RuntimeData.qml
+++ b/components/runtimedata/RuntimeData.qml
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
import QtQuick 1.1

Item {
diff --git a/libs/mediacenter/abstractbrowsingbackend.cpp b/libs/mediacenter/abstractbrowsingbackend.cpp
index 98acd81..55b9c0b 100644
--- a/libs/mediacenter/abstractbrowsingbackend.cpp
+++ b/libs/mediacenter/abstractbrowsingbackend.cpp
@@ -171,3 +171,15 @@ void AbstractBrowsingBackend::setDeclarativeEngine(QDeclarativeEngine *declarati
{
d->declarativeEngine = declarativeEngine;
}
+
+QString AbstractBrowsingBackend::bottomToolbar() const
+{
+ return "";
+}
+
+QString AbstractBrowsingBackend::constructQmlSource(const QString& componentDirName, const QString &versionString,
+ const QString& itemName) const
+{
+ return QString("import QtQuick 1.1\n\import org.kde.plasma.mediacentercomponents.%1 %2 as %3\n\%3.%4 {\n\}\n")
+ .arg(componentDirName).arg(versionString).arg(componentDirName.toUpper()).arg(itemName);
+}
diff --git a/libs/mediacenter/abstractbrowsingbackend.h b/libs/mediacenter/abstractbrowsingbackend.h
index 2c970ab..77d196c 100644
--- a/libs/mediacenter/abstractbrowsingbackend.h
+++ b/libs/mediacenter/abstractbrowsingbackend.h
@@ -38,7 +38,7 @@ namespace MediaCenter {
/**
* @class AbstractBrowsingBackend @author Alessandro Diaferia
* @brief A useful class to build custom plugins for the mediabrowser.
- *
+ *
* This class allows you to write custom models to use with the mediabrowser applet.
* Custom models are useful to implement custom navigations such as navigation
* through services available through the web, see YouTube.
@@ -128,7 +128,7 @@ public:
QString name() const;

QString icon() const;
-
+
/**
* Convenience function that returns the list of
* available browsing backends found.
@@ -187,6 +187,8 @@ public:
*/
QDeclarativeEngine *declarativeEngine() const;

+ Q_INVOKABLE virtual QString bottomToolbar() const;
+
signals:
void modelChanged();
void metadataModelChanged();
@@ -202,7 +204,7 @@ protected:
* @see MediaRole
*/
void setModel(QAbstractItemModel * model);
-
+
/**
* As from Plasma::Applet this method should be used in order
* to inform about the availability of a configuration interface for
@@ -212,6 +214,17 @@ protected:

void setBrowsingType(BrowsingType);

+ /**
+ * This is a convenience function which constructs a string representing QML source for
+ * loading an item of name itemName which exists in componentDirName
+ *
+ * @param componentDirName name of the dir (relative to org.kde.plasma.mediacentercomponents
+ * @param versionString version of the item as specified in qmldir in componentDirName
+ * @param itemName name of the item as specified in qmldir in componentDirName
+ */
+ QString constructQmlSource(const QString& componentDirName, const QString& versionString,
+ const QString& itemName) const;
+
private:
class AbstractBrowsingBackendPrivate;
AbstractBrowsingBackendPrivate *d;
diff --git a/libs/mediacenter/backendsmodel.cpp b/libs/mediacenter/backendsmodel.cpp
index 093bc0d..a4230b1 100644
--- a/libs/mediacenter/backendsmodel.cpp
+++ b/libs/mediacenter/backendsmodel.cpp
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
#include "backendsmodel.h"

#include <libs/mediacenter/abstractbrowsingbackend.h>
diff --git a/libs/mediacenter/backendsmodel.h b/libs/mediacenter/backendsmodel.h
index 824596e..6891462 100644
--- a/libs/mediacenter/backendsmodel.h
+++ b/libs/mediacenter/backendsmodel.h
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
#ifndef BACKENDSMODEL_H
#define BACKENDSMODEL_H

diff --git a/shells/newshell/package/contents/ui/mediacenter.qml b/shells/newshell/package/contents/ui/mediacenter.qml
index 2ce322a..d866132 100644
--- a/shells/newshell/package/contents/ui/mediacenter.qml
+++ b/shells/newshell/package/contents/ui/mediacenter.qml
@@ -1,3 +1,22 @@
+/***************************************************************************
+ * Copyright 2012 Sinny Kumari <ksinny@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
import QtQuick 1.1
import org.kde.plasma.mediacentercomponents 0.1 as MediaCenterComponents

@@ -15,6 +34,8 @@ Rectangle {
mediaPlayer.currentTime = currentTime
}
}
+
+ onCurrentBrowsingBackendChanged: mediaCenterRootItem.loadToolbars();
}

MediaCenterComponents.MediaPlayer {
@@ -46,7 +67,7 @@ Rectangle {
width: parent.width
model: backendsModel
anchors {
- left: parent.left; right: parent.right; top: mediaController.bottom; bottom: mediaInfoBar.top
+ left: parent.left; right: parent.right; top: mediaController.bottom; bottom: bottomToolbar.top
}

onBackendSelected: { runtimeData.currentBrowsingBackend = selectedBackend; visible = false }
@@ -55,7 +76,7 @@ Rectangle {
MediaCenterComponents.MediaBrowser {
id: mediaBrowser
anchors {
- left: parent.left; right: parent.right; top: mediaController.bottom; bottom: mediaInfoBar.top
+ left: parent.left; right: parent.right; top: mediaController.bottom; bottom: bottomToolbar.top
}
visible: false
z: 1
@@ -79,12 +100,18 @@ Rectangle {
}
}

- MediaCenterComponents.MediaInfoBar {
- id: mediaInfoBar
+ Item {
+ id: bottomToolbar
height: parent.height * 0.07
width: parent.width
anchors {
left: parent.left; right: parent.right; bottom: parent.bottom
}
}
+
+ function loadToolbars()
+ {
+ var qmlSource = runtimeData.currentBrowsingBackend.bottomToolbar();
+ var newObject = Qt.createQmlObject(qmlSource, bottomToolbar);
+ }
}