├── .arcconfig ├── .gitignore ├── CMakeLists.txt ├── COPYING ├── COPYING.LIB ├── ChangeLog ├── LICENSE ├── Messages.sh ├── README ├── TODO ├── autotests ├── CMakeLists.txt ├── cmake │ └── Findmockcpp.cmake ├── itemcachetest.cpp ├── itemcachetest.h ├── mediacentertest.cpp ├── mediacentertest.h ├── medialibrarytest.cpp ├── medialibrarytest.h ├── mediatest.cpp ├── mediatest.h ├── pmcalbumtest.cpp ├── pmcalbumtest.h ├── pmcartisttest.cpp ├── pmcartisttest.h ├── pmcmediatest.cpp ├── pmcmediatest.h ├── runtimedatatest.cpp ├── runtimedatatest.h ├── singletonfactorytest.cpp ├── singletonfactorytest.h └── testhelpers.h ├── browsingbackends ├── CMakeLists.txt ├── eventsbackend │ ├── CMakeLists.txt │ ├── eventsbackend.cpp │ ├── eventsbackend.desktop │ ├── eventsbackend.h │ ├── eventscomponents │ │ ├── DatePicker.qml │ │ ├── Digit.qml │ │ ├── EventsConfiguration.qml │ │ └── qmldir │ ├── eventsfiltermodel.cpp │ ├── eventsfiltermodel.h │ ├── eventsmodel.cpp │ ├── eventsmodel.h │ ├── eventspicturesmodel.cpp │ └── eventspicturesmodel.h ├── metadatamusicbackend │ ├── CMakeLists.txt │ ├── metadatamusicbackend.cpp │ ├── metadatamusicbackend.desktop │ └── metadatamusicbackend.h ├── metadatapicturebackend │ ├── CMakeLists.txt │ ├── metadatapicturebackend.cpp │ ├── metadatapicturebackend.desktop │ ├── metadatapicturebackend.h │ ├── metadatapicturemodel.cpp │ └── metadatapicturemodel.h └── metadatavideobackend │ ├── CMakeLists.txt │ ├── metadatavideobackend.cpp │ ├── metadatavideobackend.desktop │ ├── metadatavideobackend.h │ ├── metadatavideomodel.cpp │ └── metadatavideomodel.h ├── cmake └── FindTaglib.cmake ├── components ├── AutoHide.qml ├── BreezeBlock.qml ├── CMakeLists.txt ├── CategoriesBrowser.qml ├── MediaInfoPanel.qml ├── common │ ├── MediaItem.qml │ └── MediaItemDelegate.qml └── qmldir ├── config-plasma-mediacenter.h.cmake ├── datasources ├── CMakeLists.txt ├── baloosearch │ ├── CMakeLists.txt │ ├── audiosearchresulthandler.cpp │ ├── audiosearchresulthandler.h │ ├── baloosearch.desktop │ ├── baloosearchmediasource.cpp │ ├── baloosearchmediasource.h │ ├── imagesearchresulthandler.cpp │ ├── imagesearchresulthandler.h │ ├── searchresulthandler.cpp │ ├── searchresulthandler.h │ ├── videosearchresulthandler.cpp │ └── videosearchresulthandler.h ├── filesystemsearch │ ├── CMakeLists.txt │ ├── filesystemsearch.desktop │ ├── filesystemsearchmediasource.cpp │ └── filesystemsearchmediasource.h └── lastfm │ ├── CMakeLists.txt │ ├── lastfmimagefetcher.cpp │ ├── lastfmimagefetcher.desktop │ └── lastfmimagefetcher.h ├── images ├── CMakeLists.txt └── hi64-actions-pmc-back.png ├── libs ├── CMakeLists.txt └── mediacenter │ ├── CMakeLists.txt │ ├── abstractbrowsingbackend.cpp │ ├── abstractbrowsingbackend.h │ ├── abstractdatasource.cpp │ ├── abstractdatasource.h │ ├── album.cpp │ ├── album.h │ ├── artist.cpp │ ├── artist.h │ ├── backendsmodel.cpp │ ├── backendsmodel.h │ ├── data │ └── servicetypes │ │ ├── pmc_browsingbackend.desktop │ │ └── pmc_datasource.desktop │ ├── datasourcesloader.cpp │ ├── datasourcesloader.h │ ├── filtermediamodel.cpp │ ├── filtermediamodel.h │ ├── filterplaylistmodel.cpp │ ├── filterplaylistmodel.h │ ├── iconimageprovider.cpp │ ├── iconimageprovider.h │ ├── itemcache.cpp │ ├── itemcache.h │ ├── localthumbnailprovider.cpp │ ├── localthumbnailprovider.h │ ├── media.cpp │ ├── media.h │ ├── mediabrowserloader.cpp │ ├── mediabrowserloader.h │ ├── mediacenter.cpp │ ├── mediacenter.h │ ├── medialibrary.cpp │ ├── medialibrary.h │ ├── medialibrarywrappercache.cpp │ ├── medialibrarywrappercache.h │ ├── mediavalidator.cpp │ ├── mediavalidator.h │ ├── mpris2 │ ├── mediaplayer2.cpp │ ├── mediaplayer2.h │ ├── mediaplayer2player.cpp │ ├── mediaplayer2player.h │ ├── mediaplayer2tracklist.cpp │ ├── mediaplayer2tracklist.h │ ├── mpris2.cpp │ └── mpris2.h │ ├── multipleplaylistmodel.cpp │ ├── multipleplaylistmodel.h │ ├── objectpair.cpp │ ├── objectpair.h │ ├── playlistitem.cpp │ ├── playlistitem.h │ ├── playlistmodel.cpp │ ├── playlistmodel.h │ ├── plugin │ ├── CMakeLists.txt │ ├── mediacenterplugin.cpp │ ├── mediacenterplugin.h │ ├── qmlaccess.cpp │ ├── qmlaccess.h │ └── qmldir │ ├── pmcalbum.cpp │ ├── pmcalbum.h │ ├── pmcartist.cpp │ ├── pmcartist.h │ ├── pmccoverartprovider.cpp │ ├── pmccoverartprovider.h │ ├── pmcimagecache.cpp │ ├── pmcimagecache.h │ ├── pmcmedia.cpp │ ├── pmcmedia.h │ ├── pmcmetadatamodel.cpp │ ├── pmcmetadatamodel.h │ ├── pmcmodel.cpp │ ├── pmcmodel.h │ ├── runtimedata.cpp │ ├── runtimedata.h │ ├── settings.cpp │ ├── settings.h │ ├── singletonfactory.cpp │ ├── singletonfactory.h │ ├── subtitleprovider.cpp │ └── subtitleprovider.h ├── mediaelements ├── CMakeLists.txt ├── imageviewer │ ├── ImageViewer.qml │ ├── PictureStrip.qml │ └── PictureStripDelegate.qml ├── mediabrowser │ ├── MediaBrowser.qml │ └── PopupModel.qml ├── mediacontroller │ └── MediaController.qml ├── mediaplayer │ ├── MediaPlayer.qml │ ├── MusicStats.qml │ └── StatsLabel.qml ├── playlist │ ├── MultiplePlaylists.qml │ ├── Playlist.qml │ ├── PlaylistDelegate.qml │ └── PlaylistDelegateLogic.js ├── qmldir └── runtimedata │ └── RuntimeData.qml ├── onlineservices ├── CMakeLists.txt ├── flickr │ ├── CMakeLists.txt │ ├── flickrbackend.cpp │ ├── flickrbackend.desktop │ ├── flickrbackend.h │ ├── flickrmodel.cpp │ └── flickrmodel.h ├── picasa │ ├── CMakeLists.txt │ ├── picasabackend.cpp │ ├── picasabackend.desktop │ ├── picasabackend.h │ ├── picasacomponents │ │ ├── PicasaSidePanel.qml │ │ └── qmldir │ ├── picasamodel.cpp │ └── picasamodel.h └── youtube │ ├── CMakeLists.txt │ ├── constants.h │ ├── diskcache.cpp │ ├── diskcache.h │ ├── global.h │ ├── hi64-apps-youtube-pmc.png │ ├── hi64-apps-youtube-pmc.svgz │ ├── networkaccess.cpp │ ├── networkaccess.h │ ├── video.cpp │ ├── video.h │ ├── videodefinition.cpp │ ├── videodefinition.h │ ├── videodetailsmodel.cpp │ ├── videodetailsmodel.h │ ├── youtubebackend.cpp │ ├── youtubebackend.desktop │ ├── youtubebackend.h │ ├── youtubemodel.cpp │ └── youtubemodel.h ├── packages ├── CMakeLists.txt ├── containment │ ├── CMakeLists.txt │ ├── mediacenter.cpp │ ├── mediacenter.h │ └── package │ │ ├── Messages.sh │ │ ├── contents │ │ ├── code │ │ │ └── LayoutManager.js │ │ ├── config │ │ │ └── main.xml │ │ └── ui │ │ │ └── main.qml │ │ └── metadata.desktop ├── mediabrowsers │ ├── CMakeLists.txt │ ├── gridbrowser │ │ ├── contents │ │ │ └── ui │ │ │ │ └── main.qml │ │ └── metadata.desktop │ └── listbrowser │ │ ├── contents │ │ └── ui │ │ │ ├── ListMediaItem.qml │ │ │ └── main.qml │ │ └── metadata.desktop ├── plasma-mediacenter.desktop └── shell │ ├── Messages.sh │ ├── contents │ ├── InteractiveConsole.qml │ ├── applet │ │ ├── AppletError.qml │ │ ├── CompactApplet.qml │ │ └── DefaultCompactRepresentation.qml │ ├── configuration │ │ ├── AppletConfiguration.qml │ │ ├── ConfigCategoryDelegate.qml │ │ ├── ConfigurationContainmentActions.qml │ │ ├── ConfigurationContainmentAppearance.qml │ │ ├── ConfigurationShortcuts.qml │ │ ├── ContainmentConfiguration.qml │ │ └── MouseEventInputButton.qml │ ├── defaults │ ├── explorer │ │ └── AppletAlternatives.qml │ ├── images │ │ └── shadow.png │ ├── layout.js │ ├── loader.qml │ └── views │ │ ├── Desktop.qml │ │ └── WidgetExplorer.qml │ └── metadata.desktop ├── plasma-mediacenter.desktop.cmake └── tests ├── CMakeLists.txt ├── backendstest.qml ├── datasourceloadertest ├── CMakeLists.txt └── datasourceloadertest.cpp └── fakemediasource ├── CMakeLists.txt ├── fakemediasource.cpp ├── fakemediasource.desktop ├── fakemediasource.h └── medialist.json /.arcconfig: -------------------------------------------------------------------------------- 1 | { 2 | "phabricator.uri" : "https://phabricator.kde.org/" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | compile_commands.json 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Plasma Media Center, a media center for KDE. 2 | This project is a part of the KDE project. 3 | The following GNU GPL v2 applies to this project, unless 4 | otherwise noted by a source file. 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | -------------------------------------------------------------------------------- /Messages.sh: -------------------------------------------------------------------------------- 1 | #!bin/sh 2 | 3 | $XGETTEXT `find . ! -path "./shells/next/*" \( -name \*.cc -o -name \*.cpp -o -name \*.h -o -name \*.qml \)` -o $podir/plasma-mediacenter.pot 4 | 5 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Required: 2 | ========== 3 | 4 | 1) KDE Frameworks 5 5 | 2) KDE Plasma 5 6 | 3) Qt QtMultimedia 7 | 4) Baloo (KF5) 8 | 5) Taglib 9 | 10 | To know Plasma Media Center architecture and other related information browse through http://community.kde.org/Plasma/Plasma_Media_Center 11 | 12 | Installation: 13 | ========= 14 | mkdir build 15 | cd build 16 | cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_INSTALL_PREFIX=`kf5-config --prefix` .. 17 | make install 18 | 19 | Run PMC using "plasmashell -ap org.kde.plasma.mediacenter" or by using the "Plasma Media Center" icon in your launcher 20 | 21 | Uninstallation: 22 | ============= 23 | Run this from build dir: 24 | for i in $(cat install_manifest.txt); do sudo rm $i; done; 25 | 26 | (some of the old code can be found in the "old" branch, just in case somebody wants to browse) 27 | 28 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Preview 2 | ======= 3 | 4 | - Port away eventsbackend from kdelibs4support 5 | - Fix font sizes so that both HiDPI and Low DPI people are happy 6 | - Export additional roles in itemData so they can be used in MediaInfoPanel 7 | 8 | Past Preview 9 | ============ 10 | 11 | - Merge events backend 12 | - Adapt to new API 13 | - Merge it with metadatapictures 14 | - Use events from kdepim? investigate if possible 15 | - Configuration for backends 16 | - Allow backends/models to export KActionCollection 17 | - Integrate online backends / search stuff 18 | - Implement "recently watched" 19 | - Talk with nikhatzi and get DVB backend/stuff in (work in progress, nik/dvbbackend branch) 20 | -------------------------------------------------------------------------------- /autotests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | enable_testing() 2 | include(CTest) 3 | include(ECMAddTests) 4 | 5 | SET(QT_USE_QTMAIN TRUE) 6 | SET(QT_USE_QTTEST TRUE) 7 | 8 | kde_enable_exceptions() 9 | 10 | set(CMAKE_MODULE_PATH 11 | ${CMAKE_MODULE_PATH} 12 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 13 | 14 | set(pmc_test_SRCS 15 | medialibrarytest.cpp 16 | singletonfactorytest.cpp 17 | pmcmediatest.cpp 18 | mediatest.cpp 19 | mediacentertest.cpp 20 | itemcachetest.cpp 21 | pmcalbumtest.cpp 22 | pmcartisttest.cpp 23 | runtimedatatest.cpp 24 | ) 25 | 26 | ecm_add_tests( 27 | ${pmc_test_SRCS} 28 | LINK_LIBRARIES plasmamediacentertest Qt5::Test 29 | NAME_PREFIX "pmctest-" 30 | ) 31 | -------------------------------------------------------------------------------- /autotests/cmake/Findmockcpp.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Shantanu Tushar 2 | # 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU Lesser General Public 5 | # License as published by the Free Software Foundation; either 6 | # version 2.1 of the License, or (at your option) any later version. 7 | # 8 | # This library is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # Lesser General Public License for more details. 12 | 13 | # You should have received a copy of the GNU Lesser General Public 14 | # License along with this library. If not, see . 15 | 16 | # - Try to find mockcpp 17 | # Once done, this will define 18 | # 19 | # mockcpp_FOUND - system has mockcpp 20 | # mockcpp_INCLUDE_DIRS - the mockcpp include directories 21 | # mockcpp_LIBRARIES - link these to use mockcpp 22 | 23 | # Include dir 24 | find_path(mockcpp_INCLUDE_DIRS 25 | NAMES mockcpp/mockcpp.h 26 | ) 27 | 28 | # Finally the library itself 29 | find_library(mockcpp_LIBRARIES 30 | NAMES mockcpp 31 | ) 32 | 33 | if(mockcpp_LIBRARIES) 34 | set(mockcpp_FOUND TRUE) 35 | endif() 36 | 37 | include(FindPackageHandleStandardArgs) 38 | 39 | find_package_handle_standard_args(mockcpp DEFAULT_MSG 40 | mockcpp_LIBRARIES 41 | mockcpp_INCLUDE_DIRS 42 | ) 43 | 44 | mark_as_advanced(mockcpp_INCLUDE_DIRS mockcpp_LIBRARIES) 45 | -------------------------------------------------------------------------------- /autotests/itemcachetest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef ITEMCACHETEST_H 20 | #define ITEMCACHETEST_H 21 | 22 | #include 23 | 24 | class ItemCacheTest : public QObject 25 | { 26 | Q_OBJECT 27 | private Q_SLOTS: 28 | void shouldInsertAndReturnTheSameArtistNextTime(); 29 | void shouldInsertAndReturnTheSameAlbumNextTime(); 30 | void shouldCreateArtistIfNotPresentWhenCreatingAlbum(); 31 | void shouldNotCreateNewArtistIfNotPresent(); 32 | void shouldNotCreateNewAlbumOrArtistIfNotPresent(); 33 | }; 34 | 35 | #endif // ITEMCACHETEST_H 36 | -------------------------------------------------------------------------------- /autotests/mediacentertest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 by Sinny Kumari * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef MEDIACENTERTEST_H 20 | #define MEDIACENTERTEST_H 21 | 22 | #include 23 | 24 | class MediaCenterTest : public QObject 25 | { 26 | Q_OBJECT 27 | private slots: 28 | void initTestCase(); 29 | void cleanupTestCase(); 30 | 31 | void init(); 32 | void cleanup(); 33 | 34 | void shouldReturnPathForComponent(); 35 | void shouldReturnPathWithoutComponent(); 36 | }; 37 | 38 | #endif // MEDIACENTERTEST_H 39 | -------------------------------------------------------------------------------- /autotests/mediatest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef MEDIATEST_H 20 | #define MEDIATEST_H 21 | 22 | #include 23 | 24 | class MediaTest : public QObject 25 | { 26 | Q_OBJECT 27 | private slots: 28 | void initTestCase(); 29 | void cleanupTestCase(); 30 | 31 | void init(); 32 | void cleanup(); 33 | 34 | void shouldSetAlbumAndUpdateRelationsCorrectly(); 35 | void shouldSetArtistAndUpdateRelationsCorrectly(); 36 | }; 37 | 38 | #endif // MEDIATEST_H 39 | -------------------------------------------------------------------------------- /autotests/pmcalbumtest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PMCALBUMTEST_H 20 | #define PMCALBUMTEST_H 21 | 22 | #include 23 | 24 | class PmcAlbumTest : public QObject 25 | { 26 | Q_OBJECT 27 | private slots: 28 | void initTestCase(); 29 | void cleanupTestCase(); 30 | 31 | void init(); 32 | void cleanup(); 33 | 34 | void shouldReturnNameOfAlbum(); 35 | void shouldReturnAlbumArtist(); 36 | }; 37 | 38 | #endif // PMCALBUMTEST_H 39 | -------------------------------------------------------------------------------- /autotests/pmcartisttest.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "pmcartisttest.h" 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | QTEST_GUILESS_MAIN(PmcArtistTest); 26 | 27 | void PmcArtistTest::initTestCase() 28 | { 29 | // Called before the first testfunction is executed 30 | } 31 | 32 | void PmcArtistTest::cleanupTestCase() 33 | { 34 | // Called after the last testfunction was executed 35 | } 36 | 37 | void PmcArtistTest::init() 38 | { 39 | // Called before each testfunction is executed 40 | } 41 | 42 | void PmcArtistTest::cleanup() 43 | { 44 | // Called after every testfunction 45 | } 46 | 47 | void PmcArtistTest::shouldReturnNameOfArtist() 48 | { 49 | auto artist = QSharedPointer(new Artist("Artist")); 50 | PmcArtist pmcArtist(artist); 51 | 52 | QCOMPARE(pmcArtist.name(), QString("Artist")); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /autotests/pmcartisttest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PMCARTISTTEST_H 20 | #define PMCARTISTTEST_H 21 | 22 | #include 23 | 24 | class PmcArtistTest : public QObject 25 | { 26 | Q_OBJECT 27 | private slots: 28 | void initTestCase(); 29 | void cleanupTestCase(); 30 | 31 | void init(); 32 | void cleanup(); 33 | 34 | void shouldReturnNameOfArtist(); 35 | }; 36 | 37 | #endif // PMCARTISTTEST_H 38 | -------------------------------------------------------------------------------- /autotests/pmcmediatest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PMCMEDIATEST_H 20 | #define PMCMEDIATEST_H 21 | 22 | #include 23 | 24 | class PmcMediaTest : public QObject 25 | { 26 | Q_OBJECT 27 | 28 | private slots: 29 | void initTestCase(); 30 | void cleanupTestCase(); 31 | 32 | void init(); 33 | void cleanup(); 34 | 35 | void shouldReturnUrlEvenIfMediaIsNotSet(); 36 | void shouldReturnTitleEvenIfMediaIsNotSet(); 37 | void shouldEmitUpdatedWhenMediaSet(); 38 | }; 39 | 40 | #endif // PMCMEDIATEST_H 41 | -------------------------------------------------------------------------------- /autotests/runtimedatatest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2014 Bhushan Shah 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of 8 | * the License or (at your option) version 3 or any later version 9 | * accepted by the membership of KDE e.V. (or its successor approved 10 | * by the membership of KDE e.V.), which shall act as a proxy 11 | * defined in Section 14 of version 3 of the license. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef RUNTIMEDATATEST_H 24 | #define RUNTIMEDATATEST_H 25 | 26 | #include 27 | 28 | class TestRuntimeData : public QObject 29 | { 30 | Q_OBJECT 31 | private slots: 32 | void initTestCase(); 33 | void cleanupTestCase(); 34 | 35 | void init(); 36 | void cleanup(); 37 | 38 | void testPlayUrl(); 39 | void testVolumeAndMuteFunction(); 40 | }; 41 | 42 | #endif // RUNTIMEDATATEST_H 43 | -------------------------------------------------------------------------------- /autotests/singletonfactorytest.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "singletonfactorytest.h" 20 | #include "singletonfactory.h" 21 | 22 | #include 23 | 24 | void SingletonFactoryTest::initTestCase() 25 | { 26 | // Called before the first testfunction is executed 27 | } 28 | 29 | void SingletonFactoryTest::cleanupTestCase() 30 | { 31 | // Called after the last testfunction was executed 32 | } 33 | 34 | void SingletonFactoryTest::init() 35 | { 36 | // Called before each testfunction is executed 37 | } 38 | 39 | void SingletonFactoryTest::cleanup() 40 | { 41 | // Called after every testfunction 42 | } 43 | 44 | void SingletonFactoryTest::shouldReturnSameInstanceEveryTime() 45 | { 46 | QObject *obj1 = SingletonFactory::instanceFor(); 47 | QObject *obj2 = SingletonFactory::instanceFor(); 48 | 49 | QVERIFY2(obj1 == obj2, "Objects returned are not equal"); 50 | } 51 | 52 | QTEST_GUILESS_MAIN(SingletonFactoryTest) 53 | 54 | -------------------------------------------------------------------------------- /autotests/singletonfactorytest.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef SINGLETONFACTORYTEST_H 20 | #define SINGLETONFACTORYTEST_H 21 | 22 | #include 23 | 24 | class SingletonFactoryTest : public QObject 25 | { 26 | Q_OBJECT 27 | private slots: 28 | void initTestCase(); 29 | void cleanupTestCase(); 30 | 31 | void init(); 32 | void cleanup(); 33 | 34 | void shouldReturnSameInstanceEveryTime(); 35 | }; 36 | 37 | #endif // SINGLETONFACTORYTEST_H 38 | -------------------------------------------------------------------------------- /autotests/testhelpers.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | #ifndef TESTHELPERS_H 19 | #define TESTHELPERS_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace { 26 | static const int TIMEOUT_FOR_SIGNALS = 3000; 27 | } 28 | 29 | //from https://bugreports.qt-project.org/browse/QTBUG-2986 30 | bool waitForSignal(QSignalSpy* spy, int timeoutms = TIMEOUT_FOR_SIGNALS) 31 | { 32 | QTime timer; 33 | timer.start(); 34 | while (spy->isEmpty() && timer.elapsed() < timeoutms) 35 | { 36 | QCoreApplication::processEvents(); 37 | } 38 | return !spy->isEmpty(); 39 | } 40 | 41 | #endif // TESTHELPERS_H 42 | -------------------------------------------------------------------------------- /browsingbackends/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(metadatamusicbackend) 2 | add_subdirectory(metadatavideobackend) 3 | add_subdirectory(metadatapicturebackend) 4 | #add_subdirectory(eventsbackend) 5 | -------------------------------------------------------------------------------- /browsingbackends/eventsbackend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(eventsbackend_SRCS 2 | eventsmodel.cpp 3 | eventsfiltermodel.cpp 4 | eventspicturesmodel.cpp 5 | ../abstractmetadatabackend.cpp 6 | eventsbackend.cpp 7 | ) 8 | 9 | add_library(pmc_eventsbackend MODULE ${eventsbackend_SRCS}) 10 | set_target_properties(pmc_eventsbackend PROPERTIES PREFIX "") 11 | 12 | target_link_libraries(pmc_eventsbackend 13 | plasmamediacenter 14 | ) 15 | 16 | kservice_desktop_to_json(pmc_eventsbackend eventsbackend.desktop) 17 | 18 | install(TARGETS pmc_eventsbackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 19 | install(DIRECTORY eventscomponents DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 20 | -------------------------------------------------------------------------------- /browsingbackends/eventsbackend/eventscomponents/qmldir: -------------------------------------------------------------------------------- 1 | EventsConfiguration 0.1 EventsConfiguration.qml 2 | -------------------------------------------------------------------------------- /browsingbackends/eventsbackend/eventsfiltermodel.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef EVENTSFILTERMODEL_H 20 | #define EVENTSFILTERMODEL_H 21 | 22 | #include 23 | #include 24 | 25 | class EventsFilterModel : public FilterMediaModel 26 | { 27 | public: 28 | explicit EventsFilterModel(QObject* parent = 0); 29 | 30 | void setDateRange(const QString &eventName, const QDate &startDate, const QDate &endDate); 31 | QString eventName() const; 32 | QPair dateRange() const; 33 | 34 | protected: 35 | virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const; 36 | 37 | private: 38 | QString m_eventName; 39 | QDate m_startDate; 40 | QDate m_endDate; 41 | }; 42 | 43 | #endif // EVENTSFILTERMODEL_H 44 | -------------------------------------------------------------------------------- /browsingbackends/eventsbackend/eventsmodel.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef EVENTSMODEL_H 20 | #define EVENTSMODEL_H 21 | 22 | #include 23 | #include 24 | 25 | class EventsModel : public QAbstractListModel 26 | { 27 | public: 28 | explicit EventsModel(QObject* parent = 0); 29 | 30 | virtual QVariant data(const QModelIndex& index, int role) const; 31 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; 32 | 33 | bool addOrEditEvent(const QString &eventName, const QDate &startDate, const QDate &endDate); 34 | QPair dateRangeForEvent(const QString &eventName) const; 35 | bool deleteEvent(const QString &eventName); 36 | bool containsEvent(const QString& eventName) const; 37 | 38 | void saveEvents(); 39 | 40 | private: 41 | QList m_eventNames; 42 | QHash> m_events; 43 | }; 44 | 45 | #endif // EVENTSMODEL_H 46 | -------------------------------------------------------------------------------- /browsingbackends/eventsbackend/eventspicturesmodel.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "eventspicturesmodel.h" 20 | 21 | EventsPicturesModel::EventsPicturesModel(QObject* parent, MediaLibrary* mediaLibrary): PmcMetadataModel(parent, mediaLibrary) 22 | { 23 | showMediaType(MediaCenter::Picture); 24 | } 25 | 26 | QVariant EventsPicturesModel::data(const QModelIndex& index, int role) const 27 | { 28 | switch (role) { 29 | case Qt::DecorationRole: 30 | return PmcMetadataModel::data (index, MediaCenter::MediaUrlRole); 31 | case MediaCenter::MediaTypeRole: 32 | return "image"; 33 | case MediaCenter::HideLabelRole: 34 | return true; 35 | case MediaCenter::DecorationTypeRole: 36 | return "image"; 37 | case MediaCenter::IsExpandableRole: 38 | return false; 39 | } 40 | 41 | return PmcMetadataModel::data(index, role); 42 | } 43 | -------------------------------------------------------------------------------- /browsingbackends/eventsbackend/eventspicturesmodel.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef EVENTSPICTURESMODEL_H 20 | #define EVENTSPICTURESMODEL_H 21 | 22 | #include 23 | 24 | class EventsPicturesModel : public PmcMetadataModel 25 | { 26 | public: 27 | explicit EventsPicturesModel(QObject* parent = 0, MediaLibrary* mediaLibrary = 0); 28 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 29 | }; 30 | 31 | #endif // EVENTSPICTURESMODEL_H 32 | -------------------------------------------------------------------------------- /browsingbackends/metadatamusicbackend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(metadatamusicbackend_SRCS 2 | metadatamusicbackend.cpp 3 | ) 4 | 5 | add_library(pmc_metadatamusicbackend MODULE ${metadatamusicbackend_SRCS}) 6 | set_target_properties(pmc_metadatamusicbackend PROPERTIES PREFIX "") 7 | 8 | target_link_libraries(pmc_metadatamusicbackend 9 | plasmamediacenter 10 | ) 11 | 12 | kcoreaddons_desktop_to_json(pmc_metadatamusicbackend metadatamusicbackend.desktop) 13 | 14 | install(TARGETS pmc_metadatamusicbackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 15 | -------------------------------------------------------------------------------- /browsingbackends/metadatapicturebackend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(metadatapicturebackend_SRCS 2 | metadatapicturemodel.cpp 3 | metadatapicturebackend.cpp 4 | ) 5 | 6 | add_library(pmc_metadatapicturebackend MODULE ${metadatapicturebackend_SRCS}) 7 | set_target_properties(pmc_metadatapicturebackend PROPERTIES PREFIX "") 8 | 9 | target_link_libraries(pmc_metadatapicturebackend 10 | plasmamediacenter 11 | ) 12 | 13 | kcoreaddons_desktop_to_json(pmc_metadatapicturebackend metadatapicturebackend.desktop) 14 | 15 | install(TARGETS pmc_metadatapicturebackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 16 | -------------------------------------------------------------------------------- /browsingbackends/metadatapicturebackend/metadatapicturebackend.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2009 by Alessandro Diaferia * 3 | * Copyright 2011 Sinny Kumari 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 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 19 | ***************************************************************************/ 20 | 21 | #ifndef METADATAPICTUREBACKEND_H 22 | #define METADATAPICTUREBACKEND_H 23 | 24 | #include "mediacenter/abstractbrowsingbackend.h" 25 | 26 | 27 | class MetadataPictureBackend : public MediaCenter::AbstractBrowsingBackend 28 | { 29 | Q_OBJECT 30 | public: 31 | MetadataPictureBackend (QObject* parent, const QVariantList& args); 32 | virtual ~MetadataPictureBackend(); 33 | 34 | protected: 35 | bool initImpl() Q_DECL_OVERRIDE; 36 | }; 37 | 38 | #endif // METADATAPICTUREBACKEND_H 39 | -------------------------------------------------------------------------------- /browsingbackends/metadatapicturebackend/metadatapicturemodel.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2011 Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | 21 | #include "metadatapicturemodel.h" 22 | #include "mediacenter/mediacenter.h" 23 | #include "mediacenter/abstractbrowsingbackend.h" 24 | 25 | #include 26 | #include 27 | 28 | MetadataPictureModel::MetadataPictureModel (QObject* parent) 29 | : PmcMetadataModel (parent) 30 | { 31 | showMediaType(MediaCenter::Picture); 32 | } 33 | 34 | MetadataPictureModel::~MetadataPictureModel() 35 | { 36 | 37 | } 38 | 39 | QVariant MetadataPictureModel::data (const QModelIndex& index, int role) const 40 | { 41 | switch (role) { 42 | case Qt::DecorationRole: 43 | return PmcMetadataModel::data (index, MediaCenter::MediaUrlRole); 44 | case MediaCenter::MediaTypeRole: 45 | return "image"; 46 | case MediaCenter::HideLabelRole: 47 | return true; 48 | case MediaCenter::DecorationTypeRole: 49 | return "image"; 50 | case MediaCenter::IsExpandableRole: 51 | return false; 52 | } 53 | 54 | return PmcMetadataModel::data(index, role); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /browsingbackends/metadatapicturebackend/metadatapicturemodel.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2011 Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | #ifndef METADATAPICTUREMODEL_H 21 | #define METADATAPICTUREMODEL_H 22 | 23 | #include "mediacenter/pmcmetadatamodel.h" 24 | 25 | class MetadataPictureModel : public PmcMetadataModel 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit MetadataPictureModel (QObject* parent = 0); 30 | virtual ~MetadataPictureModel(); 31 | 32 | QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 33 | }; 34 | 35 | #endif // METADATAPICTUREMODEL_H 36 | -------------------------------------------------------------------------------- /browsingbackends/metadatavideobackend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(metadatavideobackend_SRCS 2 | metadatavideomodel.cpp 3 | metadatavideobackend.cpp 4 | ) 5 | 6 | add_library(pmc_metadatavideobackend MODULE ${metadatavideobackend_SRCS}) 7 | set_target_properties(pmc_metadatavideobackend PROPERTIES PREFIX "") 8 | 9 | target_link_libraries(pmc_metadatavideobackend 10 | plasmamediacenter 11 | ) 12 | 13 | kcoreaddons_desktop_to_json(pmc_metadatavideobackend metadatavideobackend.desktop) 14 | 15 | install(TARGETS pmc_metadatavideobackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 16 | -------------------------------------------------------------------------------- /browsingbackends/metadatavideobackend/metadatavideobackend.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2009 by Alessandro Diaferia * 3 | * Copyright 2011 Sinny Kumari 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 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 19 | ***************************************************************************/ 20 | 21 | #ifndef METADATAVIDEOBACKEND_H 22 | #define METADATAVIDEOBACKEND_H 23 | 24 | #include "mediacenter/abstractbrowsingbackend.h" 25 | 26 | class MetadataVideoBackend : public MediaCenter::AbstractBrowsingBackend 27 | { 28 | Q_OBJECT 29 | public: 30 | MetadataVideoBackend (QObject* parent, const QVariantList& args); 31 | virtual ~MetadataVideoBackend(); 32 | 33 | void search(const QString& searchTerm) Q_DECL_OVERRIDE; 34 | 35 | protected: 36 | bool initImpl() Q_DECL_OVERRIDE; 37 | }; 38 | 39 | #endif // METADATAVIDEOBACKEND_H 40 | -------------------------------------------------------------------------------- /browsingbackends/metadatavideobackend/metadatavideomodel.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2011 Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | 21 | #include "metadatavideomodel.h" 22 | 23 | class MetadataVideoModel::Private 24 | { 25 | public: 26 | int thumbnailKey; 27 | }; 28 | 29 | MetadataVideoModel::MetadataVideoModel(QObject* parent) 30 | : PmcMetadataModel(parent) 31 | , d(new Private()) 32 | { 33 | showMediaType(MediaCenter::Video); 34 | } 35 | 36 | MetadataVideoModel::~MetadataVideoModel() 37 | { 38 | delete d; 39 | } 40 | 41 | QVariant MetadataVideoModel::data(const QModelIndex& index, int role) const 42 | { 43 | switch (role) { 44 | case MediaCenter::MediaTypeRole: 45 | return "video"; 46 | case MediaCenter::HideLabelRole: 47 | return false; 48 | } 49 | 50 | return PmcMetadataModel::data(index, role); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /browsingbackends/metadatavideobackend/metadatavideomodel.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2011 Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | #ifndef METADATAVIDEOMODEL_H 21 | #define METADATAVIDEOMODEL_H 22 | 23 | #include 24 | 25 | #include "mediacenter/pmcmetadatamodel.h" 26 | 27 | class MetadataVideoModel : public PmcMetadataModel 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit MetadataVideoModel(QObject* parent = 0); 32 | virtual ~MetadataVideoModel(); 33 | 34 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 35 | 36 | private: 37 | class Private; 38 | Private* const d; 39 | }; 40 | 41 | #endif // METADATAVIDEOMODEL_H 42 | -------------------------------------------------------------------------------- /components/AutoHide.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | import QtQuick 2.3 21 | 22 | Item { 23 | id: root 24 | property bool inhibit 25 | property bool shouldHide 26 | 27 | Timer { 28 | id: timer 29 | interval: 1000 30 | running: true 31 | 32 | onTriggered: { 33 | shouldHide = true; 34 | stop(); 35 | } 36 | } 37 | 38 | onInhibitChanged: if (inhibit) { 39 | shouldHide = false; 40 | timer.stop(); 41 | } else { 42 | timer.start(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /components/BreezeBlock.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2014 by David Edmundson * 3 | * Copyright (C) 2014 by Aleix Pol Gonzalez * 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 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 19 | ***************************************************************************/ 20 | 21 | import QtQuick 2.1 22 | 23 | import org.kde.plasma.core 2.0 as PlasmaCore 24 | 25 | PlasmaCore.ColorScope { 26 | colorGroup: PlasmaCore.Theme.ComplementaryColorGroup 27 | 28 | Rectangle { 29 | color: PlasmaCore.ColorScope.backgroundColor 30 | opacity: 0.95 31 | radius: 2 32 | anchors { 33 | fill: parent 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /components/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/components) 2 | install(FILES CategoriesBrowser.qml DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/components) 3 | install(FILES MediaInfoPanel.qml DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/components) 4 | install(FILES AutoHide.qml DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/components) 5 | install(FILES BreezeBlock.qml DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/components) 6 | install(DIRECTORY common DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/components) 7 | -------------------------------------------------------------------------------- /components/qmldir: -------------------------------------------------------------------------------- 1 | TabBrowser 2.0 tabbrowser/TabBrowser.qml 2 | CategoriesBrowser 2.0 CategoriesBrowser.qml 3 | AutoHide 2.0 AutoHide.qml 4 | BreezeBlock 2.0 BreezeBlock.qml 5 | MediaItemDelegate 2.0 common/MediaItemDelegate.qml 6 | -------------------------------------------------------------------------------- /config-plasma-mediacenter.h.cmake: -------------------------------------------------------------------------------- 1 | #define PROJECT_VERSION "${PROJECT_VERSION}" 2 | #define PROJECT_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}" 3 | -------------------------------------------------------------------------------- /datasources/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(baloosearch) 2 | add_subdirectory(filesystemsearch) 3 | add_subdirectory(lastfm) 4 | -------------------------------------------------------------------------------- /datasources/baloosearch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT KF5Baloo_FOUND) 2 | return() 3 | endif() 4 | find_package(KF5FileMetaData REQUIRED) 5 | 6 | set(baloosearch_SRCS 7 | audiosearchresulthandler.cpp 8 | videosearchresulthandler.cpp 9 | imagesearchresulthandler.cpp 10 | searchresulthandler.cpp 11 | baloosearchmediasource.cpp 12 | ) 13 | 14 | add_library(pmc_baloosearch MODULE ${baloosearch_SRCS}) 15 | set_target_properties(pmc_baloosearch PROPERTIES PREFIX "") 16 | 17 | target_link_libraries(pmc_baloosearch 18 | plasmamediacenter 19 | Qt5::DBus 20 | KF5::Baloo 21 | KF5::FileMetaData 22 | ) 23 | 24 | kcoreaddons_desktop_to_json(pmc_baloosearch baloosearch.desktop) 25 | 26 | install(TARGETS pmc_baloosearch DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/datasources) 27 | -------------------------------------------------------------------------------- /datasources/baloosearch/audiosearchresulthandler.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef AUDIOSEARCHRESULTHANDLER_H 19 | #define AUDIOSEARCHRESULTHANDLER_H 20 | 21 | #include "searchresulthandler.h" 22 | 23 | #include 24 | 25 | class MediaLibrary; 26 | 27 | class AudioSearchResultHandler : public SearchResultHandler 28 | { 29 | Q_OBJECT 30 | public: 31 | AudioSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent); 32 | QString supportedMediaType() const Q_DECL_OVERRIDE; 33 | QString supportedMimeType() const Q_DECL_OVERRIDE; 34 | 35 | protected: 36 | void handleResultImpl(const QString& filePath, 37 | const QHash< int, QVariant >& values) Q_DECL_OVERRIDE; 38 | }; 39 | 40 | #endif // AUDIOSEARCHRESULTHANDLER_H 41 | -------------------------------------------------------------------------------- /datasources/baloosearch/baloosearchmediasource.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Sinny Kumari ` * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef BALOOSEARCHMEDIASOURCE_H 19 | #define BALOOSEARCHMEDIASOURCE_H 20 | 21 | #include 22 | 23 | class SearchResultHandler; 24 | 25 | class BalooSearchMediaSource : public MediaCenter::AbstractDataSource 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit BalooSearchMediaSource(QObject* parent = 0, const QVariantList& args = QVariantList()); 30 | QHash< QString, QStringList > medialist; 31 | 32 | protected: 33 | void run() Q_DECL_OVERRIDE; 34 | 35 | private Q_SLOTS: 36 | void startQuerying(); 37 | void handleNewFile(const QStringList &files); 38 | 39 | private: 40 | QHash m_searchResultHandlers; 41 | QHash m_searchResultHandlersByMimeType; 42 | 43 | void queryForMediaType(const QString &type); 44 | QStringList m_allowedMimes; 45 | }; 46 | 47 | #endif // BALOOSEARCHMEDIASOURCE_H 48 | -------------------------------------------------------------------------------- /datasources/baloosearch/imagesearchresulthandler.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef IMAGESEARCHRESULTHANDLER_H 19 | #define IMAGESEARCHRESULTHANDLER_H 20 | 21 | #include "searchresulthandler.h" 22 | 23 | #include 24 | 25 | class ImageSearchResultHandler : public SearchResultHandler 26 | { 27 | Q_OBJECT 28 | public: 29 | ImageSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent); 30 | QString supportedMediaType() const Q_DECL_OVERRIDE; 31 | QString supportedMimeType() const Q_DECL_OVERRIDE; 32 | 33 | protected: 34 | void handleResultImpl(const QString& filePath, 35 | const QHash< int, QVariant >& values) Q_DECL_OVERRIDE; 36 | 37 | private: 38 | unsigned int m_minimumImageSize; 39 | QHash> m_initialValuesByUrl; 40 | }; 41 | 42 | #endif // IMAGESEARCHRESULTHANDLER_H 43 | -------------------------------------------------------------------------------- /datasources/baloosearch/searchresulthandler.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef SEARCHRESULTHANDLER_H 19 | #define SEARCHRESULTHANDLER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace Baloo { 26 | class ResultIterator; 27 | } 28 | 29 | class MediaLibrary; 30 | 31 | class SearchResultHandler : public QObject 32 | { 33 | Q_OBJECT 34 | public: 35 | SearchResultHandler(MediaLibrary *mediaLibrary, QObject* parent); 36 | virtual QString supportedMediaType() const = 0; 37 | virtual QString supportedMimeType() const = 0; 38 | 39 | virtual void handleResult(QString &filePath); 40 | 41 | protected: 42 | MediaLibrary *m_mediaLibrary; 43 | 44 | virtual void handleResultImpl(const QString &filePath, 45 | const QHash &values) = 0; 46 | }; 47 | 48 | #endif // SEARCHRESULTHANDLER_H 49 | -------------------------------------------------------------------------------- /datasources/baloosearch/videosearchresulthandler.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef VIDEOSEARCHRESULTHANDLER_H 19 | #define VIDEOSEARCHRESULTHANDLER_H 20 | 21 | #include "searchresulthandler.h" 22 | 23 | #include 24 | 25 | class VideoSearchResultHandler : public SearchResultHandler 26 | { 27 | Q_OBJECT 28 | public: 29 | VideoSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent); 30 | QString supportedMediaType() const Q_DECL_OVERRIDE; 31 | QString supportedMimeType() const Q_DECL_OVERRIDE; 32 | 33 | protected: 34 | void handleResultImpl(const QString& filePath, 35 | const QHash< int, QVariant >& values) Q_DECL_OVERRIDE; 36 | }; 37 | 38 | #endif // VIDEOSEARCHRESULTHANDLER_H 39 | -------------------------------------------------------------------------------- /datasources/filesystemsearch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(filesystemsearch_SRCS 2 | filesystemsearchmediasource.cpp 3 | ) 4 | 5 | add_library(pmc_filesystemsearch MODULE ${filesystemsearch_SRCS}) 6 | set_target_properties(pmc_filesystemsearch PROPERTIES PREFIX "") 7 | 8 | target_link_libraries(pmc_filesystemsearch 9 | plasmamediacenter 10 | ) 11 | 12 | kcoreaddons_desktop_to_json(pmc_filesystemsearch filesystemsearch.desktop) 13 | 14 | install(TARGETS pmc_filesystemsearch DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/datasources) 15 | -------------------------------------------------------------------------------- /datasources/filesystemsearch/filesystemsearchmediasource.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef FILESYSTEMSEARCHMEDIASOURCE_H 19 | #define FILESYSTEMSEARCHMEDIASOURCE_H 20 | 21 | #include 22 | 23 | #include 24 | 25 | class QFileInfo; 26 | class QDir; 27 | 28 | /** 29 | * \brief Goes through the user's home dir and searches for media 30 | * 31 | * This MediaSource is supposed to be used for a better-than-nothing scenario 32 | * when none of Baloo or Nepomuk are installed. As such this MediaSource does 33 | * not attempt 100% correctness and is not configurable at all. 34 | */ 35 | class FilesystemSearchMediaSource : public MediaCenter::AbstractDataSource 36 | { 37 | public: 38 | explicit FilesystemSearchMediaSource(QObject* parent = 0, const QVariantList& = QVariantList()); 39 | virtual ~FilesystemSearchMediaSource(); 40 | 41 | protected: 42 | void run() Q_DECL_OVERRIDE; 43 | 44 | private: 45 | mutable QMutex m_quitMutex; 46 | bool m_quit; 47 | 48 | QStringList m_allowedMimes; 49 | 50 | bool shouldQuit() const; 51 | bool recursiveSearch(const QDir& dir); 52 | void stop(); 53 | bool checkAndAddFile(const QFileInfo &fileInfo); 54 | void addFile(const QFileInfo &fileInfo, const QString &type); 55 | }; 56 | 57 | #endif // FILESYSTEMSEARCHMEDIASOURCE_H 58 | -------------------------------------------------------------------------------- /datasources/lastfm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(lastfm_SRCS 2 | lastfmimagefetcher.cpp 3 | ) 4 | 5 | add_library(pmc_lastfm MODULE ${lastfm_SRCS}) 6 | set_target_properties(pmc_lastfm PROPERTIES PREFIX "") 7 | 8 | target_link_libraries(pmc_lastfm 9 | plasmamediacenter 10 | ) 11 | 12 | kcoreaddons_desktop_to_json(pmc_lastfm lastfmimagefetcher.desktop) 13 | 14 | install(TARGETS pmc_lastfm DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/datasources) 15 | -------------------------------------------------------------------------------- /datasources/lastfm/lastfmimagefetcher.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Service 3 | Name=LastFmImageFetcher 4 | Name[ca]=LastFmImageFetcher 5 | Name[ca@valencia]=LastFmImageFetcher 6 | Name[da]=LastFmImageFetcher 7 | Name[de]=LastFmImageFetcher 8 | Name[el]=LastFmImageFetcher 9 | Name[en_GB]=LastFmImageFetcher 10 | Name[es]=Extractor de imágenes de LastFM 11 | Name[et]=LastFmImageFetcher 12 | Name[eu]=LastFmImageFetcher 13 | Name[fi]=LastFmImageFetcher 14 | Name[fr]=LastFmImageFetcher 15 | Name[gl]=LastFmImageFetcher 16 | Name[id]=LastFmCitraFetcher 17 | Name[it]=RecuperoImmaginiLastFm 18 | Name[ko]=LastFmImageFetcher 19 | Name[nl]=LastFmImageFetcher 20 | Name[nn]=LastFmImageFetcher 21 | Name[pl]=LastFmImageFetcher 22 | Name[pt]=LastFmImageFetcher 23 | Name[pt_BR]=LastFmImageFetcher 24 | Name[ru]=Обложки с Last.fm 25 | Name[sk]=LastFmImageFetcher 26 | Name[sl]=LastFmImageFetcher 27 | Name[sr]=Добављач слика са ЛастФМ‑а 28 | Name[sr@ijekavian]=Добављач слика са ЛастФМ‑а 29 | Name[sr@ijekavianlatin]=Dobavljač slika sa last.fm‑a 30 | Name[sr@latin]=Dobavljač slika sa last.fm‑a 31 | Name[sv]=Senaste FM-bildhämtare 32 | Name[tr]=LastFmResimGetirici 33 | Name[uk]=Засіб отримання зображень з LastFm 34 | Name[x-test]=xxLastFmImageFetcherxx 35 | Name[zh_CN]=获取 LastFm 图片 36 | Name[zh_TW]=LastFmImageFetcher 37 | 38 | X-KDE-ServiceTypes=Plasma/MediaCenter/DataSource 39 | 40 | X-KDE-PluginInfo-Name=lastfm 41 | X-KDE-PluginInfo-Author=Shantanu Tushar 42 | X-KDE-PluginInfo-Email=shantanu@kde.org 43 | X-KDE-PluginInfo-Version=1.0 44 | X-KDE-PluginInfo-License=GPL 45 | X-KDE-PluginInfo-EnabledByDefault=true 46 | X-KDE-Library=pmc_lastfm 47 | -------------------------------------------------------------------------------- /images/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ecm_install_icons( ${ICON_INSTALL_DIR} ) 2 | -------------------------------------------------------------------------------- /images/hi64-actions-pmc-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/plasma-mediacenter/22d416c448c75b323d1f41ace9318eab153778dc/images/hi64-actions-pmc-back.png -------------------------------------------------------------------------------- /libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(mediacenter) 2 | -------------------------------------------------------------------------------- /libs/mediacenter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ECMMarkAsTest) 2 | include_directories( 3 | ${TAGLIB_INCLUDES} 4 | ) 5 | set (plasmamediacenter_SRCS 6 | iconimageprovider.cpp 7 | runtimedata.cpp 8 | itemcache.cpp 9 | medialibrarywrappercache.cpp 10 | artist.cpp 11 | album.cpp 12 | media.cpp 13 | pmcmodel.cpp 14 | objectpair.cpp 15 | mediacenter.cpp 16 | abstractbrowsingbackend.cpp 17 | backendsmodel.cpp 18 | playlistitem.cpp 19 | playlistmodel.cpp 20 | pmccoverartprovider.cpp 21 | pmcmetadatamodel.cpp 22 | pmcimagecache.cpp 23 | subtitleprovider.cpp 24 | filterplaylistmodel.cpp 25 | multipleplaylistmodel.cpp 26 | medialibrary.cpp 27 | pmcmedia.cpp 28 | pmcalbum.cpp 29 | pmcartist.cpp 30 | filtermediamodel.cpp 31 | abstractdatasource.cpp 32 | datasourcesloader.cpp 33 | singletonfactory.cpp 34 | mediavalidator.cpp 35 | settings.cpp 36 | localthumbnailprovider.cpp 37 | mediabrowserloader.cpp 38 | mpris2/mpris2.cpp 39 | mpris2/mediaplayer2.cpp 40 | mpris2/mediaplayer2player.cpp 41 | mpris2/mediaplayer2tracklist.cpp 42 | ) 43 | 44 | add_library(plasmamediacenter SHARED 45 | ${plasmamediacenter_SRCS} 46 | ) 47 | 48 | 49 | set(plasmamediacenter_link_libs 50 | Qt5::Core 51 | Qt5::Quick 52 | Qt5::Xml 53 | Qt5::DBus 54 | KF5::I18n 55 | KF5::ConfigCore 56 | KF5::GuiAddons 57 | KF5::CoreAddons 58 | KF5::Service 59 | KF5::Activities 60 | KF5::KIOWidgets 61 | KF5::Plasma 62 | ${TAGLIB_LIBRARIES} 63 | ) 64 | 65 | target_link_libraries(plasmamediacenter 66 | ${plasmamediacenter_link_libs} 67 | ) 68 | 69 | generate_export_header(plasmamediacenter 70 | BASE_NAME mediacenter 71 | EXPORT_MACRO_NAME MEDIACENTER_EXPORT 72 | ) 73 | 74 | add_library(plasmamediacentertest SHARED 75 | ${plasmamediacenter_SRCS} 76 | ) 77 | 78 | ecm_mark_as_test(plasmamediacentertest) 79 | 80 | set_target_properties(plasmamediacentertest 81 | PROPERTIES COMPILE_FLAGS -fvisibility=default 82 | ) 83 | 84 | target_link_libraries(plasmamediacentertest 85 | ${plasmamediacenter_link_libs} 86 | ) 87 | 88 | set_target_properties(plasmamediacenter PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) 89 | 90 | install(TARGETS plasmamediacenter ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) 91 | 92 | install(FILES data/servicetypes/pmc_browsingbackend.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) 93 | install(FILES data/servicetypes/pmc_datasource.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) 94 | 95 | add_subdirectory(plugin) 96 | -------------------------------------------------------------------------------- /libs/mediacenter/abstractdatasource.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * Copyright 2014 Sinny Kumari * 4 | * * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Lesser General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2.1 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library. If not, see . * 18 | ***********************************************************************************/ 19 | 20 | #include "abstractdatasource.h" 21 | #include 22 | 23 | using namespace MediaCenter; 24 | 25 | class AbstractDataSource::Private 26 | { 27 | public: 28 | Private() : mediaLibrary(0) {} 29 | MediaLibrary* mediaLibrary; 30 | }; 31 | 32 | AbstractDataSource::AbstractDataSource(QObject* parent, const QVariantList&) 33 | : QThread(parent), d(new Private) 34 | { 35 | moveToThread(this); 36 | } 37 | 38 | AbstractDataSource::~AbstractDataSource() 39 | { 40 | 41 | } 42 | 43 | void AbstractDataSource::setMediaLibrary(MediaLibrary* mediaLibrary) 44 | { 45 | d->mediaLibrary = mediaLibrary; 46 | } 47 | 48 | MediaLibrary* AbstractDataSource::mediaLibrary() const 49 | { 50 | return d->mediaLibrary; 51 | } 52 | -------------------------------------------------------------------------------- /libs/mediacenter/abstractdatasource.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * Copyright 2014 Sinny Kumari * 4 | * * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Lesser General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2.1 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library. If not, see . * 18 | ***********************************************************************************/ 19 | 20 | #ifndef ABSTRACTDATASOURCE_H 21 | #define ABSTRACTDATASOURCE_H 22 | 23 | #include 24 | #include 25 | 26 | #include "mediacenter_export.h" 27 | 28 | class MediaLibrary; 29 | 30 | namespace MediaCenter { 31 | class MEDIACENTER_EXPORT AbstractDataSource : public QThread 32 | { 33 | Q_OBJECT 34 | public: 35 | explicit AbstractDataSource(QObject* parent = 0, const QVariantList& = QVariantList()); 36 | ~AbstractDataSource(); 37 | 38 | void setMediaLibrary(MediaLibrary *mediaLibrary); 39 | 40 | protected: 41 | MediaLibrary *mediaLibrary() const; 42 | 43 | private: 44 | class Private; 45 | Private * const d; 46 | }; 47 | } 48 | 49 | #define MEDIACENTER_EXPORT_DATASOURCE(classname, jsonfile) \ 50 | K_PLUGIN_FACTORY_WITH_JSON( DataSourceFactory, jsonfile, registerPlugin< classname >(); ) 51 | 52 | #endif // ABSTRACTDATASOURCE_H 53 | -------------------------------------------------------------------------------- /libs/mediacenter/album.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "album.h" 20 | 21 | #include "media.h" 22 | 23 | #include "artist.h" 24 | 25 | Album::Album(const QString& name, const QSharedPointer& albumArtist) 26 | : m_albumArtist(albumArtist) 27 | , m_name(name) 28 | { 29 | } 30 | 31 | const QString& Album::name() const 32 | { 33 | return m_name; 34 | } 35 | 36 | QString Album::albumArtist() const 37 | { 38 | return m_albumArtist->name(); 39 | } 40 | 41 | void Album::addMedia(const QSharedPointer& media) 42 | { 43 | m_media.append(media); 44 | emit updated(); 45 | } 46 | 47 | void Album::removeMedia(const QSharedPointer& media) 48 | { 49 | m_media.removeOne(media); 50 | emit updated(); 51 | } 52 | 53 | QList< QSharedPointer > Album::media() const 54 | { 55 | return m_media; 56 | } 57 | -------------------------------------------------------------------------------- /libs/mediacenter/album.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef ALBUM_H 20 | #define ALBUM_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class Artist; 27 | class Media; 28 | 29 | class Album : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit Album(const QString &name, const QSharedPointer &artist); 34 | 35 | const QString& name() const; 36 | 37 | QString albumArtist() const; 38 | 39 | void addMedia(const QSharedPointer &media); 40 | void removeMedia(const QSharedPointer &media); 41 | QList< QSharedPointer > media() const; 42 | 43 | signals: 44 | void updated(); 45 | 46 | private: 47 | QSharedPointer m_albumArtist; 48 | QString m_name; 49 | QList< QSharedPointer > m_media; 50 | }; 51 | 52 | #endif // ALBUM_H 53 | -------------------------------------------------------------------------------- /libs/mediacenter/artist.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "artist.h" 20 | 21 | #include "media.h" 22 | 23 | Artist::Artist(const QString& name) 24 | : m_name(name) 25 | { 26 | } 27 | 28 | const QString& Artist::name() const 29 | { 30 | return m_name; 31 | } 32 | 33 | void Artist::addMedia(const QSharedPointer& media) 34 | { 35 | m_media.append(media); 36 | emit updated(); 37 | } 38 | 39 | void Artist::removeMedia(const QSharedPointer& media) 40 | { 41 | m_media.removeOne(media); 42 | emit updated(); 43 | } 44 | 45 | QList< QSharedPointer > Artist::media() const 46 | { 47 | return m_media; 48 | } 49 | -------------------------------------------------------------------------------- /libs/mediacenter/artist.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef ARTIST_H 20 | #define ARTIST_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class Media; 27 | 28 | class Artist : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit Artist(const QString &name); 33 | 34 | const QString& name() const; 35 | 36 | void addMedia(const QSharedPointer &media); 37 | void removeMedia(const QSharedPointer &media); 38 | QList< QSharedPointer > media() const; 39 | 40 | signals: 41 | void updated(); 42 | 43 | private: 44 | QString m_name; 45 | QList< QSharedPointer > m_media; 46 | }; 47 | 48 | #endif // ARTIST_H 49 | -------------------------------------------------------------------------------- /libs/mediacenter/backendsmodel.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2012 Sinny Kumari * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef BACKENDSMODEL_H 20 | #define BACKENDSMODEL_H 21 | 22 | #include "mediacenter_export.h" 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace MediaCenter { 29 | class AbstractBrowsingBackend; 30 | } 31 | 32 | class MEDIACENTER_EXPORT BackendsModel : public QAbstractListModel 33 | { 34 | Q_OBJECT 35 | public: 36 | enum Roles { 37 | ModelObjectRole = Qt::UserRole + 1, 38 | BackendCategoryRole 39 | }; 40 | explicit BackendsModel (QObject* parent = 0); 41 | QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 42 | int rowCount (const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; 43 | 44 | private: 45 | class Private; 46 | Private * const d; 47 | 48 | void loadBrowsingBackends(); 49 | }; 50 | 51 | Q_DECLARE_METATYPE(BackendsModel*) 52 | 53 | #endif // BACKENDSMODEL_H 54 | -------------------------------------------------------------------------------- /libs/mediacenter/data/servicetypes/pmc_browsingbackend.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=ServiceType 3 | X-KDE-ServiceType=Plasma/MediaCenter/BrowsingBackend 4 | -------------------------------------------------------------------------------- /libs/mediacenter/data/servicetypes/pmc_datasource.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=ServiceType 3 | X-KDE-ServiceType=Plasma/MediaCenter/DataSource 4 | -------------------------------------------------------------------------------- /libs/mediacenter/datasourcesloader.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * Copyright 2014 Sinny Kumari * 4 | * * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Lesser General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2.1 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library. If not, see . * 18 | ***********************************************************************************/ 19 | 20 | #ifndef DATASOURCESLOADER_H 21 | #define DATASOURCESLOADER_H 22 | 23 | #include 24 | 25 | #include "mediacenter_export.h" 26 | 27 | namespace MediaCenter { 28 | class AbstractDataSource; 29 | } 30 | 31 | class MEDIACENTER_EXPORT DataSourcesLoader : public QObject 32 | { 33 | Q_OBJECT 34 | public: 35 | explicit DataSourcesLoader(QObject* parent = 0); 36 | 37 | public Q_SLOTS: 38 | void load(); 39 | }; 40 | 41 | #endif // DATASOURCESLOADER_H 42 | -------------------------------------------------------------------------------- /libs/mediacenter/filtermediamodel.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Sinny Kumari * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef FILTERMEDIAMODEL_H 20 | #define FILTERMEDIAMODEL_H 21 | 22 | #include 23 | #include 24 | 25 | #include "mediacenter_export.h" 26 | 27 | class MEDIACENTER_EXPORT FilterMediaModel: public QSortFilterProxyModel 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit FilterMediaModel(QObject* parent = 0); 32 | ~FilterMediaModel(); 33 | 34 | void setFilter(int role, const QVariant &filterValue); 35 | void addFilter(int role, const QVariant &filterValue); 36 | void clearFilters(bool invalidate = true); 37 | 38 | protected: 39 | bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const Q_DECL_OVERRIDE; 40 | 41 | private: 42 | QHash m_filters; 43 | }; 44 | 45 | #endif // FILTERMEDIAMODEL_H 46 | -------------------------------------------------------------------------------- /libs/mediacenter/iconimageprovider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2014 Shantanu Tushar 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | */ 20 | 21 | #include "iconimageprovider.h" 22 | 23 | #include 24 | #include 25 | 26 | const char *IconImageProvider::identificationString = "icon"; 27 | 28 | IconImageProvider::IconImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) 29 | { 30 | } 31 | 32 | QPixmap IconImageProvider::requestPixmap(const QString& id, QSize* size, 33 | const QSize& requestedSize) 34 | { 35 | *size = requestedSize; 36 | return QIcon::fromTheme(id).pixmap(requestedSize); 37 | } 38 | -------------------------------------------------------------------------------- /libs/mediacenter/iconimageprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2014 Shantanu Tushar 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | */ 20 | 21 | #ifndef ICONIMAGEPROVIDER_H 22 | #define ICONIMAGEPROVIDER_H 23 | 24 | #include 25 | 26 | #include "mediacenter_export.h" 27 | 28 | class MEDIACENTER_EXPORT IconImageProvider : public QQuickImageProvider 29 | { 30 | public: 31 | static const char *identificationString; 32 | 33 | IconImageProvider(); 34 | QPixmap requestPixmap(const QString& id, QSize* size, const QSize& requestedSize) Q_DECL_OVERRIDE; 35 | }; 36 | 37 | #endif // ICONIMAGEPROVIDER_H 38 | -------------------------------------------------------------------------------- /libs/mediacenter/itemcache.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "itemcache.h" 20 | #include "artist.h" 21 | #include "album.h" 22 | 23 | QSharedPointer< Album > ItemCache::getAlbumByName(const QString& albumName, 24 | const QString& artistName, 25 | bool create) 26 | { 27 | auto albumArtistPair = QPair(albumName, artistName); 28 | 29 | if (!m_albums.contains(albumArtistPair) && create) { 30 | m_albums.insert(QPair(albumName, artistName), 31 | QSharedPointer(new Album(albumName, getArtistByName(artistName)))); 32 | } 33 | 34 | return m_albums.value(albumArtistPair); 35 | } 36 | 37 | QSharedPointer< Artist > ItemCache::getArtistByName(const QString& name, bool create) 38 | { 39 | if (!m_artists.contains(name) && create) { 40 | m_artists.insert(name, QSharedPointer(new Artist(name))); 41 | } 42 | 43 | return m_artists.value(name); 44 | } 45 | -------------------------------------------------------------------------------- /libs/mediacenter/itemcache.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef ITEMCACHE_H 20 | #define ITEMCACHE_H 21 | 22 | #include 23 | #include 24 | 25 | class Album; 26 | class Artist; 27 | 28 | class ItemCache 29 | { 30 | public: 31 | QSharedPointer getArtistByName(const QString &name, bool create = true); 32 | QSharedPointer getAlbumByName(const QString &albumName, 33 | const QString &artistName, 34 | bool create = true); 35 | private: 36 | QHash> m_artists; 37 | QHash, QSharedPointer> m_albums; 38 | }; 39 | 40 | #endif // ITEMCACHE_H 41 | -------------------------------------------------------------------------------- /libs/mediacenter/mediabrowserloader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #include "mediabrowserloader.h" 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | MediaBrowserLoader::MediaBrowserLoader(QObject *parent) 29 | : QObject(parent) 30 | { 31 | } 32 | 33 | MediaBrowserLoader::~MediaBrowserLoader() 34 | { 35 | } 36 | 37 | QString MediaBrowserLoader::getMediaBrowser(const QString &pluginName) const 38 | { 39 | Plasma::Package package = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); 40 | package.setPath(pluginName); 41 | 42 | if(!package.isValid() || !package.metadata().isValid()) { 43 | package.setPath("invalidbrowser"); 44 | } 45 | 46 | QUrl filePath = QUrl::fromLocalFile(package.filePath("mainscript")); 47 | return filePath.toString(); 48 | } 49 | -------------------------------------------------------------------------------- /libs/mediacenter/mediabrowserloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #ifndef MEDIABROWSERLOADER_H 22 | #define MEDIABROWSERLOADER_H 23 | 24 | #include 25 | #include 26 | 27 | #include "mediacenter_export.h" 28 | 29 | class MEDIACENTER_EXPORT MediaBrowserLoader : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit MediaBrowserLoader(QObject *parent = 0); 34 | ~MediaBrowserLoader(); 35 | 36 | Q_INVOKABLE QString getMediaBrowser(const QString &name) const; 37 | }; 38 | 39 | #endif /* MEDIABROWSERLOADER_H */ 40 | -------------------------------------------------------------------------------- /libs/mediacenter/mediacenter.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2009-2010 by Alessandro Diaferia * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef MEDIACENTER_H 20 | #define MEDIACENTER_H 21 | 22 | #include "mediacenter_export.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace MediaCenter { 30 | 31 | enum AdditionalMediaRoles { 32 | MediaUrlRole = Qt::UserRole + 1, 33 | IsExpandableRole, 34 | MediaTypeRole, 35 | DecorationTypeRole, 36 | HideLabelRole, 37 | ResourceIdRole, 38 | DurationRole, 39 | ArtistRole, 40 | AlbumRole, 41 | AlbumArtistRole, 42 | CreatedAtRole, 43 | GenreRole, 44 | MediaCountRole, 45 | RatingRole, 46 | AdditionalRoles //If additional roles are needed to be defined 47 | }; 48 | 49 | enum MediaType { 50 | Music, 51 | Picture, 52 | Video 53 | }; 54 | 55 | MEDIACENTER_EXPORT QHash appendAdditionalMediaRoles (const QHash &roles); 56 | MEDIACENTER_EXPORT QString dataDirForComponent (const QString &component = QString()); 57 | } // namespace MediaCenter 58 | 59 | #endif // MEDIACENTER_H 60 | -------------------------------------------------------------------------------- /libs/mediacenter/medialibrarywrappercache.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef MEDIALIBRARYWRAPPERCACHE_H 20 | #define MEDIALIBRARYWRAPPERCACHE_H 21 | 22 | #include 23 | #include 24 | 25 | class PmcMedia; 26 | class PmcAlbum; 27 | class PmcArtist; 28 | class MediaLibrary; 29 | 30 | class MediaLibraryWrapperCache : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit MediaLibraryWrapperCache(MediaLibrary *parent); 35 | virtual ~MediaLibraryWrapperCache(); 36 | 37 | QList< QSharedPointer< PmcAlbum > > getAlbums() const; 38 | QList< QSharedPointer< PmcArtist > > getArtists() const; 39 | QList< QSharedPointer< PmcMedia > > getMedia(const QString &type); 40 | 41 | private slots: 42 | void saveNewAlbums(const QList< QSharedPointer< PmcAlbum > >& albums); 43 | void saveNewArtists(const QList< QSharedPointer< PmcArtist > >& artists); 44 | void removeMediaRef(QSharedPointer media); 45 | void removeAlbumRef(); 46 | void removeArtistRef(); 47 | 48 | private: 49 | class Private; 50 | Private * const d; 51 | public slots: 52 | void saveNewMedia(const QList< QSharedPointer< PmcMedia > >& media); 53 | }; 54 | 55 | #endif // MEDIALIBRARYWRAPPERCACHE_H 56 | -------------------------------------------------------------------------------- /libs/mediacenter/mediavalidator.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "mediavalidator.h" 20 | 21 | #include 22 | #include 23 | 24 | MediaValidator::MediaValidator(QObject* parent): QObject(parent) 25 | { 26 | 27 | } 28 | 29 | bool MediaValidator::fileWithUrlExists(const QString& url) 30 | { 31 | return QFile::exists(QUrl(url).toLocalFile()); 32 | } 33 | -------------------------------------------------------------------------------- /libs/mediacenter/mediavalidator.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef MEDIAVALIDATOR_H 20 | #define MEDIAVALIDATOR_H 21 | 22 | #include 23 | 24 | class QString; 25 | 26 | #include "mediacenter_export.h" 27 | 28 | class MEDIACENTER_EXPORT MediaValidator : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit MediaValidator(QObject* parent = 0); 33 | 34 | virtual bool fileWithUrlExists(const QString &url); 35 | }; 36 | 37 | #endif // MEDIAVALIDATOR_H 38 | -------------------------------------------------------------------------------- /libs/mediacenter/mpris2/mpris2.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2014 Sujith Haridasan * 3 | * Copyright 2014 Ashish Madeti * 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 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 19 | ***************************************************************************/ 20 | 21 | #ifndef MEDIACENTER_MPRIS2_H 22 | #define MEDIACENTER_MPRIS2_H 23 | 24 | #include "mediacenter_export.h" 25 | #include "mediacenter/playlistmodel.h" 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | class MediaPlayer2; 32 | class MediaPlayer2Player; 33 | class MediaPlayer2Tracklist; 34 | 35 | class MEDIACENTER_EXPORT Mpris2 : public QObject 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit Mpris2(PlaylistModel* playlistModel, QObject* parent = 0); 41 | ~Mpris2(); 42 | 43 | MediaPlayer2Player* getMediaPlayer2Player(); 44 | QString getCurrentTrackId(); 45 | QVariantMap getMetadataOf(const QString& url); 46 | QVariantMap getMetadataOf(const QString& url, const QString& trackId); 47 | 48 | signals: 49 | void raisePMC() const; 50 | 51 | private: 52 | MediaPlayer2 *m_mp2; 53 | MediaPlayer2Player *m_mp2p; 54 | MediaPlayer2Tracklist *m_mp2tl; 55 | }; 56 | 57 | #endif //MEDIACENTER_MPRIS2_H 58 | -------------------------------------------------------------------------------- /libs/mediacenter/objectpair.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2013 by Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #include "objectpair.h" 19 | 20 | ObjectPair::ObjectPair(QObject* parent): QObject(parent) 21 | { 22 | } 23 | 24 | QObject* ObjectPair::first() const 25 | { 26 | return m_pair.first; 27 | } 28 | 29 | QObject* ObjectPair::second() const 30 | { 31 | return m_pair.second; 32 | } 33 | 34 | void ObjectPair::setFirst(QObject* object) 35 | { 36 | if (m_pair.first != object) { 37 | m_pair.first = object; 38 | emit firstChanged(); 39 | } 40 | } 41 | 42 | void ObjectPair::setSecond(QObject* object) 43 | { 44 | if (m_pair.second != object) { 45 | m_pair.second = object; 46 | emit secondChanged(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libs/mediacenter/objectpair.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2013 by Shantanu Tushar * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef OBJECTPAIR_H 19 | #define OBJECTPAIR_H 20 | 21 | #include "mediacenter_export.h" 22 | 23 | #include 24 | #include 25 | 26 | class MEDIACENTER_EXPORT ObjectPair : public QObject 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(QObject* first READ first WRITE setFirst NOTIFY firstChanged) 30 | Q_PROPERTY(QObject* second READ second WRITE setSecond NOTIFY secondChanged) 31 | 32 | public: 33 | explicit ObjectPair(QObject* parent = 0); 34 | QObject *first() const; 35 | void setFirst(QObject *object); 36 | 37 | QObject *second() const; 38 | void setSecond(QObject *object); 39 | 40 | signals: 41 | void firstChanged(); 42 | void secondChanged(); 43 | 44 | private: 45 | QPair m_pair; 46 | }; 47 | 48 | #endif // OBJECTPAIR_H 49 | -------------------------------------------------------------------------------- /libs/mediacenter/playlistitem.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2012 by Sinny Kumari * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "playlistitem.h" 20 | #include "singletonfactory.h" 21 | #include "medialibrary.h" 22 | #include "pmcmedia.h" 23 | 24 | const char *PlaylistItem::defaultArtist = "--"; 25 | const int PlaylistItem::defaultLength = -1; 26 | 27 | PlaylistItem::PlaylistItem(const QString& url, QObject* parent) 28 | : QObject(parent) 29 | { 30 | m_media = SingletonFactory::instanceFor()->mediaForUrl(url); 31 | connect(m_media.data(), SIGNAL(updated()), SIGNAL(updated())); 32 | } 33 | 34 | QString PlaylistItem::mediaUrl() const 35 | { 36 | return m_media->url(); 37 | } 38 | 39 | QString PlaylistItem::mediaName() const 40 | { 41 | return m_media->title(); 42 | } 43 | 44 | QString PlaylistItem::mediaArtist() const 45 | { 46 | return m_media->artist(); 47 | } 48 | 49 | int PlaylistItem::mediaLength() const 50 | { 51 | return m_media->duration(); 52 | } 53 | -------------------------------------------------------------------------------- /libs/mediacenter/playlistitem.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2012 by Sinny Kumari * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PLAYLISTITEM_H 20 | #define PLAYLISTITEM_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class PmcMedia; 27 | class MediaInfoResult; 28 | 29 | class PlaylistItem : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | static const char *defaultArtist; 34 | static const int defaultLength; 35 | explicit PlaylistItem(const QString &url, QObject *parent); 36 | 37 | QString mediaUrl() const; 38 | QString mediaName() const; 39 | QString mediaArtist() const; 40 | int mediaLength() const; 41 | 42 | Q_SIGNALS: 43 | void updated(); 44 | 45 | private: 46 | QSharedPointer m_media; 47 | }; 48 | 49 | #endif // PLAYLISTITEM_H 50 | 51 | class MediaInfoResult; 52 | -------------------------------------------------------------------------------- /libs/mediacenter/plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (mediacenterplugin_SRCS 2 | qmlaccess.cpp 3 | mediacenterplugin.cpp 4 | ) 5 | 6 | add_library(mediacenterplugin SHARED ${mediacenterplugin_SRCS} ) 7 | 8 | target_link_libraries(mediacenterplugin 9 | plasmamediacenter 10 | Qt5::Qml 11 | ) 12 | 13 | install(TARGETS mediacenterplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter) 14 | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter) 15 | -------------------------------------------------------------------------------- /libs/mediacenter/plugin/mediacenterplugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #ifndef MEDIACENTERPLUGIN_H 22 | #define MEDIACENTERPLUGIN_H 23 | 24 | #include 25 | #include 26 | 27 | class MediaCenterPlugin : public QQmlExtensionPlugin 28 | { 29 | Q_OBJECT 30 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 31 | 32 | public: 33 | void registerTypes(const char *uri) Q_DECL_OVERRIDE; 34 | void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libs/mediacenter/plugin/qmlaccess.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #include "qmlaccess.h" 22 | #include "mediacenter/medialibrary.h" 23 | #include "mediacenter/mpris2/mpris2.h" 24 | 25 | #include 26 | 27 | QMLAccess::QMLAccess(QObject *parent) : QObject(parent) 28 | { 29 | SingletonFactory::instanceFor()->start(); 30 | 31 | DataSourcesLoader datasourceLoader; 32 | datasourceLoader.load(); 33 | 34 | m_playlistModel = new PlaylistModel(this); 35 | 36 | m_backendsModel = new BackendsModel(this); 37 | 38 | Mpris2 *mprisObject = new Mpris2(m_playlistModel, this); 39 | m_mpris2PlayerAdaptor = mprisObject->getMediaPlayer2Player(); 40 | 41 | emit backendsModelChanged(); 42 | emit playlistModelChanged(); 43 | emit mpris2PlayerAdaptorChanged(); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /libs/mediacenter/plugin/qmlaccess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #ifndef QMLACCESS_H 22 | #define QMLACCESS_H 23 | 24 | #include "mediacenter/playlistmodel.h" 25 | #include "mediacenter/backendsmodel.h" 26 | #include "mediacenter/abstractbrowsingbackend.h" 27 | #include "mediacenter/singletonfactory.h" 28 | #include "mediacenter/datasourcesloader.h" 29 | #include "mediacenter/mpris2/mediaplayer2player.h" 30 | 31 | class QMLAccess : public QObject 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(PlaylistModel *playlistModel READ playlistModel NOTIFY playlistModelChanged) 35 | Q_PROPERTY(BackendsModel *backendsModel READ backendsModel NOTIFY backendsModelChanged) 36 | Q_PROPERTY(QObject *currentBrowsingBackend MEMBER m_currentBrowsingBackend NOTIFY currentBrowsingBackendChanged) 37 | Q_PROPERTY(MediaPlayer2Player *mpris2PlayerAdaptor READ mpris2PlayerAdaptor NOTIFY mpris2PlayerAdaptorChanged) 38 | 39 | Q_SIGNALS: 40 | void playlistModelChanged(); 41 | void backendsModelChanged(); 42 | void currentBrowsingBackendChanged(); 43 | void mpris2PlayerAdaptorChanged(); 44 | 45 | public: 46 | explicit QMLAccess(QObject *parent = 0); 47 | PlaylistModel* playlistModel() { 48 | return m_playlistModel; 49 | } 50 | BackendsModel* backendsModel() { 51 | return m_backendsModel; 52 | } 53 | MediaPlayer2Player* mpris2PlayerAdaptor() { 54 | return m_mpris2PlayerAdaptor; 55 | } 56 | 57 | private: 58 | 59 | PlaylistModel* m_playlistModel; 60 | BackendsModel* m_backendsModel; 61 | QObject* m_currentBrowsingBackend; 62 | MediaPlayer2Player* m_mpris2PlayerAdaptor; 63 | }; 64 | 65 | #endif // QMLACCESS_H 66 | -------------------------------------------------------------------------------- /libs/mediacenter/plugin/qmldir: -------------------------------------------------------------------------------- 1 | module org.kde.plasma.mediacenter 2 | plugin mediacenterplugin -------------------------------------------------------------------------------- /libs/mediacenter/pmcalbum.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "pmcalbum.h" 20 | 21 | #include "album.h" 22 | 23 | class PmcAlbum::Private 24 | { 25 | public: 26 | QSharedPointer< Album > album; 27 | }; 28 | 29 | PmcAlbum::PmcAlbum(const QSharedPointer< Album >& album, QObject* parent) 30 | : QObject(parent) 31 | , d(new Private()) 32 | { 33 | d->album = album; 34 | connect(d->album.data(), &Album::updated, this, &PmcAlbum::updated); 35 | } 36 | 37 | 38 | PmcAlbum::~PmcAlbum() 39 | { 40 | 41 | } 42 | 43 | const QString& PmcAlbum::name() const 44 | { 45 | return d->album->name(); 46 | } 47 | 48 | QString PmcAlbum::albumArtist() const 49 | { 50 | return d->album->albumArtist(); 51 | } 52 | 53 | int PmcAlbum::mediaCount() const 54 | { 55 | return d->album->media().size(); 56 | } 57 | 58 | void PmcAlbum::removeMedia(const QSharedPointer &media) 59 | { 60 | d->album->removeMedia(media); 61 | if (mediaCount() == 0) { 62 | emit removeRefs(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /libs/mediacenter/pmcalbum.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PMCALBUM_H 20 | #define PMCALBUM_H 21 | 22 | #include "mediacenter_export.h" 23 | #include "media.h" 24 | 25 | #include 26 | #include 27 | 28 | class Album; 29 | 30 | class MEDIACENTER_EXPORT PmcAlbum : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit PmcAlbum(const QSharedPointer &album, QObject* parent = 0); 35 | ~PmcAlbum(); 36 | 37 | const QString& name() const; 38 | QString albumArtist() const; 39 | int mediaCount() const; 40 | void removeMedia(const QSharedPointer &media); 41 | 42 | signals: 43 | void updated(); 44 | void removeRefs(); 45 | 46 | private: 47 | class Private; 48 | Private * const d; 49 | }; 50 | 51 | #endif // PMCALBUM_H 52 | -------------------------------------------------------------------------------- /libs/mediacenter/pmcartist.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | 20 | #include "pmcartist.h" 21 | 22 | class PmcArtist::Private 23 | { 24 | public: 25 | QSharedPointer< Artist > artist; 26 | }; 27 | 28 | PmcArtist::PmcArtist(const QSharedPointer< Artist >& artist, QObject* parent) 29 | : QObject(parent) 30 | , d(new Private()) 31 | { 32 | d->artist = artist; 33 | connect(d->artist.data(), &Artist::updated, this, &PmcArtist::updated); 34 | } 35 | 36 | 37 | PmcArtist::~PmcArtist() 38 | { 39 | delete d; 40 | } 41 | 42 | const QString& PmcArtist::name() const 43 | { 44 | return d->artist->name(); 45 | } 46 | 47 | int PmcArtist::mediaCount() const 48 | { 49 | return d->artist->media().size(); 50 | } 51 | 52 | void PmcArtist::removeMedia(const QSharedPointer &media) 53 | { 54 | d->artist->removeMedia(media); 55 | if (mediaCount() == 0) { 56 | emit removeRefs(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /libs/mediacenter/pmcartist.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | 20 | #ifndef PMCARTIST_H 21 | #define PMCARTIST_H 22 | 23 | #include "mediacenter_export.h" 24 | 25 | #include "artist.h" 26 | 27 | #include 28 | #include 29 | 30 | class MEDIACENTER_EXPORT PmcArtist : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit PmcArtist(const QSharedPointer< Artist >& artist, QObject* parent = 0); 35 | virtual ~PmcArtist(); 36 | 37 | const QString& name() const; 38 | int mediaCount() const; 39 | void removeMedia(const QSharedPointer &media); 40 | 41 | signals: 42 | void updated(); 43 | void removeRefs(); 44 | 45 | private: 46 | class Private; 47 | Private * const d; 48 | }; 49 | 50 | #endif // PMCARTIST_H 51 | -------------------------------------------------------------------------------- /libs/mediacenter/pmccoverartprovider.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2012 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PMCCOVERARTPROVIDER_H 20 | #define PMCCOVERARTPROVIDER_H 21 | 22 | #include 23 | 24 | #include "mediacenter_export.h" 25 | 26 | namespace TagLib { 27 | namespace MPEG { 28 | class File; 29 | } 30 | } 31 | 32 | class MEDIACENTER_EXPORT PmcCoverArtProvider : public QQuickImageProvider 33 | { 34 | public: 35 | static const char *identificationString; 36 | 37 | PmcCoverArtProvider (); 38 | QImage requestImage ( const QString& id, QSize* size, 39 | const QSize& requestedSize ) Q_DECL_OVERRIDE; 40 | 41 | static QString qmlImageUriForAlbumCover(const QString &albumName); 42 | static QString qmlImageUriForArtistCover(const QString &artistName); 43 | static QString qmlImageUriForMediaFileCover(const QString &mediaFileUrl); 44 | 45 | private: 46 | /** 47 | * If the cache doesn't yet have an image for this album, add the one we just read 48 | * from the file 49 | */ 50 | void addAlbumCoverToCacheIfMissing(TagLib::MPEG::File& f, const QImage& image) const; 51 | }; 52 | 53 | #endif // PMCCOVERARTPROVIDER_H 54 | -------------------------------------------------------------------------------- /libs/mediacenter/pmcmedia.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Sinny Kumari * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef PMCMEDIA_H 20 | #define PMCMEDIA_H 21 | 22 | #include 23 | #include 24 | 25 | #include "mediacenter_export.h" 26 | 27 | #include "media.h" 28 | 29 | class MEDIACENTER_EXPORT PmcMedia : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit PmcMedia(const QString &url, QObject* parent = 0); 34 | 35 | void setMedia(const QSharedPointer< Media >& media); 36 | 37 | QString sha() const; 38 | QString title () const; 39 | QString url() const; 40 | QString thumbnail() const; 41 | QString type() const; 42 | QString album() const; 43 | QString artist() const; 44 | int duration() const; 45 | int rating() const; 46 | QString genre() const; 47 | QDateTime createdAt() const; 48 | 49 | Q_SIGNALS: 50 | void updated(); 51 | 52 | private: 53 | class Private; 54 | Private * const d; 55 | 56 | QString fileName() const; 57 | }; 58 | 59 | #endif // PMCMEDIA_H 60 | -------------------------------------------------------------------------------- /libs/mediacenter/settings.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2013 by Shantanu Tushar * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | #include "settings.h" 21 | 22 | #include 23 | 24 | Settings::Settings(QObject *parent) : QObject(parent) 25 | { 26 | configGroup = KSharedConfig::openConfig("plasma-mediacenterrc")->group("General"); 27 | } 28 | 29 | Settings::~Settings() 30 | { 31 | sync(); 32 | } 33 | 34 | void Settings::setValue(const QString &key, const QVariant &value) 35 | { 36 | configGroup.writeEntry(key, value); 37 | } 38 | 39 | QVariant Settings::value(const QString &key, const QVariant &defaultValue) const 40 | { 41 | return configGroup.readEntry(key, defaultValue); 42 | } 43 | 44 | void Settings::sync() 45 | { 46 | configGroup.sync(); 47 | } 48 | 49 | bool Settings::contains(const QString &key) const 50 | { 51 | return configGroup.hasKey(key); 52 | } 53 | 54 | void Settings::remove(const QString &key) 55 | { 56 | configGroup.deleteEntry(key); 57 | } 58 | -------------------------------------------------------------------------------- /libs/mediacenter/settings.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2013 by Shantanu Tushar * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | #ifndef SETTINGS_H 21 | #define SETTINGS_H 22 | 23 | #include "mediacenter_export.h" 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | class MEDIACENTER_EXPORT Settings : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit Settings(QObject *parent = 0); 34 | ~Settings(); 35 | 36 | Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; 37 | Q_INVOKABLE void setValue(const QString &key, const QVariant &value); 38 | 39 | Q_INVOKABLE void sync(); 40 | Q_INVOKABLE bool contains(const QString &key) const; 41 | Q_INVOKABLE void remove (const QString &key); 42 | 43 | private: 44 | KConfigGroup configGroup; 45 | }; 46 | 47 | Q_DECLARE_METATYPE(Settings*) 48 | 49 | #endif // SETTINGS_H 50 | -------------------------------------------------------------------------------- /libs/mediacenter/singletonfactory.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #include "singletonfactory.h" 20 | 21 | QHash SingletonFactory::instances; 22 | -------------------------------------------------------------------------------- /libs/mediacenter/singletonfactory.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright 2014 Shantanu Tushar * 3 | * * 4 | * * 5 | * This library is free software; you can redistribute it and/or * 6 | * modify it under the terms of the GNU Lesser General Public * 7 | * License as published by the Free Software Foundation; either * 8 | * version 2.1 of the License, or (at your option) any later version. * 9 | * * 10 | * This library is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 13 | * Lesser General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU Lesser General Public * 16 | * License along with this library. If not, see . * 17 | ***********************************************************************************/ 18 | 19 | #ifndef SINGLETONFACTORY_H 20 | #define SINGLETONFACTORY_H 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include "mediacenter_export.h" 28 | 29 | class MEDIACENTER_EXPORT SingletonFactory 30 | { 31 | public: 32 | template static T* instanceFor() 33 | { 34 | const QString typeName(typeid(T).name()); 35 | 36 | if (!instances.contains(typeName)) { 37 | instances.insert(typeName, static_cast(new T())); 38 | } 39 | 40 | return static_cast(instances.value(typeName)); 41 | } 42 | private: 43 | static QHash instances; 44 | }; 45 | 46 | #endif // SINGLETONFACTORY_H 47 | -------------------------------------------------------------------------------- /mediaelements/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 2 | install(DIRECTORY mediabrowser DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 3 | install(DIRECTORY mediacontroller DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 4 | install(DIRECTORY mediaplayer DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 5 | install(DIRECTORY playlist DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 6 | install(DIRECTORY imageviewer DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 7 | -------------------------------------------------------------------------------- /mediaelements/imageviewer/PictureStripDelegate.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2012 Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | import QtQuick 2.1 21 | 22 | Item { 23 | id: pictureStripDelegate 24 | signal imageClicked(string url) 25 | property bool isDirectory: isExpandable 26 | 27 | Rectangle { 28 | anchors.fill: parent 29 | color: pictureStripDelegate.ListView.isCurrentItem ? theme.highlightColor : theme.backgroundColor 30 | Image { 31 | anchors {fill: parent; margins: units.smallSpacing * 2 } 32 | sourceSize.width: width 33 | sourceSize.height: 0 34 | source: mediaUrl ? mediaUrl : "" 35 | asynchronous: true 36 | cache: true 37 | fillMode: Image.PreserveAspectCrop 38 | smooth: true 39 | } 40 | 41 | MouseArea { 42 | id: pictureStripMouseArea 43 | anchors.fill: parent 44 | onClicked: emitClicked() 45 | } 46 | } 47 | 48 | Keys.onReturnPressed: emitClicked() 49 | 50 | function emitClicked() 51 | { 52 | pictureStripDelegate.ListView.view.currentIndex = index; 53 | pictureStripDelegate.imageClicked(mediaUrl); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /mediaelements/mediabrowser/PopupModel.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2012 Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | import QtQuick 2.1 21 | 22 | ListModel { 23 | ListElement { 24 | name: "Add to Playlist" 25 | icon: "list-add" 26 | } 27 | ListElement { 28 | name: "Play" 29 | icon: "media-playback-start" 30 | } 31 | ListElement { 32 | name: "Cancel" 33 | icon: "dialog-cancel" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mediaelements/mediaplayer/StatsLabel.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2012 Shantanu Tushar * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | import QtQuick 2.1 21 | 22 | Text { 23 | color: theme.textColor 24 | style: Text.Outline 25 | styleColor: theme.backgroundColor 26 | font.pixelSize: parent.height * 0.08 27 | smooth: true 28 | } 29 | -------------------------------------------------------------------------------- /mediaelements/playlist/PlaylistDelegateLogic.js: -------------------------------------------------------------------------------- 1 | function onPositionChanged(dragItemArea, listViewItem) 2 | { 3 | dragItemArea.posEndX = listViewItem.x; 4 | dragItemArea.posEndY = listViewItem.y; 5 | } 6 | 7 | function onReleased(dragItemArea, listViewItem, playlistList, playlistModel) 8 | { 9 | var newIndex = -1 10 | if(!dragItemArea.delegateHeld) 11 | return 12 | if(Math.abs(dragItemArea.movedX) >= dragItemArea.parent.width/3) 13 | playlistModel.removeFromPlaylist(index) 14 | else 15 | listViewItem.x = dragItemArea.posStartX 16 | if (Math.abs(dragItemArea.movedY) == 0 && dragItemArea.delegateHeld == true){ 17 | listViewItem.y = dragItemArea.posStartY 18 | } 19 | else 20 | { 21 | listViewItem.z = 0 22 | listViewItem.opacity = 1 23 | if(dragItemArea.newPositionY < 1) 24 | dragItemArea.newPositionY = 0 25 | else if(dragItemArea.newPositionY > playlistList.count-1) 26 | dragItemArea.newPositionY = playlistList.count - 1 27 | playlistModel.moveItem(index, dragItemArea.newPositionY) 28 | listViewItem.x = dragItemArea.posStartX 29 | listViewItem.y = dragItemArea.posStartY 30 | } 31 | listViewItem.opacity =1 32 | dragItemArea.drag.target = null 33 | listViewItem.ListView.view.interactive = true 34 | dragItemArea.delegateHeld = false 35 | } 36 | -------------------------------------------------------------------------------- /mediaelements/qmldir: -------------------------------------------------------------------------------- 1 | MediaBrowser 2.0 mediabrowser/MediaBrowser.qml 2 | MediaPlayer 2.0 mediaplayer/MediaPlayer.qml 3 | MediaController 2.0 mediacontroller/MediaController.qml 4 | Playlist 2.0 playlist/Playlist.qml 5 | ImageViewer 2.0 imageviewer/ImageViewer.qml 6 | PopupMenu 2.0 popupmenu/PopupMenu.qml 7 | -------------------------------------------------------------------------------- /onlineservices/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(flickr) 2 | #add_subdirectory(picasa) 3 | #add_subdirectory(youtube) 4 | -------------------------------------------------------------------------------- /onlineservices/flickr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(flickrbackend_SRCS 2 | flickrmodel.cpp 3 | flickrbackend.cpp 4 | ) 5 | 6 | add_library(pmc_flickrbackend MODULE ${flickrbackend_SRCS}) 7 | set_target_properties(pmc_flickrbackend PROPERTIES PREFIX "") 8 | 9 | target_link_libraries(pmc_flickrbackend 10 | plasmamediacenter 11 | ) 12 | 13 | kcoreaddons_desktop_to_json(pmc_flickrbackend flickrbackend.desktop) 14 | 15 | install(TARGETS pmc_flickrbackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 16 | -------------------------------------------------------------------------------- /onlineservices/flickr/flickrbackend.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2009 by Onur-Hayri Bakici * 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 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 19 | ***************************************************************************/ 20 | 21 | #include "flickrbackend.h" 22 | #include "flickrmodel.h" 23 | 24 | MEDIACENTER_EXPORT_BROWSINGBACKEND(FlickrBackend, "flickrbackend.json") 25 | 26 | FlickrBackend::FlickrBackend(QObject* parent, const QVariantList& args) 27 | : MediaCenter::AbstractBrowsingBackend(parent, args) 28 | { 29 | 30 | } 31 | 32 | 33 | FlickrBackend::~FlickrBackend() 34 | { 35 | 36 | } 37 | 38 | bool FlickrBackend::initImpl() 39 | { 40 | FlickrModel *model = new FlickrModel(this); 41 | PmcModel *metadata = new PmcModel(model, this); 42 | metadata->setViewType("gridbrowser"); 43 | metadata->setSupportsSearch(true); 44 | setModel(metadata); 45 | return true; 46 | } 47 | 48 | bool FlickrBackend::goOneLevelUp() 49 | { 50 | return MediaCenter::AbstractBrowsingBackend::goOneLevelUp(); 51 | } 52 | 53 | void FlickrBackend::search(const QString& searchTerm) 54 | { 55 | qobject_cast(model())->query(searchTerm); 56 | } 57 | 58 | #include "flickrbackend.moc" 59 | -------------------------------------------------------------------------------- /onlineservices/flickr/flickrbackend.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2009 by Onur-Hayri Bakici * 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 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 19 | ***************************************************************************/ 20 | 21 | #ifndef FLICKRBACKEND_H 22 | #define FLICKRBACKEND_H 23 | 24 | #include 25 | 26 | class FlickrBackend : public MediaCenter::AbstractBrowsingBackend 27 | { 28 | Q_OBJECT 29 | public: 30 | FlickrBackend (QObject* parent, const QVariantList& args); 31 | virtual ~FlickrBackend(); 32 | virtual void search(const QString& searchTerm); 33 | 34 | public Q_SLOTS: 35 | virtual bool initImpl(); 36 | virtual bool goOneLevelUp(); 37 | }; 38 | 39 | #endif // FLICKRBACKEND_H 40 | -------------------------------------------------------------------------------- /onlineservices/picasa/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(picasabackend_SRCS 2 | picasabackend.cpp 3 | picasamodel.cpp 4 | ) 5 | 6 | add_library(pmc_picasabackend MODULE ${picasabackend_SRCS}) 7 | set_target_properties(pmc_picasabackend PROPERTIES PREFIX "") 8 | 9 | target_link_libraries(pmc_picasabackend 10 | plasmamediacenter 11 | ) 12 | 13 | kcoreaddons_desktop_to_json(pmc_picasabackend picasabackend.desktop) 14 | 15 | install(TARGETS pmc_picasabackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 16 | install(DIRECTORY picasacomponents DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/mediacenter/elements) 17 | -------------------------------------------------------------------------------- /onlineservices/picasa/picasacomponents/qmldir: -------------------------------------------------------------------------------- 1 | PicasaSidePanel 0.1 PicasaSidePanel.qml 2 | -------------------------------------------------------------------------------- /onlineservices/youtube/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(youtubebackend_SRCS 2 | diskcache.cpp 3 | networkaccess.cpp 4 | videodefinition.cpp 5 | networkaccess.cpp 6 | video.cpp 7 | youtubemodel.cpp 8 | youtubebackend.cpp 9 | videodetailsmodel.cpp 10 | ) 11 | 12 | add_library(pmc_youtubebackend MODULE ${youtubebackend_SRCS}) 13 | set_target_properties(pmc_youtubebackend PROPERTIES PREFIX "") 14 | 15 | target_link_libraries(pmc_youtubebackend 16 | plasmamediacenter 17 | ) 18 | 19 | kcoreaddons_desktop_to_json(pmc_youtubebackend youtubebackend.desktop) 20 | 21 | install(TARGETS pmc_youtubebackend DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/browsingbackends) 22 | ecm_install_icons( ${ICON_INSTALL_DIR} ) 23 | -------------------------------------------------------------------------------- /onlineservices/youtube/constants.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright Flavio Tordini * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef CONSTANTS_H 19 | #define CONSTANTS_H 20 | 21 | #include 22 | 23 | class Constants { 24 | 25 | public: 26 | 27 | static const char *VERSION; 28 | static const char *NAME; 29 | static const char *UNIX_NAME; 30 | static const char *ORG_NAME; 31 | static const char *ORG_DOMAIN; 32 | static const char *WEBSITE; 33 | static const char *EMAIL; 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /onlineservices/youtube/diskcache.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright Flavio Tordini * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #include "diskcache.h" 19 | 20 | DiskCache::DiskCache(QObject *parent) : QNetworkDiskCache(parent) { } 21 | 22 | QIODevice* DiskCache::prepare(const QNetworkCacheMetaData &metaData) { 23 | QString mime; 24 | Q_FOREACH (const QNetworkCacheMetaData::RawHeader &header, metaData.rawHeaders()) { 25 | // qDebug() << header.first << header.second; 26 | if (header.first.constData() == QLatin1String("Content-Type")) { 27 | mime = header.second; 28 | break; 29 | } 30 | } 31 | 32 | if (mime.startsWith(QLatin1String("image/"))) 33 | return QNetworkDiskCache::prepare(metaData); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /onlineservices/youtube/diskcache.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright Flavio Tordini * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef DISKCACHE_H 19 | #define DISKCACHE_H 20 | 21 | #include 22 | 23 | class DiskCache : public QNetworkDiskCache 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit DiskCache(QObject *parent = 0); 28 | QIODevice* prepare(const QNetworkCacheMetaData &metaData); 29 | 30 | signals: 31 | 32 | public slots: 33 | 34 | }; 35 | 36 | #endif // DISKCACHE_H 37 | -------------------------------------------------------------------------------- /onlineservices/youtube/hi64-apps-youtube-pmc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/plasma-mediacenter/22d416c448c75b323d1f41ace9318eab153778dc/onlineservices/youtube/hi64-apps-youtube-pmc.png -------------------------------------------------------------------------------- /onlineservices/youtube/hi64-apps-youtube-pmc.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/plasma-mediacenter/22d416c448c75b323d1f41ace9318eab153778dc/onlineservices/youtube/hi64-apps-youtube-pmc.svgz -------------------------------------------------------------------------------- /onlineservices/youtube/videodefinition.cpp: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright Flavio Tordini * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #include "videodefinition.h" 19 | 20 | QStringList VideoDefinition::getDefinitionNames() { 21 | static QStringList definitionNames = QStringList() << "360p" << "720p" << "1080p"; 22 | return definitionNames; 23 | } 24 | 25 | QList VideoDefinition::getDefinitionCodes() { 26 | static QList definitionCodes = QList() << 18 << 22 << 37; 27 | return definitionCodes; 28 | } 29 | 30 | QHash VideoDefinition::getDefinitions() { 31 | static QHash definitions; 32 | if (definitions.isEmpty()) { 33 | definitions.insert("360p", 18); 34 | definitions.insert("720p", 22); 35 | definitions.insert("1080p", 37); 36 | } 37 | return definitions; 38 | } 39 | 40 | int VideoDefinition::getDefinitionCode(QString name) { 41 | return VideoDefinition::getDefinitions().value(name); 42 | } 43 | 44 | QString VideoDefinition::getDefinitionName(int code) { 45 | return getDefinitions().key(code); 46 | } 47 | -------------------------------------------------------------------------------- /onlineservices/youtube/videodefinition.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * Copyright Flavio Tordini * 3 | * * 4 | * This library is free software; you can redistribute it and/or * 5 | * modify it under the terms of the GNU Lesser General Public * 6 | * License as published by the Free Software Foundation; either * 7 | * version 2.1 of the License, or (at your option) any later version. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 12 | * Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public * 15 | * License along with this library. If not, see . * 16 | ***********************************************************************************/ 17 | 18 | #ifndef VIDEODEFINITION_H 19 | #define VIDEODEFINITION_H 20 | 21 | #include 22 | #include 23 | 24 | class VideoDefinition { 25 | 26 | public: 27 | static QStringList getDefinitionNames(); 28 | static QList getDefinitionCodes(); 29 | static QHash getDefinitions(); 30 | static int getDefinitionCode(QString name); 31 | static QString getDefinitionName(int code); 32 | 33 | }; 34 | 35 | #endif // VIDEODEFINITION_H 36 | -------------------------------------------------------------------------------- /onlineservices/youtube/videodetailsmodel.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2013 by Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | #ifndef VIDEODETAILSMODEL_H 21 | #define VIDEODETAILSMODEL_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | class VideoDetailsModel : public QAbstractListModel 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit VideoDetailsModel(QObject* parent = 0); 33 | ~VideoDetailsModel(); 34 | virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const; 35 | virtual int rowCount (const QModelIndex& parent = QModelIndex()) const; 36 | void retriveRealUrl(); 37 | void setVideoUrl(const QString &url); 38 | void setVideoThumbnail(const QString &thumbnail); 39 | 40 | signals: 41 | void gotRealUrl(); 42 | public slots: 43 | void streamUrl(QUrl url); 44 | private: 45 | QString m_videoThumbnail; 46 | QString m_videoUrl; 47 | QString m_videoTitle; 48 | }; 49 | 50 | #endif // VIDEODETAILSMODEL_H 51 | -------------------------------------------------------------------------------- /onlineservices/youtube/youtubebackend.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2013 by Sinny Kumari * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 18 | ***************************************************************************/ 19 | 20 | #ifndef YOUTUBEBACKEND_H 21 | #define YOUTUBEBACKEND_H 22 | 23 | #include "youtubemodel.h" 24 | #include "videodetailsmodel.h" 25 | 26 | #include "mediacenter/abstractbrowsingbackend.h" 27 | 28 | /** 29 | * @class YoutubeBackend 30 | * @brief A backend that manages queries to Youtube. 31 | */ 32 | class YoutubeBackend : public MediaCenter::AbstractBrowsingBackend 33 | { 34 | Q_OBJECT 35 | public: 36 | YoutubeBackend(QObject *parent, const QVariantList &args); 37 | 38 | bool expand (int row); 39 | virtual bool initImpl(); 40 | virtual void search(const QString& searchTerm); 41 | 42 | public Q_SLOTS: 43 | virtual bool goOneLevelUp(); 44 | void realUrlFound(); 45 | 46 | private: 47 | YoutubeModel *m_youtubeModel; 48 | VideoDetailsModel *m_videoDetailsModel; 49 | PmcModel *m_metadata; 50 | bool m_expanded; // to detrmine which model is currently set into backend 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /packages/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | plasma_install_package(shell org.kde.plasma.mediacenter shells shell) 2 | install(FILES plasma-mediacenter.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) 3 | add_subdirectory(containment) 4 | add_subdirectory(mediabrowsers) 5 | -------------------------------------------------------------------------------- /packages/containment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(mediacentercontainment_SRCS 2 | mediacenter.cpp 3 | ) 4 | 5 | add_library(plasma_containment_mediacenter MODULE ${mediacentercontainment_SRCS}) 6 | 7 | target_link_libraries(plasma_containment_mediacenter 8 | KF5::Plasma 9 | KF5::Service 10 | ) 11 | 12 | install(TARGETS plasma_containment_mediacenter DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets) 13 | 14 | kcoreaddons_desktop_to_json(plasma_containment_mediacenter package/metadata.desktop) 15 | 16 | plasma_install_package(package org.kde.mediacentercontainment plasmoids containment) 17 | -------------------------------------------------------------------------------- /packages/containment/mediacenter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #include "mediacenter.h" 22 | 23 | #include 24 | 25 | MediaCenter::MediaCenter(QObject *parent, const QVariantList &args) 26 | : Plasma::Containment(parent, args) 27 | { 28 | } 29 | 30 | MediaCenter::~MediaCenter() 31 | { 32 | } 33 | 34 | void MediaCenter::init() 35 | { 36 | Plasma::Containment::init(); 37 | setFormFactor(Plasma::Types::MediaCenter); 38 | } 39 | 40 | K_EXPORT_PLASMA_APPLET_WITH_JSON(mediacenter, MediaCenter, "metadata.json") 41 | 42 | #include "mediacenter.moc" 43 | -------------------------------------------------------------------------------- /packages/containment/mediacenter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #ifndef MEDIACENTER_H 22 | #define MEDIACENTER_H 23 | 24 | #include 25 | 26 | class MediaCenter : public Plasma::Containment 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | MediaCenter(QObject *parent, const QVariantList &args); 32 | ~MediaCenter(); 33 | 34 | void init(); 35 | 36 | }; 37 | 38 | #endif /* end of include guard: MEDIACENTER_H */ 39 | -------------------------------------------------------------------------------- /packages/containment/package/Messages.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp 3 | $XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.panel.pot 4 | rm -f rc.cpp 5 | -------------------------------------------------------------------------------- /packages/containment/package/contents/config/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/containment/package/metadata.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Keywords= 4 | Name=Mediacenter Containment 5 | Name[ca]=Contenidor del centre multimèdia 6 | Name[ca@valencia]=Contenidor del centre multimèdia 7 | Name[cs]=Kontejner Mediacenter 8 | Name[da]=Mediacenter-beholder 9 | Name[de]=Mediencenter-Containment 10 | Name[el]=Mediacenter Containment 11 | Name[en_GB]=Mediacentre Containment 12 | Name[es]=Contenedor del centro multimedia 13 | Name[et]=Meediakeskuse konteiner 14 | Name[eu]=Euskarri-gunearen konfinamendua 15 | Name[fi]=Mediakeskussisällytin 16 | Name[fr]=Conteneur du centre multimédia 17 | Name[gl]=Contedor de centro multimedia 18 | Name[id]=Containment Mediacenter 19 | Name[it]=Contenitore di MediaCenter 20 | Name[ko]=미디어 센터 컨테이너 21 | Name[nl]=Container met mediacentrum 22 | Name[nn]=Mediesenter-behaldar 23 | Name[pl]=Centrum multimedialne 24 | Name[pt]=Contentor de Centro Multimédia 25 | Name[pt_BR]=Contêiner Media Center 26 | Name[sk]=Obsah mediálneho centra 27 | Name[sl]=Vsebnik predstavnostnega središča 28 | Name[sv]=Mediacenter-omgivning 29 | Name[tr]=Ortammerkezi Kapsayıcı 30 | Name[uk]=Контейнер мультимедійного центру 31 | Name[x-test]=xxMediacenter Containmentxx 32 | Name[zh_CN]=媒体中心容量 33 | Name[zh_TW]=媒體中心包含 34 | Type=Service 35 | 36 | NoDisplay=true 37 | 38 | X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment 39 | X-Plasma-API=declarativeappletscript 40 | X-KDE-Library=plasma_containment_mediacenter 41 | X-KDE-ParentApp= 42 | X-KDE-PluginInfo-Author=Marco Martin 43 | X-KDE-PluginInfo-Category= 44 | X-KDE-PluginInfo-Email=mart@kde.org 45 | X-KDE-PluginInfo-License=GPLv2+ 46 | X-KDE-PluginInfo-Name=org.kde.mediacentercontainment 47 | X-KDE-PluginInfo-Version= 48 | X-KDE-PluginInfo-Website= 49 | X-Plasma-MainScript=ui/main.qml 50 | -------------------------------------------------------------------------------- /packages/mediabrowsers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | plasma_install_package(gridbrowser gridbrowser packages package) 2 | plasma_install_package(listbrowser listbrowser packages package) 3 | -------------------------------------------------------------------------------- /packages/shell/Messages.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | $XGETTEXT `find . -name \*.qml` -L Java -o $podir/plasma_shell_org.kde.plasma.mediacenter.pot 3 | rm -f rc.cpp 4 | -------------------------------------------------------------------------------- /packages/shell/contents/InteractiveConsole.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Aaron Seigo 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Library General Public License as 6 | * published by the Free Software Foundation; either version 2 or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this program; if not, write to the 16 | * Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | import QtQuick 2.0 21 | 22 | import org.kde.plasma.private.shell 2.0 23 | 24 | Item { 25 | id: main 26 | 27 | property string scriptPath 28 | property alias mode: interactiveConsole.mode 29 | signal visibleChanged(bool visible) 30 | 31 | onScriptPathChanged: { 32 | interactiveConsole.loadScript(scriptPath); 33 | } 34 | 35 | InteractiveConsoleWindow { 36 | id: interactiveConsole 37 | 38 | onVisibleChanged: { 39 | main.visibleChanged(visible); 40 | } 41 | } 42 | 43 | Component.onCompleted: { 44 | interactiveConsole.scriptEngine = scriptEngine; 45 | interactiveConsole.visible = true; 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /packages/shell/contents/applet/AppletError.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Marco Martin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. 17 | */ 18 | 19 | import QtQuick 2.0 20 | import QtQuick.Layouts 1.1 21 | import org.kde.plasma.core 2.0 as PlasmaCore 22 | import org.kde.plasma.components 2.0 as PlasmaComponents 23 | 24 | RowLayout { 25 | id: root 26 | Layout.minimumWidth: units.gridUnit * 20 27 | Layout.minimumHeight: units.gridUnit * 8 28 | 29 | property alias reason: messageText.text 30 | 31 | clip: true 32 | 33 | PlasmaCore.IconItem { 34 | id: icon 35 | anchors.verticalCenter: parent.verticalCenter 36 | Layout.minimumWidth: units.iconSizes.huge 37 | Layout.minimumHeight: units.iconSizes.huge 38 | source: "dialog-error" 39 | } 40 | 41 | PlasmaComponents.TextArea { 42 | id: messageText 43 | Layout.fillWidth: true 44 | Layout.fillHeight: true 45 | verticalAlignment: TextEdit.AlignVCenter 46 | backgroundVisible: false 47 | readOnly: true 48 | width: parent.width - icon.width 49 | wrapMode: Text.Wrap 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packages/shell/contents/applet/DefaultCompactRepresentation.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Marco Martin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. 17 | */ 18 | 19 | import QtQuick 2.0 20 | import QtQuick.Layouts 1.1 21 | import org.kde.plasma.core 2.0 as PlasmaCore 22 | 23 | PlasmaCore.IconItem { 24 | id: icon 25 | 26 | Layout.minimumWidth: { 27 | switch (plasmoid.formFactor) { 28 | case PlasmaCore.Types.Vertical: 29 | return 0; 30 | case PlasmaCore.Types.Horizontal: 31 | return height; 32 | default: 33 | return units.gridUnit * 3; 34 | } 35 | } 36 | 37 | Layout.minimumHeight: { 38 | switch (plasmoid.formFactor) { 39 | case PlasmaCore.Types.Vertical: 40 | return width; 41 | case PlasmaCore.Types.Horizontal: 42 | return 0; 43 | default: 44 | return units.gridUnit * 3; 45 | } 46 | } 47 | 48 | source: plasmoid.icon ? plasmoid.icon : "plasma" 49 | active: mouseArea.containsMouse 50 | 51 | MouseArea { 52 | id: mouseArea 53 | 54 | property bool wasExpanded: false 55 | 56 | anchors.fill: parent 57 | hoverEnabled: true 58 | onPressed: wasExpanded = plasmoid.expanded 59 | onClicked: plasmoid.expanded = !wasExpanded 60 | } 61 | } -------------------------------------------------------------------------------- /packages/shell/contents/configuration/ConfigurationShortcuts.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Marco Martin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. 17 | */ 18 | 19 | import QtQuick 2.0 20 | import QtQuick.Controls 1.0 as QtControls 21 | import QtQuick.Layouts 1.0 22 | import org.kde.kquickcontrols 2.0 23 | 24 | Item { 25 | id: root 26 | width: childrenRect.width 27 | height: childrenRect.height 28 | 29 | signal configurationChanged 30 | function saveConfig() { 31 | plasmoid.globalShortcut = button.keySequence 32 | } 33 | 34 | ColumnLayout { 35 | anchors { 36 | left: parent.left 37 | right: parent.right 38 | } 39 | QtControls.Label { 40 | Layout.fillWidth: true 41 | text: i18nd("plasma_shell_org.kde.plasma.mediacenter", "This shortcut will activate the applet: it will give the keyboard focus to it, and if the applet has a popup (such as the start menu), the popup will be open.") 42 | wrapMode: Text.WordWrap 43 | } 44 | KeySequenceItem { 45 | id: button 46 | keySequence: plasmoid.globalShortcut 47 | onKeySequenceChanged: { 48 | root.configurationChanged(); 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /packages/shell/contents/configuration/ContainmentConfiguration.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Marco Martin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. 17 | */ 18 | 19 | import QtQuick 2.0 20 | import QtQuick.Layouts 1.0 21 | import org.kde.plasma.components 2.0 as PlasmaComponents 22 | import org.kde.plasma.extras 2.0 as PlasmaExtras 23 | import org.kde.plasma.core 2.0 as PlasmaCore 24 | import org.kde.plasma.configuration 2.0 25 | 26 | 27 | AppletConfiguration { 28 | id: root 29 | isContainment: true 30 | Layout.minimumWidth: Math.min(plasmoid.availableScreenRect.width, units.gridUnit * 32) 31 | Layout.minimumHeight: Math.min(plasmoid.availableScreenRect.height - units.gridUnit * 3, units.gridUnit * 36) 32 | 33 | //BEGIN model 34 | globalConfigModel: globalContainmentConfigModel 35 | 36 | ConfigModel { 37 | id: globalContainmentConfigModel 38 | ConfigCategory { 39 | name: i18nd("plasma_shell_org.kde.plasma.mediacenter", "Wallpaper") 40 | icon: "preferences-desktop-wallpaper" 41 | source: "ConfigurationContainmentAppearance.qml" 42 | } 43 | ConfigCategory { 44 | name: i18nd("plasma_shell_org.kde.plasma.mediacenter", "Mouse Actions") 45 | icon: "preferences-desktop-mouse" 46 | source: "ConfigurationContainmentActions.qml" 47 | } 48 | } 49 | //END model 50 | 51 | } 52 | -------------------------------------------------------------------------------- /packages/shell/contents/defaults: -------------------------------------------------------------------------------- 1 | [Desktop] 2 | Containment=org.kde.mediacentercontainment 3 | ToolBox= 4 | RuntimePlatform= 5 | 6 | [Theme] 7 | name= 8 | -------------------------------------------------------------------------------- /packages/shell/contents/images/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/plasma-mediacenter/22d416c448c75b323d1f41ace9318eab153778dc/packages/shell/contents/images/shadow.png -------------------------------------------------------------------------------- /packages/shell/contents/layout.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < screenCount; ++i) { 2 | var id = createActivity("Desktop"); 3 | var desktopsArray = desktopsForActivity(id); 4 | print(desktopsArray.length); 5 | for( var j = 0; j < desktopsArray.length; j++) { 6 | desktopsArray[j].wallpaperPlugin = 'org.kde.image'; 7 | desktopsArray[j].addWidget("org.kde.plasma.analogclock"); 8 | desktopsArray[j].addWidget("org.kde.plasma.digitalclock"); 9 | desktopsArray[j].addWidget("org.kde.plasma.comic"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/shell/contents/loader.qml: -------------------------------------------------------------------------------- 1 | /* vim:set foldmethod=marker: 2 | * 3 | * Copyright (C) 2013 Ivan Cukic 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 version 2, 7 | * or (at your option) any later version, as published by the Free 8 | * Software Foundation 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details 14 | * 15 | * You should have received a copy of the GNU General Public 16 | * License along with this program; if not, write to the 17 | * Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | import QtQuick 2 22 | import org.kde.solid 1.0 as Solid 23 | import org.kde.plasma.platformcomponents 2.0 as Platform 24 | 25 | Item { 26 | id: main 27 | 28 | property string shell : "org.kde.plasma.mediacenter" 29 | property bool willing : true 30 | property int priority : currentSession == "plasma-mediacenter" ? 0 : 1 31 | property string currentSession 32 | 33 | // This is not needed, but allows the 34 | // handler to know whether its shell is loaded 35 | property bool loaded : false 36 | 37 | default property var children 38 | /* This seems to crash not being able to address Solid.Device, which seems to be 39 | a problem with latest Qt 5.3. Pleas re-enable only after consultation with 40 | plasma-devel@kde.org */ 41 | /* 42 | Solid.Devices { 43 | id: keyboards 44 | query: "IS Keyboard" 45 | } 46 | */ 47 | } 48 | 49 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(datasourceloadertest) 2 | 3 | #add_subdirectory(fakemediasource) 4 | -------------------------------------------------------------------------------- /tests/backendstest.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | 22 | import QtQuick 2.0 23 | import org.kde.plasma.mediacenter 2.0 as PMC 24 | Item { 25 | width: 200 26 | height: 200 27 | PMC.QMLAccess { 28 | id: pmcinterface 29 | } 30 | ListView { 31 | id: listModel 32 | anchors.fill: parent 33 | model: filterModel 34 | delegate: Text { 35 | text: display 36 | } 37 | } 38 | PMC.FilteredBackendsModel { 39 | id: filterModel 40 | sourceBackendsModel : pmcinterface.backendsModel 41 | backendCategory : "audio" 42 | } 43 | Timer { 44 | id: timer 45 | interval: 1000 46 | running: true 47 | repeat: false 48 | onTriggered: filterModel.backendCategory = "image" 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /tests/datasourceloadertest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (pmc_SRCS 2 | application.cpp 3 | ) 4 | 5 | set(datasourcesloadertest_SRCS 6 | datasourceloadertest.cpp 7 | ) 8 | 9 | add_executable(datasourcesloadertest ${datasourcesloadertest_SRCS}) 10 | target_link_libraries(datasourcesloadertest 11 | plasmamediacenter 12 | ) 13 | -------------------------------------------------------------------------------- /tests/datasourceloadertest/datasourceloadertest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Bhushan Shah 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License or (at your option) version 3 or any later version 8 | * accepted by the membership of KDE e.V. (or its successor approved 9 | * by the membership of KDE e.V.), which shall act as a proxy 10 | * defined in Section 14 of version 3 of the license. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see 19 | */ 20 | 21 | #include 22 | #include "mediacenter/datasourcesloader.h" 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | QCoreApplication app(argc, argv); 27 | DataSourcesLoader datasourcesloader; 28 | datasourcesloader.load(); 29 | return app.exec(); 30 | } 31 | -------------------------------------------------------------------------------- /tests/fakemediasource/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(fakemediasource_SRCS 2 | fakemediasource.cpp 3 | ) 4 | 5 | add_library(pmc_fakemediasource MODULE ${fakemediasource_SRCS}) 6 | set_target_properties(pmc_fakemediasource PROPERTIES PREFIX "") 7 | 8 | target_link_libraries(pmc_fakemediasource 9 | plasmamediacenter 10 | ) 11 | 12 | kcoreaddons_desktop_to_json(pmc_fakemediasource fakemediasource.desktop) 13 | 14 | install(TARGETS pmc_fakemediasource DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/mediasources) 15 | install(FILES medialist.json DESTINATION ${DATA_INSTALL_DIR}/plasma/mediacenter/mediasources) 16 | -------------------------------------------------------------------------------- /tests/fakemediasource/fakemediasource.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Service 3 | Name=Fake Mediasource 4 | Name[ca]=Font de medis fictícia 5 | Name[ca@valencia]=Font de medis fictícia 6 | Name[da]=Falsk mediekilde 7 | Name[de]=Fingierte Medienquelle 8 | Name[en_GB]=Fake Mediasource 9 | Name[es]=Fuente multimedia simulada 10 | Name[et]=Liba-meediaallikas 11 | Name[fi]=Testimedialähde 12 | Name[fr]=Source de média fictive 13 | Name[gl]=Orixe multimedia falsa 14 | Name[it]=Sorgente multimediale finta 15 | Name[ko]=가짜 미디어 원본 16 | Name[lt]=Suklastotas Medija šaltinis 17 | Name[nl]=Fake mediabron 18 | Name[nn]=Falsk mediekjelde 19 | Name[pl]=Fikcyjne źródło multimediów 20 | Name[pt]=Fonte Multimédia de Testes 21 | Name[pt_BR]=Fonte multimídia falsa 22 | Name[sk]=Falošný zdroj médií 23 | Name[sl]=Lažni vir predstavnosti 24 | Name[sr]=Лажни извор медијума 25 | Name[sr@ijekavian]=Лажни извор медијума 26 | Name[sr@ijekavianlatin]=Lažni izvor medijuma 27 | Name[sr@latin]=Lažni izvor medijuma 28 | Name[sv]=Påhittad mediakälla 29 | Name[tr]=Sahte Medya Kaynağı 30 | Name[uk]=Несправжнє медіаджерело 31 | Name[x-test]=xxFake Mediasourcexx 32 | Name[zh_CN]=虚拟媒体源 33 | 34 | X-KDE-ServiceTypes=Plasma/MediaCenter/MediaSource 35 | 36 | X-KDE-PluginInfo-Name=fakemediasource 37 | X-KDE-PluginInfo-Author=Ashish Bansal 38 | X-KDE-PluginInfo-Email=bansal.ashish096@gmail.com 39 | X-KDE-PluginInfo-Version=1.0 40 | X-KDE-PluginInfo-License=GPL 41 | X-KDE-PluginInfo-EnabledByDefault=false 42 | X-KDE-Library=pmc_fakemediasource 43 | -------------------------------------------------------------------------------- /tests/fakemediasource/fakemediasource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Ashish Bansal 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Library General Public License as 6 | * published by the Free Software Foundation; either version 2, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this program; if not, write to the 16 | * Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef FAKEMEDIASOURCE_H 21 | #define FAKEMEDIASOURCE_H 22 | 23 | #include 24 | #include 25 | 26 | class FakeMediaSource : public MediaCenter::AbstractMediaSource 27 | 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit FakeMediaSource(QObject* parent = 0, const QVariantList& = QVariantList()); 32 | inline QString getMediaFileName(); 33 | 34 | protected: 35 | void run(); 36 | 37 | private: 38 | void addMedia(QHash properties); 39 | 40 | private Q_SLOTS: 41 | void parseJsonFile(); 42 | }; 43 | 44 | #endif // FAKEMEDIASOURCE_H 45 | -------------------------------------------------------------------------------- /tests/fakemediasource/medialist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "title" : "Comfortably Numb", 4 | "url" : "http://songlist/song1", 5 | "mimeType" : "audio", 6 | "album" : "The Wall", 7 | "artist" : "Pink Floyd", 8 | "albumArtist" : "Pink Floyd" 9 | }, 10 | { 11 | "title" : "Wish You Were Here", 12 | "url" : "http://songlist/song2", 13 | "mimeType" : "audio", 14 | "album" : "Wish You Were Here", 15 | "artist" : "Pink Floyd", 16 | "albumArtist" : "Pink Floyd" 17 | }, 18 | { 19 | "title" : "Another Brick in the Wall", 20 | "url" : "http://songlist/song3", 21 | "mimeType" : "audio", 22 | "album" : "The Wall", 23 | "artist" : "Pink Floyd", 24 | "albumArtist" : "Pink Floyd" 25 | } 26 | ] 27 | --------------------------------------------------------------------------------