Merge pull request #4661 from sobkas/master

Fix formatting and general directory structure inside internet/
This commit is contained in:
John Maguire 2014-12-19 11:26:22 +01:00
commit 1e752ce99c
269 changed files with 2664 additions and 1618 deletions

10
dist/format.py vendored Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
import argparse import argparse
import difflib import difflib
import os import os
@ -20,6 +21,9 @@ def main():
help='file extensions to reformat') help='file extensions to reformat')
parser.add_argument('-i', dest='inplace', action='store_true', parser.add_argument('-i', dest='inplace', action='store_true',
help='edit files inplace instead of showing a diff') help='edit files inplace instead of showing a diff')
parser.add_argument('--files', nargs='*', metavar='FIL',
default=[],
help='get files as arguments insted of git')
args = parser.parse_args() args = parser.parse_args()
try: try:
@ -35,8 +39,14 @@ def main():
if not changed_files: if not changed_files:
print >> sys.stderr, 'No changes from %s' % args.ref print >> sys.stderr, 'No changes from %s' % args.ref
if not args.files and not changed_files:
print >> sys.stderr, "Use --files to select files for reformat"
return return
if args.files:
changed_files = args.files
for filename in changed_files: for filename in changed_files:
if not os.path.splitext(filename)[1][1:] in args.extension: if not os.path.splitext(filename)[1][1:] in args.extension:
continue continue

View File

@ -165,49 +165,49 @@ set(SOURCES
globalsearch/suggestionwidget.cpp globalsearch/suggestionwidget.cpp
globalsearch/urlsearchprovider.cpp globalsearch/urlsearchprovider.cpp
internet/cloudfilesearchprovider.cpp internet/core/cloudfilesearchprovider.cpp
internet/cloudfileservice.cpp internet/core/cloudfileservice.cpp
internet/digitallyimportedclient.cpp internet/digitally/digitallyimportedclient.cpp
internet/digitallyimportedservicebase.cpp internet/digitally/digitallyimportedservicebase.cpp
internet/digitallyimportedsettingspage.cpp internet/digitally/digitallyimportedsettingspage.cpp
internet/digitallyimportedurlhandler.cpp internet/digitally/digitallyimportedurlhandler.cpp
internet/geolocator.cpp internet/core/geolocator.cpp
internet/groovesharkradio.cpp internet/grooveshark/groovesharkradio.cpp
internet/groovesharkservice.cpp internet/grooveshark/groovesharkservice.cpp
internet/groovesharksettingspage.cpp internet/grooveshark/groovesharksettingspage.cpp
internet/groovesharkurlhandler.cpp internet/grooveshark/groovesharkurlhandler.cpp
internet/icecastbackend.cpp internet/icecast/icecastbackend.cpp
internet/icecastfilterwidget.cpp internet/icecast/icecastfilterwidget.cpp
internet/icecastmodel.cpp internet/icecast/icecastmodel.cpp
internet/icecastservice.cpp internet/icecast/icecastservice.cpp
internet/internetmodel.cpp internet/core/internetmodel.cpp
internet/internetplaylistitem.cpp internet/core/internetplaylistitem.cpp
internet/internetservice.cpp internet/core/internetservice.cpp
internet/internetshowsettingspage.cpp internet/core/internetshowsettingspage.cpp
internet/internetview.cpp internet/core/internetview.cpp
internet/internetviewcontainer.cpp internet/core/internetviewcontainer.cpp
internet/jamendodynamicplaylist.cpp internet/jamendo/jamendodynamicplaylist.cpp
internet/jamendoplaylistitem.cpp internet/jamendo/jamendoplaylistitem.cpp
internet/jamendoservice.cpp internet/jamendo/jamendoservice.cpp
internet/localredirectserver.cpp internet/core/localredirectserver.cpp
internet/magnatunedownloaddialog.cpp internet/magnatune/magnatunedownloaddialog.cpp
internet/magnatuneplaylistitem.cpp internet/magnatune/magnatuneplaylistitem.cpp
internet/magnatuneservice.cpp internet/magnatune/magnatuneservice.cpp
internet/magnatunesettingspage.cpp internet/magnatune/magnatunesettingspage.cpp
internet/magnatuneurlhandler.cpp internet/magnatune/magnatuneurlhandler.cpp
internet/oauthenticator.cpp internet/core/oauthenticator.cpp
internet/savedradio.cpp internet/internetradio/savedradio.cpp
internet/searchboxwidget.cpp internet/core/searchboxwidget.cpp
internet/somafmservice.cpp internet/somafm/somafmservice.cpp
internet/somafmurlhandler.cpp internet/somafm/somafmurlhandler.cpp
internet/soundcloudservice.cpp internet/soundcloud/soundcloudservice.cpp
internet/soundcloudsettingspage.cpp internet/soundcloud/soundcloudsettingspage.cpp
internet/spotifyserver.cpp internet/spotify/spotifyserver.cpp
internet/spotifyservice.cpp internet/spotify/spotifyservice.cpp
internet/spotifysettingspage.cpp internet/spotify/spotifysettingspage.cpp
internet/subsonicservice.cpp internet/subsonic/subsonicservice.cpp
internet/subsonicsettingspage.cpp internet/subsonic/subsonicsettingspage.cpp
internet/subsonicurlhandler.cpp internet/subsonic/subsonicurlhandler.cpp
library/groupbydialog.cpp library/groupbydialog.cpp
library/library.cpp library/library.cpp
@ -270,28 +270,28 @@ set(SOURCES
playlistparsers/xmlparser.cpp playlistparsers/xmlparser.cpp
playlistparsers/xspfparser.cpp playlistparsers/xspfparser.cpp
podcasts/addpodcastbyurl.cpp internet/podcasts/addpodcastbyurl.cpp
podcasts/addpodcastdialog.cpp internet/podcasts/addpodcastdialog.cpp
podcasts/addpodcastpage.cpp internet/podcasts/addpodcastpage.cpp
podcasts/fixedopmlpage.cpp internet/podcasts/fixedopmlpage.cpp
podcasts/gpoddersearchpage.cpp internet/podcasts/gpoddersearchpage.cpp
podcasts/gpoddersync.cpp internet/podcasts/gpoddersync.cpp
podcasts/gpoddertoptagsmodel.cpp internet/podcasts/gpoddertoptagsmodel.cpp
podcasts/gpoddertoptagspage.cpp internet/podcasts/gpoddertoptagspage.cpp
podcasts/itunessearchpage.cpp internet/podcasts/itunessearchpage.cpp
podcasts/podcast.cpp internet/podcasts/podcast.cpp
podcasts/podcastbackend.cpp internet/podcasts/podcastbackend.cpp
podcasts/podcastdiscoverymodel.cpp internet/podcasts/podcastdiscoverymodel.cpp
podcasts/podcastdeleter.cpp internet/podcasts/podcastdeleter.cpp
podcasts/podcastdownloader.cpp internet/podcasts/podcastdownloader.cpp
podcasts/podcastepisode.cpp internet/podcasts/podcastepisode.cpp
podcasts/podcastinfowidget.cpp internet/podcasts/podcastinfowidget.cpp
podcasts/podcastservice.cpp internet/podcasts/podcastservice.cpp
podcasts/podcastservicemodel.cpp internet/podcasts/podcastservicemodel.cpp
podcasts/podcastsettingspage.cpp internet/podcasts/podcastsettingspage.cpp
podcasts/podcastparser.cpp internet/podcasts/podcastparser.cpp
podcasts/podcastupdater.cpp internet/podcasts/podcastupdater.cpp
podcasts/podcasturlloader.cpp internet/podcasts/podcasturlloader.cpp
smartplaylists/generator.cpp smartplaylists/generator.cpp
smartplaylists/generatorinserter.cpp smartplaylists/generatorinserter.cpp
@ -476,45 +476,45 @@ set(HEADERS
globalsearch/spotifysearchprovider.h globalsearch/spotifysearchprovider.h
globalsearch/suggestionwidget.h globalsearch/suggestionwidget.h
internet/cloudfileservice.h internet/core/cloudfileservice.h
internet/digitallyimportedclient.h internet/digitally/digitallyimportedclient.h
internet/digitallyimportedservicebase.h internet/digitally/digitallyimportedservicebase.h
internet/digitallyimportedsettingspage.h internet/digitally/digitallyimportedsettingspage.h
internet/geolocator.h internet/core/geolocator.h
internet/groovesharkservice.h internet/grooveshark/groovesharkservice.h
internet/groovesharksettingspage.h internet/grooveshark/groovesharksettingspage.h
internet/groovesharkurlhandler.h internet/grooveshark/groovesharkurlhandler.h
internet/icecastbackend.h internet/icecast/icecastbackend.h
internet/icecastfilterwidget.h internet/icecast/icecastfilterwidget.h
internet/icecastmodel.h internet/icecast/icecastmodel.h
internet/icecastservice.h internet/icecast/icecastservice.h
internet/internetmimedata.h internet/core/internetmimedata.h
internet/internetmodel.h internet/core/internetmodel.h
internet/internetservice.h internet/core/internetservice.h
internet/internetshowsettingspage.h internet/core/internetshowsettingspage.h
internet/internetsongmimedata.h internet/core/internetsongmimedata.h
internet/internetview.h internet/core/internetview.h
internet/internetviewcontainer.h internet/core/internetviewcontainer.h
internet/jamendodynamicplaylist.h internet/jamendo/jamendodynamicplaylist.h
internet/jamendoservice.h internet/jamendo/jamendoservice.h
internet/localredirectserver.h internet/core/localredirectserver.h
internet/magnatunedownloaddialog.h internet/magnatune/magnatunedownloaddialog.h
internet/magnatuneservice.h internet/magnatune/magnatuneservice.h
internet/magnatunesettingspage.h internet/magnatune/magnatunesettingspage.h
internet/oauthenticator.h internet/core/oauthenticator.h
internet/savedradio.h internet/internetradio/savedradio.h
internet/scrobbler.h internet/core/scrobbler.h
internet/searchboxwidget.h internet/core/searchboxwidget.h
internet/somafmservice.h internet/somafm/somafmservice.h
internet/somafmurlhandler.h internet/somafm/somafmurlhandler.h
internet/soundcloudservice.h internet/soundcloud/soundcloudservice.h
internet/soundcloudsettingspage.h internet/soundcloud/soundcloudsettingspage.h
internet/spotifyserver.h internet/spotify/spotifyserver.h
internet/spotifyservice.h internet/spotify/spotifyservice.h
internet/spotifysettingspage.h internet/spotify/spotifysettingspage.h
internet/subsonicservice.h internet/subsonic/subsonicservice.h
internet/subsonicsettingspage.h internet/subsonic/subsonicsettingspage.h
internet/subsonicurlhandler.h internet/subsonic/subsonicurlhandler.h
library/groupbydialog.h library/groupbydialog.h
library/library.h library/library.h
@ -568,25 +568,25 @@ set(HEADERS
playlistparsers/plsparser.h playlistparsers/plsparser.h
playlistparsers/xspfparser.h playlistparsers/xspfparser.h
podcasts/addpodcastbyurl.h internet/podcasts/addpodcastbyurl.h
podcasts/addpodcastdialog.h internet/podcasts/addpodcastdialog.h
podcasts/addpodcastpage.h internet/podcasts/addpodcastpage.h
podcasts/fixedopmlpage.h internet/podcasts/fixedopmlpage.h
podcasts/gpoddersearchpage.h internet/podcasts/gpoddersearchpage.h
podcasts/gpoddersync.h internet/podcasts/gpoddersync.h
podcasts/gpoddertoptagsmodel.h internet/podcasts/gpoddertoptagsmodel.h
podcasts/gpoddertoptagspage.h internet/podcasts/gpoddertoptagspage.h
podcasts/itunessearchpage.h internet/podcasts/itunessearchpage.h
podcasts/podcastbackend.h internet/podcasts/podcastbackend.h
podcasts/podcastdiscoverymodel.h internet/podcasts/podcastdiscoverymodel.h
podcasts/podcastdeleter.h internet/podcasts/podcastdeleter.h
podcasts/podcastdownloader.h internet/podcasts/podcastdownloader.h
podcasts/podcastinfowidget.h internet/podcasts/podcastinfowidget.h
podcasts/podcastservice.h internet/podcasts/podcastservice.h
podcasts/podcastservicemodel.h internet/podcasts/podcastservicemodel.h
podcasts/podcastsettingspage.h internet/podcasts/podcastsettingspage.h
podcasts/podcastupdater.h internet/podcasts/podcastupdater.h
podcasts/podcasturlloader.h internet/podcasts/podcasturlloader.h
smartplaylists/generator.h smartplaylists/generator.h
smartplaylists/generatorinserter.h smartplaylists/generatorinserter.h
@ -697,17 +697,17 @@ set(UI
globalsearch/searchproviderstatuswidget.ui globalsearch/searchproviderstatuswidget.ui
globalsearch/suggestionwidget.ui globalsearch/suggestionwidget.ui
internet/digitallyimportedsettingspage.ui internet/digitally/digitallyimportedsettingspage.ui
internet/groovesharksettingspage.ui internet/grooveshark/groovesharksettingspage.ui
internet/icecastfilterwidget.ui internet/icecast/icecastfilterwidget.ui
internet/internetshowsettingspage.ui internet/core/internetshowsettingspage.ui
internet/internetviewcontainer.ui internet/core/internetviewcontainer.ui
internet/magnatunedownloaddialog.ui internet/magnatune/magnatunedownloaddialog.ui
internet/magnatunesettingspage.ui internet/magnatune/magnatunesettingspage.ui
internet/searchboxwidget.ui internet/core/searchboxwidget.ui
internet/soundcloudsettingspage.ui internet/soundcloud/soundcloudsettingspage.ui
internet/spotifysettingspage.ui internet/spotify/spotifysettingspage.ui
internet/subsonicsettingspage.ui internet/subsonic/subsonicsettingspage.ui
library/groupbydialog.ui library/groupbydialog.ui
library/libraryfilterwidget.ui library/libraryfilterwidget.ui
@ -721,12 +721,12 @@ set(UI
playlist/playlistsequence.ui playlist/playlistsequence.ui
playlist/queuemanager.ui playlist/queuemanager.ui
podcasts/addpodcastbyurl.ui internet/podcasts/addpodcastbyurl.ui
podcasts/addpodcastdialog.ui internet/podcasts/addpodcastdialog.ui
podcasts/gpoddersearchpage.ui internet/podcasts/gpoddersearchpage.ui
podcasts/itunessearchpage.ui internet/podcasts/itunessearchpage.ui
podcasts/podcastinfowidget.ui internet/podcasts/podcastinfowidget.ui
podcasts/podcastsettingspage.ui internet/podcasts/podcastsettingspage.ui
smartplaylists/querysearchpage.ui smartplaylists/querysearchpage.ui
smartplaylists/querysortpage.ui smartplaylists/querysortpage.ui
@ -832,32 +832,32 @@ optional_source(ENABLE_VISUALISATIONS
optional_source(HAVE_LIBLASTFM optional_source(HAVE_LIBLASTFM
SOURCES SOURCES
covers/lastfmcoverprovider.cpp covers/lastfmcoverprovider.cpp
internet/fixlastfm.cpp internet/lastfm/fixlastfm.cpp
internet/lastfmcompat.cpp internet/lastfm/lastfmcompat.cpp
internet/lastfmservice.cpp internet/lastfm/lastfmservice.cpp
internet/lastfmsettingspage.cpp internet/lastfm/lastfmsettingspage.cpp
songinfo/echonestsimilarartists.cpp songinfo/echonestsimilarartists.cpp
songinfo/echonesttags.cpp songinfo/echonesttags.cpp
songinfo/lastfmtrackinfoprovider.cpp songinfo/lastfmtrackinfoprovider.cpp
songinfo/tagwidget.cpp songinfo/tagwidget.cpp
HEADERS HEADERS
covers/lastfmcoverprovider.h covers/lastfmcoverprovider.h
internet/lastfmservice.h internet/lastfm/lastfmservice.h
internet/lastfmsettingspage.h internet/lastfm/lastfmsettingspage.h
songinfo/echonestsimilarartists.h songinfo/echonestsimilarartists.h
songinfo/echonesttags.h songinfo/echonesttags.h
songinfo/lastfmtrackinfoprovider.h songinfo/lastfmtrackinfoprovider.h
songinfo/tagwidget.h songinfo/tagwidget.h
UI UI
internet/lastfmsettingspage.ui internet/lastfm/lastfmsettingspage.ui
) )
optional_source(HAVE_SPOTIFY_DOWNLOADER optional_source(HAVE_SPOTIFY_DOWNLOADER
SOURCES SOURCES
internet/spotifyblobdownloader.cpp internet/spotify/spotifyblobdownloader.cpp
HEADERS HEADERS
internet/spotifyblobdownloader.h internet/spotify/spotifyblobdownloader.h
INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES
${QCA_INCLUDE_DIRS} ${QCA_INCLUDE_DIRS}
) )
@ -1085,61 +1085,61 @@ optional_source(HAVE_MOODBAR
# Google Drive support # Google Drive support
optional_source(HAVE_GOOGLE_DRIVE optional_source(HAVE_GOOGLE_DRIVE
SOURCES SOURCES
internet/googledriveclient.cpp internet/googledrive/googledriveclient.cpp
internet/googledriveservice.cpp internet/googledrive/googledriveservice.cpp
internet/googledrivesettingspage.cpp internet/googledrive/googledrivesettingspage.cpp
internet/googledriveurlhandler.cpp internet/googledrive/googledriveurlhandler.cpp
HEADERS HEADERS
internet/googledriveclient.h internet/googledrive/googledriveclient.h
internet/googledriveservice.h internet/googledrive/googledriveservice.h
internet/googledrivesettingspage.h internet/googledrive/googledrivesettingspage.h
internet/googledriveurlhandler.h internet/googledrive/googledriveurlhandler.h
UI UI
internet/googledrivesettingspage.ui internet/googledrive/googledrivesettingspage.ui
) )
# Dropbox support # Dropbox support
optional_source(HAVE_DROPBOX optional_source(HAVE_DROPBOX
SOURCES SOURCES
internet/dropboxauthenticator.cpp internet/dropbox/dropboxauthenticator.cpp
internet/dropboxservice.cpp internet/dropbox/dropboxservice.cpp
internet/dropboxsettingspage.cpp internet/dropbox/dropboxsettingspage.cpp
internet/dropboxurlhandler.cpp internet/dropbox/dropboxurlhandler.cpp
HEADERS HEADERS
internet/dropboxauthenticator.h internet/dropbox/dropboxauthenticator.h
internet/dropboxservice.h internet/dropbox/dropboxservice.h
internet/dropboxsettingspage.h internet/dropbox/dropboxsettingspage.h
internet/dropboxurlhandler.h internet/dropbox/dropboxurlhandler.h
UI UI
internet/dropboxsettingspage.ui internet/dropbox/dropboxsettingspage.ui
) )
# Skydrive support # Skydrive support
optional_source(HAVE_SKYDRIVE optional_source(HAVE_SKYDRIVE
SOURCES SOURCES
internet/skydriveservice.cpp internet/skydrive/skydriveservice.cpp
internet/skydrivesettingspage.cpp internet/skydrive/skydrivesettingspage.cpp
internet/skydriveurlhandler.cpp internet/skydrive/skydriveurlhandler.cpp
HEADERS HEADERS
internet/skydriveservice.h internet/skydrive/skydriveservice.h
internet/skydrivesettingspage.h internet/skydrive/skydrivesettingspage.h
internet/skydriveurlhandler.h internet/skydrive/skydriveurlhandler.h
UI UI
internet/skydrivesettingspage.ui internet/skydrive/skydrivesettingspage.ui
) )
# Box support # Box support
optional_source(HAVE_BOX optional_source(HAVE_BOX
SOURCES SOURCES
internet/boxservice.cpp internet/box/boxservice.cpp
internet/boxsettingspage.cpp internet/box/boxsettingspage.cpp
internet/boxurlhandler.cpp internet/box/boxurlhandler.cpp
HEADERS HEADERS
internet/boxservice.h internet/box/boxservice.h
internet/boxsettingspage.h internet/box/boxsettingspage.h
internet/boxurlhandler.h internet/box/boxurlhandler.h
UI UI
internet/boxsettingspage.ui internet/box/boxsettingspage.ui
) )
# Vk.com support # Vk.com support
@ -1148,39 +1148,39 @@ optional_source(HAVE_VK
${VREEN_INCLUDE_DIRS} ${VREEN_INCLUDE_DIRS}
SOURCES SOURCES
globalsearch/vksearchprovider.cpp globalsearch/vksearchprovider.cpp
internet/vkconnection.cpp internet/vk/vkconnection.cpp
internet/vkmusiccache.cpp internet/vk/vkmusiccache.cpp
internet/vksearchdialog.cpp internet/vk/vksearchdialog.cpp
internet/vkservice.cpp internet/vk/vkservice.cpp
internet/vksettingspage.cpp internet/vk/vksettingspage.cpp
internet/vkurlhandler.cpp internet/vk/vkurlhandler.cpp
HEADERS HEADERS
globalsearch/vksearchprovider.h globalsearch/vksearchprovider.h
internet/vkconnection.h internet/vk/vkconnection.h
internet/vkmusiccache.h internet/vk/vkmusiccache.h
internet/vksearchdialog.h internet/vk/vksearchdialog.h
internet/vkservice.h internet/vk/vkservice.h
internet/vksettingspage.h internet/vk/vksettingspage.h
internet/vkurlhandler.h internet/vk/vkurlhandler.h
UI UI
internet/vksearchdialog.ui internet/vk/vksearchdialog.ui
internet/vksettingspage.ui internet/vk/vksettingspage.ui
) )
# Seafile support # Seafile support
optional_source(HAVE_SEAFILE optional_source(HAVE_SEAFILE
SOURCES SOURCES
internet/seafileservice.cpp internet/seafile/seafileservice.cpp
internet/seafilesettingspage.cpp internet/seafile/seafilesettingspage.cpp
internet/seafileurlhandler.cpp internet/seafile/seafileurlhandler.cpp
internet/seafiletree.cpp internet/seafile/seafiletree.cpp
HEADERS HEADERS
internet/seafileservice.h internet/seafile/seafileservice.h
internet/seafilesettingspage.h internet/seafile/seafilesettingspage.h
internet/seafileurlhandler.h internet/seafile/seafileurlhandler.h
internet/seafiletree.h internet/seafile/seafiletree.h
UI UI
internet/seafilesettingspage.ui internet/seafile/seafilesettingspage.ui
) )

View File

@ -31,7 +31,7 @@
#include "covers/coverproviders.h" #include "covers/coverproviders.h"
#include "covers/currentartloader.h" #include "covers/currentartloader.h"
#include "devices/devicemanager.h" #include "devices/devicemanager.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "globalsearch/globalsearch.h" #include "globalsearch/globalsearch.h"
#include "library/library.h" #include "library/library.h"
#include "library/librarybackend.h" #include "library/librarybackend.h"
@ -39,14 +39,14 @@
#include "networkremote/networkremotehelper.h" #include "networkremote/networkremotehelper.h"
#include "playlist/playlistbackend.h" #include "playlist/playlistbackend.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
#include "podcasts/gpoddersync.h" #include "internet/podcasts/gpoddersync.h"
#include "podcasts/podcastbackend.h" #include "internet/podcasts/podcastbackend.h"
#include "podcasts/podcastdeleter.h" #include "internet/podcasts/podcastdeleter.h"
#include "podcasts/podcastdownloader.h" #include "internet/podcasts/podcastdownloader.h"
#include "podcasts/podcastupdater.h" #include "internet/podcasts/podcastupdater.h"
#ifdef HAVE_LIBLASTFM #ifdef HAVE_LIBLASTFM
#include "internet/lastfmservice.h" #include "internet/lastfm/lastfmservice.h"
#endif // HAVE_LIBLASTFM #endif // HAVE_LIBLASTFM
#ifdef HAVE_MOODBAR #ifdef HAVE_MOODBAR

View File

@ -30,17 +30,17 @@
#include "engines/enginebase.h" #include "engines/enginebase.h"
#include "engines/gstengine.h" #include "engines/gstengine.h"
#include "globalsearch/searchprovider.h" #include "globalsearch/searchprovider.h"
#include "internet/digitallyimportedclient.h" #include "internet/digitally/digitallyimportedclient.h"
#include "internet/geolocator.h" #include "internet/core/geolocator.h"
#include "internet/somafmservice.h" #include "internet/somafm/somafmservice.h"
#include "library/directory.h" #include "library/directory.h"
#include "playlist/playlist.h" #include "playlist/playlist.h"
#include "podcasts/podcastepisode.h" #include "internet/podcasts/podcastepisode.h"
#include "podcasts/podcast.h" #include "internet/podcasts/podcast.h"
#include "ui/equalizer.h" #include "ui/equalizer.h"
#ifdef HAVE_VK #ifdef HAVE_VK
#include "internet/vkservice.h" #include "internet/vk/vkservice.h"
#endif #endif
#ifdef HAVE_DBUS #ifdef HAVE_DBUS

View File

@ -45,7 +45,7 @@
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
#ifdef HAVE_LIBLASTFM #ifdef HAVE_LIBLASTFM
#include "internet/lastfmservice.h" #include "internet/lastfm/lastfmservice.h"
#endif #endif
using std::shared_ptr; using std::shared_ptr;

View File

@ -43,7 +43,7 @@
#include <QtConcurrentRun> #include <QtConcurrentRun>
#ifdef HAVE_LIBLASTFM #ifdef HAVE_LIBLASTFM
#include "internet/fixlastfm.h" #include "internet/lastfm/fixlastfm.h"
#ifdef HAVE_LIBLASTFM1 #ifdef HAVE_LIBLASTFM1
#include <lastfm/Track.h> #include <lastfm/Track.h>
#else #else

View File

@ -38,16 +38,16 @@
#include "core/song.h" #include "core/song.h"
#include "core/tagreaderclient.h" #include "core/tagreaderclient.h"
#include "core/timeconstants.h" #include "core/timeconstants.h"
#include "internet/fixlastfm.h" #include "internet/lastfm/fixlastfm.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "library/librarybackend.h" #include "library/librarybackend.h"
#include "library/sqlrow.h" #include "library/sqlrow.h"
#include "playlistparsers/cueparser.h" #include "playlistparsers/cueparser.h"
#include "playlistparsers/parserbase.h" #include "playlistparsers/parserbase.h"
#include "playlistparsers/playlistparser.h" #include "playlistparsers/playlistparser.h"
#include "podcasts/podcastparser.h" #include "internet/podcasts/podcastparser.h"
#include "podcasts/podcastservice.h" #include "internet/podcasts/podcastservice.h"
#include "podcasts/podcasturlloader.h" #include "internet/podcasts/podcasturlloader.h"
#ifdef HAVE_AUDIOCD #ifdef HAVE_AUDIOCD
#include <gst/audio/gstaudiocdsrc.h> #include <gst/audio/gstaudiocdsrc.h>

View File

@ -29,8 +29,8 @@
#include "core/network.h" #include "core/network.h"
#include "core/tagreaderclient.h" #include "core/tagreaderclient.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "internet/spotifyservice.h" #include "internet/spotify/spotifyservice.h"
AlbumCoverLoader::AlbumCoverLoader(QObject* parent) AlbumCoverLoader::AlbumCoverLoader(QObject* parent)
: QObject(parent), : QObject(parent),

View File

@ -22,7 +22,7 @@
#include "albumcoverfetcher.h" #include "albumcoverfetcher.h"
#include "coverprovider.h" #include "coverprovider.h"
#include "core/closure.h" #include "core/closure.h"
#include "internet/lastfmcompat.h" #include "internet/lastfm/lastfmcompat.h"
LastFmCoverProvider::LastFmCoverProvider(QObject* parent) LastFmCoverProvider::LastFmCoverProvider(QObject* parent)
: CoverProvider("last.fm", parent) {} : CoverProvider("last.fm", parent) {}

View File

@ -31,9 +31,9 @@
#include "core/mac_startup.h" #include "core/mac_startup.h"
#include "core/signalchecker.h" #include "core/signalchecker.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "internet/spotifyserver.h" #include "internet/spotify/spotifyserver.h"
#include "internet/spotifyservice.h" #include "internet/spotify/spotifyservice.h"
const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000; const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
const int GstEnginePipeline::kFaderFudgeMsec = 2000; const int GstEnginePipeline::kFaderFudgeMsec = 2000;

View File

@ -19,7 +19,7 @@
#define DIGITALLYIMPORTEDSEARCHPROVIDER_H #define DIGITALLYIMPORTEDSEARCHPROVIDER_H
#include "simplesearchprovider.h" #include "simplesearchprovider.h"
#include "internet/digitallyimportedservicebase.h" #include "internet/digitally/digitallyimportedservicebase.h"
class DigitallyImportedSearchProvider : public SimpleSearchProvider { class DigitallyImportedSearchProvider : public SimpleSearchProvider {
public: public:

View File

@ -22,7 +22,7 @@
#include "core/application.h" #include "core/application.h"
#include "core/logging.h" #include "core/logging.h"
#include "covers/albumcoverloader.h" #include "covers/albumcoverloader.h"
#include "internet/groovesharkservice.h" #include "internet/grooveshark/groovesharkservice.h"
GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app, GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app,
QObject* parent) QObject* parent)

View File

@ -20,7 +20,7 @@
#include "searchprovider.h" #include "searchprovider.h"
#include "covers/albumcoverloaderoptions.h" #include "covers/albumcoverloaderoptions.h"
#include "internet/groovesharkservice.h" #include "internet/grooveshark/groovesharkservice.h"
class AlbumCoverLoader; class AlbumCoverLoader;

View File

@ -16,7 +16,7 @@
*/ */
#include "icecastsearchprovider.h" #include "icecastsearchprovider.h"
#include "internet/icecastbackend.h" #include "internet/icecast/icecastbackend.h"
IcecastSearchProvider::IcecastSearchProvider(IcecastBackend* backend, IcecastSearchProvider::IcecastSearchProvider(IcecastBackend* backend,
Application* app, QObject* parent) Application* app, QObject* parent)

View File

@ -19,7 +19,7 @@
#define SAVEDRADIOSEARCHPROVIDER_H #define SAVEDRADIOSEARCHPROVIDER_H
#include "simplesearchprovider.h" #include "simplesearchprovider.h"
#include "internet/savedradio.h" #include "internet/internetradio/savedradio.h"
class SavedRadioSearchProvider : public SimpleSearchProvider { class SavedRadioSearchProvider : public SimpleSearchProvider {
public: public:

View File

@ -17,7 +17,7 @@
#include "searchprovider.h" #include "searchprovider.h"
#include "core/boundfuturewatcher.h" #include "core/boundfuturewatcher.h"
#include "internet/internetsongmimedata.h" #include "internet/core/internetsongmimedata.h"
#include "playlist/songmimedata.h" #include "playlist/songmimedata.h"
#include <QPainter> #include <QPainter>

View File

@ -19,7 +19,7 @@
#define SOMAFMSEARCHPROVIDER_H #define SOMAFMSEARCHPROVIDER_H
#include "simplesearchprovider.h" #include "simplesearchprovider.h"
#include "internet/somafmservice.h" #include "internet/somafm/somafmservice.h"
class SomaFMSearchProvider : public SimpleSearchProvider { class SomaFMSearchProvider : public SimpleSearchProvider {
public: public:

View File

@ -22,7 +22,7 @@
#include "core/application.h" #include "core/application.h"
#include "core/logging.h" #include "core/logging.h"
#include "covers/albumcoverloader.h" #include "covers/albumcoverloader.h"
#include "internet/soundcloudservice.h" #include "internet/soundcloud/soundcloudservice.h"
SoundCloudSearchProvider::SoundCloudSearchProvider(Application* app, SoundCloudSearchProvider::SoundCloudSearchProvider(Application* app,
QObject* parent) QObject* parent)

View File

@ -20,7 +20,7 @@
#include "searchprovider.h" #include "searchprovider.h"
#include "covers/albumcoverloaderoptions.h" #include "covers/albumcoverloaderoptions.h"
#include "internet/soundcloudservice.h" #include "internet/soundcloud/soundcloudservice.h"
class AlbumCoverLoader; class AlbumCoverLoader;

View File

@ -21,8 +21,8 @@
#include <random> #include <random>
#include "core/logging.h" #include "core/logging.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "internet/spotifyserver.h" #include "internet/spotify/spotifyserver.h"
#include "playlist/songmimedata.h" #include "playlist/songmimedata.h"
namespace { namespace {

View File

@ -20,7 +20,7 @@
#include "searchprovider.h" #include "searchprovider.h"
#include "spotifymessages.pb.h" #include "spotifymessages.pb.h"
#include "internet/spotifyservice.h" #include "internet/spotify/spotifyservice.h"
class SpotifyServer; class SpotifyServer;

View File

@ -19,7 +19,7 @@
#ifndef VKSEARCHPROVIDER_H #ifndef VKSEARCHPROVIDER_H
#define VKSEARCHPROVIDER_H #define VKSEARCHPROVIDER_H
#include "internet/vkservice.h" #include "internet/vk/vkservice.h"
#include "searchprovider.h" #include "searchprovider.h"

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "boxservice.h" #include "boxservice.h"
#include <qjson/parser.h> #include <qjson/parser.h>
@ -5,8 +23,8 @@
#include "core/application.h" #include "core/application.h"
#include "core/player.h" #include "core/player.h"
#include "core/waitforsignal.h" #include "core/waitforsignal.h"
#include "internet/boxurlhandler.h" #include "internet/box/boxurlhandler.h"
#include "internet/oauthenticator.h" #include "internet/core/oauthenticator.h"
#include "library/librarybackend.h" #include "library/librarybackend.h"
const char* BoxService::kServiceName = "Box"; const char* BoxService::kServiceName = "Box";
@ -27,7 +45,7 @@ static const int kRootFolderId = 0;
static const char* kFileContent = "https://api.box.com/2.0/files/%1/content"; static const char* kFileContent = "https://api.box.com/2.0/files/%1/content";
static const char* kEvents = "https://api.box.com/2.0/events"; static const char* kEvents = "https://api.box.com/2.0/events";
} } // namespace
BoxService::BoxService(Application* app, InternetModel* parent) BoxService::BoxService(Application* app, InternetModel* parent)
: CloudFileService(app, parent, kServiceName, kSettingsGroup, : CloudFileService(app, parent, kServiceName, kSettingsGroup,
@ -263,7 +281,7 @@ void BoxService::UpdateFilesFromCursor(const QString& cursor) {
} }
void BoxService::FetchEventsFinished(QNetworkReply* reply) { void BoxService::FetchEventsFinished(QNetworkReply* reply) {
// TODO: Page through events. // TODO(John Maguire): Page through events.
reply->deleteLater(); reply->deleteLater();
QJson::Parser parser; QJson::Parser parser;
QVariantMap response = parser.parse(reply).toMap(); QVariantMap response = parser.parse(reply).toMap();

View File

@ -1,7 +1,25 @@
#ifndef BOXSERVICE_H /* This file is part of Clementine.
#define BOXSERVICE_H Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
#include "cloudfileservice.h" Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_BOX_BOXSERVICE_H_
#define INTERNET_BOX_BOXSERVICE_H_
#include "internet/core/cloudfileservice.h"
#include <QDateTime> #include <QDateTime>
@ -11,6 +29,7 @@ class QNetworkRequest;
class BoxService : public CloudFileService { class BoxService : public CloudFileService {
Q_OBJECT Q_OBJECT
public: public:
BoxService(Application* app, InternetModel* parent); BoxService(Application* app, InternetModel* parent);
@ -52,4 +71,4 @@ signals:
QDateTime expiry_time_; QDateTime expiry_time_;
}; };
#endif // BOXSERVICE_H #endif // INTERNET_BOX_BOXSERVICE_H_

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2013, John Maguire <john.maguire@gmail.com> Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -21,8 +22,8 @@
#include "ui_boxsettingspage.h" #include "ui_boxsettingspage.h"
#include "core/application.h" #include "core/application.h"
#include "internet/boxservice.h" #include "internet/box/boxservice.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "ui/settingsdialog.h" #include "ui/settingsdialog.h"
BoxSettingsPage::BoxSettingsPage(SettingsDialog* parent) BoxSettingsPage::BoxSettingsPage(SettingsDialog* parent)

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2013, John Maguire <john.maguire@gmail.com> Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +16,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef BOXSETTINGSPAGE_H #ifndef INTERNET_BOX_BOXSETTINGSPAGE_H_
#define BOXSETTINGSPAGE_H #define INTERNET_BOX_BOXSETTINGSPAGE_H_
#include "ui/settingspage.h" #include "ui/settingspage.h"
@ -30,7 +31,7 @@ class BoxSettingsPage : public SettingsPage {
Q_OBJECT Q_OBJECT
public: public:
BoxSettingsPage(SettingsDialog* parent = nullptr); explicit BoxSettingsPage(SettingsDialog* parent = nullptr);
~BoxSettingsPage(); ~BoxSettingsPage();
void Load(); void Load();
@ -50,4 +51,4 @@ class BoxSettingsPage : public SettingsPage {
BoxService* service_; BoxService* service_;
}; };
#endif // BOXSETTINGSPAGE_H #endif // INTERNET_BOX_BOXSETTINGSPAGE_H_

View File

@ -0,0 +1,30 @@
/* This file is part of Clementine.
Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "boxurlhandler.h"
#include "boxservice.h"
BoxUrlHandler::BoxUrlHandler(BoxService* service, QObject* parent)
: UrlHandler(parent), service_(service) {}
UrlHandler::LoadResult BoxUrlHandler::StartLoading(const QUrl& url) {
QString file_id = url.path();
QUrl real_url = service_->GetStreamingUrlFromSongId(file_id);
return LoadResult(url, LoadResult::TrackAvailable, real_url);
}

View File

@ -0,0 +1,40 @@
/* This file is part of Clementine.
Copyright 2013, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_BOX_BOXURLHANDLER_H_
#define INTERNET_BOX_BOXURLHANDLER_H_
#include "core/urlhandler.h"
class BoxService;
class BoxUrlHandler : public UrlHandler {
Q_OBJECT
public:
explicit BoxUrlHandler(BoxService* service, QObject* parent = nullptr);
QString scheme() const { return "box"; }
QIcon icon() const { return QIcon(":/providers/box.png"); }
LoadResult StartLoading(const QUrl& url);
private:
BoxService* service_;
};
#endif // INTERNET_BOX_BOXURLHANDLER_H_

View File

@ -1,12 +0,0 @@
#include "boxurlhandler.h"
#include "boxservice.h"
BoxUrlHandler::BoxUrlHandler(BoxService* service, QObject* parent)
: UrlHandler(parent), service_(service) {}
UrlHandler::LoadResult BoxUrlHandler::StartLoading(const QUrl& url) {
QString file_id = url.path();
QUrl real_url = service_->GetStreamingUrlFromSongId(file_id);
return LoadResult(url, LoadResult::TrackAvailable, real_url);
}

View File

@ -1,21 +0,0 @@
#ifndef BOXURLHANDLER_H
#define BOXURLHANDLER_H
#include "core/urlhandler.h"
class BoxService;
class BoxUrlHandler : public UrlHandler {
Q_OBJECT
public:
BoxUrlHandler(BoxService* service, QObject* parent = nullptr);
QString scheme() const { return "box"; }
QIcon icon() const { return QIcon(":/providers/box.png"); }
LoadResult StartLoading(const QUrl& url);
private:
BoxService* service_;
};
#endif // BOXURLHANDLER_H

View File

@ -1,4 +1,5 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.com> Copyright 2014, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
@ -15,22 +16,15 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "internet/cloudfilesearchprovider.h" #include "internet/core/cloudfilesearchprovider.h"
#include "internet/cloudfileservice.h" #include "internet/core/cloudfileservice.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
CloudFileSearchProvider::CloudFileSearchProvider( CloudFileSearchProvider::CloudFileSearchProvider(
LibraryBackendInterface* backend, LibraryBackendInterface* backend, const QString& id, const QIcon& icon,
const QString& id,
const QIcon& icon,
CloudFileService* service) CloudFileService* service)
: LibrarySearchProvider(backend, : LibrarySearchProvider(backend, service->name(), id, icon, true,
service->name(), service->model()->app(), service),
id,
icon,
true,
service->model()->app(),
service),
service_(service) { service_(service) {
SetHint(CanShowConfig); SetHint(CanShowConfig);
} }
@ -39,9 +33,7 @@ bool CloudFileSearchProvider::IsLoggedIn() {
return service_->has_credentials(); return service_->has_credentials();
} }
void CloudFileSearchProvider::ShowConfig() { void CloudFileSearchProvider::ShowConfig() { service_->ShowSettingsDialog(); }
service_->ShowSettingsDialog();
}
InternetService* CloudFileSearchProvider::internet_service() { InternetService* CloudFileSearchProvider::internet_service() {
return service_; return service_;

View File

@ -1,4 +1,5 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.com> Copyright 2014, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
@ -15,8 +16,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef CLOUDFILESEARCHPROVIDER_H #ifndef INTERNET_CORE_CLOUDFILESEARCHPROVIDER_H_
#define CLOUDFILESEARCHPROVIDER_H #define INTERNET_CORE_CLOUDFILESEARCHPROVIDER_H_
#include "globalsearch/librarysearchprovider.h" #include "globalsearch/librarysearchprovider.h"
@ -24,10 +25,8 @@ class CloudFileService;
class CloudFileSearchProvider : public LibrarySearchProvider { class CloudFileSearchProvider : public LibrarySearchProvider {
public: public:
CloudFileSearchProvider(LibraryBackendInterface* backend, CloudFileSearchProvider(LibraryBackendInterface* backend, const QString& id,
const QString& id, const QIcon& icon, CloudFileService* service);
const QIcon& icon,
CloudFileService* service);
virtual bool IsLoggedIn(); virtual bool IsLoggedIn();
virtual void ShowConfig(); virtual void ShowConfig();
@ -37,4 +36,4 @@ class CloudFileSearchProvider : public LibrarySearchProvider {
CloudFileService* service_; CloudFileService* service_;
}; };
#endif // CLOUDFILESEARCHPROVIDER_H #endif // INTERNET_CORE_CLOUDFILESEARCHPROVIDER_H_

View File

@ -1,4 +1,24 @@
#include "cloudfileservice.h" /* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Martin Brodbeck <martin@brodbeck-online.de>
Copyright 2013-2014, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "internet/core/cloudfileservice.h"
#include <QMenu> #include <QMenu>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -10,8 +30,8 @@
#include "core/player.h" #include "core/player.h"
#include "core/taskmanager.h" #include "core/taskmanager.h"
#include "globalsearch/globalsearch.h" #include "globalsearch/globalsearch.h"
#include "internet/cloudfilesearchprovider.h" #include "internet/core/cloudfilesearchprovider.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "library/librarybackend.h" #include "library/librarybackend.h"
#include "library/librarymodel.h" #include "library/librarymodel.h"
#include "playlist/playlist.h" #include "playlist/playlist.h"
@ -129,21 +149,20 @@ void CloudFileService::MaybeAddFileToDatabase(const Song& metadata,
} }
if (indexing_task_id_ == -1) { if (indexing_task_id_ == -1) {
indexing_task_id_ = indexing_task_id_ = task_manager_->StartTask(tr("Indexing %1").arg(name()));
task_manager_->StartTask(tr("Indexing %1").arg(name()));
indexing_task_progress_ = 0; indexing_task_progress_ = 0;
indexing_task_max_ = 0; indexing_task_max_ = 0;
} }
indexing_task_max_++; indexing_task_max_++;
task_manager_->SetTaskProgress( task_manager_->SetTaskProgress(indexing_task_id_, indexing_task_progress_,
indexing_task_id_, indexing_task_progress_, indexing_task_max_); indexing_task_max_);
TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadCloudFile( TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadCloudFile(
download_url, metadata.title(), metadata.filesize(), mime_type, download_url, metadata.title(), metadata.filesize(), mime_type,
authorisation); authorisation);
NewClosure(reply, SIGNAL(Finished(bool)), this, NewClosure(reply, SIGNAL(Finished(bool)), this,
SLOT(ReadTagsFinished(TagReaderClient::ReplyType*, Song)), SLOT(ReadTagsFinished(TagReaderClient::ReplyType*, Song)), reply,
reply, metadata); metadata);
} }
void CloudFileService::ReadTagsFinished(TagReaderClient::ReplyType* reply, void CloudFileService::ReadTagsFinished(TagReaderClient::ReplyType* reply,
@ -156,8 +175,8 @@ void CloudFileService::ReadTagsFinished(TagReaderClient::ReplyType* reply,
indexing_task_id_ = -1; indexing_task_id_ = -1;
emit AllIndexingTasksFinished(); emit AllIndexingTasksFinished();
} else { } else {
task_manager_->SetTaskProgress( task_manager_->SetTaskProgress(indexing_task_id_, indexing_task_progress_,
indexing_task_id_, indexing_task_progress_, indexing_task_max_); indexing_task_max_);
} }
const pb::tagreader::ReadCloudFileResponse& message = const pb::tagreader::ReadCloudFileResponse& message =

View File

@ -1,7 +1,26 @@
#ifndef CLOUDFILESERVICE_H /* This file is part of Clementine.
#define CLOUDFILESERVICE_H Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.com>
#include "internetservice.h" Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_CORE_CLOUDFILESERVICE_H_
#define INTERNET_CORE_CLOUDFILESERVICE_H_
#include "internet/core/internetservice.h"
#include <memory> #include <memory>
@ -19,6 +38,7 @@ class PlaylistManager;
class CloudFileService : public InternetService { class CloudFileService : public InternetService {
Q_OBJECT Q_OBJECT
public: public:
CloudFileService(Application* app, InternetModel* parent, CloudFileService(Application* app, InternetModel* parent,
const QString& service_name, const QString& service_id, const QString& service_name, const QString& service_id,
@ -76,4 +96,4 @@ class CloudFileService : public InternetService {
int indexing_task_max_; int indexing_task_max_;
}; };
#endif // CLOUDFILESERVICE_H #endif // INTERNET_CORE_CLOUDFILESERVICE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GEOLOCATOR_H #ifndef INTERNET_CORE_GEOLOCATOR_H_
#define GEOLOCATOR_H #define INTERNET_CORE_GEOLOCATOR_H_
#include <QObject> #include <QObject>
@ -24,6 +26,7 @@
class Geolocator : public QObject { class Geolocator : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit Geolocator(QObject* parent = nullptr); explicit Geolocator(QObject* parent = nullptr);
@ -62,4 +65,4 @@ signals:
QDebug operator<<(QDebug dbg, const Geolocator::LatLng& ll); QDebug operator<<(QDebug dbg, const Geolocator::LatLng& ll);
Q_DECLARE_METATYPE(Geolocator::LatLng); Q_DECLARE_METATYPE(Geolocator::LatLng);
#endif // GEOLOCATOR_H #endif // INTERNET_CORE_GEOLOCATOR_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2011, David Sansome <davidsansome@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETMIMEDATA_H #ifndef INTERNET_CORE_INTERNETMIMEDATA_H_
#define INTERNETMIMEDATA_H #define INTERNET_CORE_INTERNETMIMEDATA_H_
#include "core/mimedata.h" #include "core/mimedata.h"
@ -29,10 +32,10 @@ class InternetMimeData : public MimeData {
Q_OBJECT Q_OBJECT
public: public:
InternetMimeData(const InternetModel* _model) : model(_model) {} explicit InternetMimeData(const InternetModel* _model) : model(_model) {}
const InternetModel* model; const InternetModel* model;
QModelIndexList indexes; QModelIndexList indexes;
}; };
#endif // INTERNETMIMEDATA_H #endif // INTERNET_CORE_INTERNETMIMEDATA_H_

View File

@ -1,5 +1,13 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2014, David Sansome <me@davidsansome.com>
Copyright 2011-2012, 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2012-2013, Alan Briolat <alan.briolat@gmail.com>
Copyright 2012-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Maltsev Vlad <shedwardx@gmail.com>
Copyright 2014, Chocobozzz <florian.bigard@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,46 +23,46 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "internetmodel.h" #include "internet/core/internetmodel.h"
#include <QMimeData> #include <QMimeData>
#include <QtDebug> #include <QtDebug>
#include "digitallyimportedservicebase.h" #include "internet/digitally/digitallyimportedservicebase.h"
#include "groovesharkservice.h" #include "internet/grooveshark/groovesharkservice.h"
#include "icecastservice.h" #include "internet/icecast/icecastservice.h"
#include "internetmimedata.h" #include "internet/core/internetmimedata.h"
#include "internetservice.h" #include "internet/core/internetservice.h"
#include "jamendoservice.h" #include "internet/jamendo/jamendoservice.h"
#include "magnatuneservice.h" #include "internet/magnatune/magnatuneservice.h"
#include "savedradio.h" #include "internet/internetradio/savedradio.h"
#include "somafmservice.h" #include "internet/somafm/somafmservice.h"
#include "soundcloudservice.h" #include "internet/soundcloud/soundcloudservice.h"
#include "spotifyservice.h" #include "internet/spotify/spotifyservice.h"
#include "subsonicservice.h" #include "internet/subsonic/subsonicservice.h"
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/mergedproxymodel.h" #include "core/mergedproxymodel.h"
#include "podcasts/podcastservice.h" #include "internet/podcasts/podcastservice.h"
#include "smartplaylists/generatormimedata.h" #include "smartplaylists/generatormimedata.h"
#ifdef HAVE_GOOGLE_DRIVE #ifdef HAVE_GOOGLE_DRIVE
#include "googledriveservice.h" #include "internet/googledrive/googledriveservice.h"
#endif #endif
#ifdef HAVE_DROPBOX #ifdef HAVE_DROPBOX
#include "dropboxservice.h" #include "internet/dropbox/dropboxservice.h"
#endif #endif
#ifdef HAVE_SKYDRIVE #ifdef HAVE_SKYDRIVE
#include "skydriveservice.h" #include "internet/skydrive/skydriveservice.h"
#endif #endif
#ifdef HAVE_BOX #ifdef HAVE_BOX
#include "boxservice.h" #include "internet/box/boxservice.h"
#endif #endif
#ifdef HAVE_VK #ifdef HAVE_VK
#include "vkservice.h" #include "internet/vk/vkservice.h"
#endif #endif
#ifdef HAVE_SEAFILE #ifdef HAVE_SEAFILE
#include "seafileservice.h" #include "internet/seafile/seafileservice.h"
#endif #endif
using smart_playlists::Generator; using smart_playlists::Generator;

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2012, David Sansome <me@davidsansome.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011-2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2014, Chocobozzz <florian.bigard@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +20,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETMODEL_H #ifndef INTERNET_CORE_INTERNETMODEL_H_
#define INTERNETMODEL_H #define INTERNET_CORE_INTERNETMODEL_H_
#include "core/song.h" #include "core/song.h"
#include "library/librarymodel.h" #include "library/librarymodel.h"
@ -42,7 +47,7 @@ class InternetModel : public QStandardItemModel {
Q_OBJECT Q_OBJECT
public: public:
InternetModel(Application* app, QObject* parent = nullptr); explicit InternetModel(Application* app, QObject* parent = nullptr);
enum Role { enum Role {
// Services can use this role to distinguish between different types of // Services can use this role to distinguish between different types of
@ -193,4 +198,4 @@ signals:
QModelIndex current_index_; QModelIndex current_index_;
}; };
#endif // INTERNETMODEL_H #endif // INTERNET_CORE_INTERNETMODEL_H_

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2011, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,17 +19,18 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "internetplaylistitem.h" #include "internet/core/internetplaylistitem.h"
#include "internetservice.h"
#include "internetmodel.h"
#include "core/settingsprovider.h"
#include "library/sqlrow.h"
#include "playlist/playlistbackend.h"
#include <QSettings> #include <QSettings>
#include <QApplication> #include <QApplication>
#include <QtDebug> #include <QtDebug>
#include "internet/core/internetservice.h"
#include "internet/core/internetmodel.h"
#include "core/settingsprovider.h"
#include "library/sqlrow.h"
#include "playlist/playlistbackend.h"
InternetPlaylistItem::InternetPlaylistItem(const QString& type) InternetPlaylistItem::InternetPlaylistItem(const QString& type)
: PlaylistItem(type), set_service_icon_(false) {} : PlaylistItem(type), set_service_icon_(false) {}

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2011, David Sansome <davidsansome@gmail.com>
Copyright 2010, John Maguire <john.maguire@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +19,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETPLAYLISTITEM_H #ifndef INTERNET_CORE_INTERNETPLAYLISTITEM_H_
#define INTERNETPLAYLISTITEM_H #define INTERNET_CORE_INTERNETPLAYLISTITEM_H_
#include "core/song.h" #include "core/song.h"
#include "playlist/playlistitem.h" #include "playlist/playlistitem.h"
@ -27,7 +31,7 @@ class InternetService;
class InternetPlaylistItem : public PlaylistItem { class InternetPlaylistItem : public PlaylistItem {
public: public:
InternetPlaylistItem(const QString& type); explicit InternetPlaylistItem(const QString& type);
InternetPlaylistItem(InternetService* service, const Song& metadata); InternetPlaylistItem(InternetService* service, const Song& metadata);
Options options() const; Options options() const;
@ -55,4 +59,4 @@ class InternetPlaylistItem : public PlaylistItem {
Song metadata_; Song metadata_;
}; };
#endif // INTERNETPLAYLISTITEM_H #endif // INTERNET_CORE_INTERNETPLAYLISTITEM_H_

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,16 +20,17 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "internetservice.h" #include "internet/core/internetservice.h"
#include "internetmodel.h"
#include <QMenu>
#include <QStandardItem>
#include "internet/core/internetmodel.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/mergedproxymodel.h" #include "core/mergedproxymodel.h"
#include "core/mimedata.h" #include "core/mimedata.h"
#include "ui/iconloader.h" #include "ui/iconloader.h"
#include <QMenu>
#include <QStandardItem>
InternetService::InternetService(const QString& name, Application* app, InternetService::InternetService(const QString& name, Application* app,
InternetModel* model, QObject* parent) InternetModel* model, QObject* parent)
: QObject(parent), : QObject(parent),

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2012, David Sansome <me@davidsansome.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011-2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +20,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETSERVICE_H #ifndef INTERNET_CORE_INTERNETSERVICE_H_
#define INTERNETSERVICE_H #define INTERNET_CORE_INTERNETSERVICE_H_
#include <QObject> #include <QObject>
#include <QList> #include <QList>
@ -134,4 +139,4 @@ signals:
Q_DECLARE_METATYPE(InternetService*); Q_DECLARE_METATYPE(InternetService*);
#endif // INTERNETSERVICE_H #endif // INTERNET_CORE_INTERNETSERVICE_H_

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2014, Chocobozzz <florian.bigard@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -19,8 +20,8 @@
#include "core/application.h" #include "core/application.h"
#include "ui/settingsdialog.h" #include "ui/settingsdialog.h"
#include "internetservice.h" #include "internet/core/internetservice.h"
#include "internetmodel.h" #include "internet/core/internetmodel.h"
#include <QSettings> #include <QSettings>

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2014, Chocobozzz <florian.bigard@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +16,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETSHOWSETTINGSPAGE_H #ifndef INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_
#define INTERNETSHOWSETTINGSPAGE_H #define INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_
#include "ui/settingspage.h" #include "ui/settingspage.h"
#include "ui_internetshowsettingspage.h" #include "ui_internetshowsettingspage.h"
@ -30,7 +31,7 @@ class InternetShowSettingsPage : public SettingsPage {
Q_OBJECT Q_OBJECT
public: public:
InternetShowSettingsPage(SettingsDialog* dialog); explicit InternetShowSettingsPage(SettingsDialog* dialog);
void Load(); void Load();
void Save(); void Save();
@ -39,4 +40,4 @@ class InternetShowSettingsPage : public SettingsPage {
std::unique_ptr<Ui_InternetShowSettingsPage> ui_; std::unique_ptr<Ui_InternetShowSettingsPage> ui_;
}; };
#endif // INTERNETSHOWSETTINGSPAGE_H #endif // INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETSONGMIMEDATA_H #ifndef INTERNET_CORE_INTERNETSONGMIMEDATA_H_
#define INTERNETSONGMIMEDATA_H #define INTERNET_CORE_INTERNETSONGMIMEDATA_H_
#include "core/mimedata.h" #include "core/mimedata.h"
#include "core/song.h" #include "core/song.h"
@ -27,10 +29,10 @@ class InternetSongMimeData : public MimeData {
Q_OBJECT Q_OBJECT
public: public:
InternetSongMimeData(InternetService* _service) : service(_service) {} explicit InternetSongMimeData(InternetService* _service) : service(_service) {}
InternetService* service; InternetService* service;
SongList songs; SongList songs;
}; };
#endif // INTERNETSONGMIMEDATA_H #endif // INTERNET_CORE_INTERNETSONGMIMEDATA_H_

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2010, 2012, David Sansome <me@davidsansome.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,12 +20,13 @@
*/ */
#include "internetview.h" #include "internetview.h"
#include "internetmodel.h"
#include "core/mergedproxymodel.h"
#include "library/libraryview.h"
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include "internet/core/internetmodel.h"
#include "core/mergedproxymodel.h"
#include "library/libraryview.h"
InternetView::InternetView(QWidget* parent) : AutoExpandingTreeView(parent) { InternetView::InternetView(QWidget* parent) : AutoExpandingTreeView(parent) {
setItemDelegate(new LibraryItemDelegate(this)); setItemDelegate(new LibraryItemDelegate(this));
SetExpandOnReset(false); SetExpandOnReset(false);

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETVIEW_H #ifndef INTERNET_CORE_INTERNETVIEW_H_
#define INTERNETVIEW_H #define INTERNET_CORE_INTERNETVIEW_H_
#include "widgets/autoexpandingtreeview.h" #include "widgets/autoexpandingtreeview.h"
@ -24,7 +27,7 @@ class InternetView : public AutoExpandingTreeView {
Q_OBJECT Q_OBJECT
public: public:
InternetView(QWidget* parent = nullptr); explicit InternetView(QWidget* parent = nullptr);
// QWidget // QWidget
void contextMenuEvent(QContextMenuEvent* e); void contextMenuEvent(QContextMenuEvent* e);
@ -37,4 +40,4 @@ signals:
void CurrentIndexChanged(const QModelIndex& index); void CurrentIndexChanged(const QModelIndex& index);
}; };
#endif // INTERNETVIEW_H #endif // INTERNET_CORE_INTERNETVIEW_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,17 +19,18 @@
*/ */
#include "internetviewcontainer.h" #include "internetviewcontainer.h"
#include "internetmodel.h"
#include "internetservice.h"
#include "ui_internetviewcontainer.h" #include "ui_internetviewcontainer.h"
#include "core/application.h"
#include "core/mergedproxymodel.h"
#include "globalsearch/globalsearch.h"
#include <QMetaMethod> #include <QMetaMethod>
#include <QTimeLine> #include <QTimeLine>
#include <QtDebug> #include <QtDebug>
#include "internet/core/internetmodel.h"
#include "internet/core/internetservice.h"
#include "core/application.h"
#include "core/mergedproxymodel.h"
#include "globalsearch/globalsearch.h"
const int InternetViewContainer::kAnimationDuration = 500; const int InternetViewContainer::kAnimationDuration = 500;
InternetViewContainer::InternetViewContainer(QWidget* parent) InternetViewContainer::InternetViewContainer(QWidget* parent)

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INTERNETVIEWCONTAINER_H #ifndef INTERNET_CORE_INTERNETVIEWCONTAINER_H_
#define INTERNETVIEWCONTAINER_H #define INTERNET_CORE_INTERNETVIEWCONTAINER_H_
#include <QWidget> #include <QWidget>
#include <QMap> #include <QMap>
@ -34,7 +36,7 @@ class InternetViewContainer : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
InternetViewContainer(QWidget* parent = nullptr); explicit InternetViewContainer(QWidget* parent = nullptr);
~InternetViewContainer(); ~InternetViewContainer();
static const int kAnimationDuration; static const int kAnimationDuration;
@ -72,4 +74,4 @@ class InternetViewContainer : public QWidget {
QMap<QWidget*, HeaderData> headers_; QMap<QWidget*, HeaderData> headers_;
}; };
#endif // INTERNETVIEWCONTAINER_H #endif // INTERNET_CORE_INTERNETVIEWCONTAINER_H_

View File

@ -69,7 +69,7 @@
<customwidget> <customwidget>
<class>InternetView</class> <class>InternetView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>internet/internetview.h</header> <header>internet/core/internetview.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "localredirectserver.h" #include "localredirectserver.h"
#include <QApplication> #include <QApplication>

View File

@ -0,0 +1,61 @@
/* This file is part of Clementine.
Copyright 2012, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_CORE_LOCALREDIRECTSERVER_H_
#define INTERNET_CORE_LOCALREDIRECTSERVER_H_
#include <QByteArray>
#include <QObject>
#include <QUrl>
class QTcpServer;
class QTcpSocket;
class LocalRedirectServer : public QObject {
Q_OBJECT
public:
explicit LocalRedirectServer(QObject* parent = nullptr);
// Causes the server to listen for _one_ request.
void Listen();
// Returns the HTTP URL of this server.
const QUrl& url() const { return url_; }
// Returns the URL requested by the OAuth redirect.
const QUrl& request_url() const { return request_url_; }
signals:
void Finished();
private slots:
void NewConnection();
void ReadyRead(QTcpSocket* socket, QByteArray buffer);
private:
void WriteTemplate(QTcpSocket* socket) const;
QUrl ParseUrlFromRequest(const QByteArray& request) const;
private:
QTcpServer* server_;
QUrl url_;
QUrl request_url_;
};
#endif // INTERNET_CORE_LOCALREDIRECTSERVER_H_

View File

@ -1,4 +1,24 @@
#include "oauthenticator.h" /* This file is part of Clementine.
Copyright 2012-2014, John Maguire <john.maguire@gmail.com>
Copyright 2012, 2014, David Sansome <me@davidsansome.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "internet/core/oauthenticator.h"
#include <QDesktopServices> #include <QDesktopServices>
#include <QStringList> #include <QStringList>
@ -8,9 +28,10 @@
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
#include "internet/localredirectserver.h" #include "internet/core/localredirectserver.h"
const char* OAuthenticator::kRemoteURL = "https://clementine-data.appspot.com/skydrive"; const char* OAuthenticator::kRemoteURL =
"https://clementine-data.appspot.com/skydrive";
OAuthenticator::OAuthenticator(const QString& client_id, OAuthenticator::OAuthenticator(const QString& client_id,
const QString& client_secret, const QString& client_secret,
@ -73,8 +94,7 @@ void OAuthenticator::RequestAccessToken(const QByteArray& code,
const QUrl& url) { const QUrl& url) {
typedef QPair<QString, QString> Param; typedef QPair<QString, QString> Param;
QList<Param> parameters; QList<Param> parameters;
parameters << Param("code", code) parameters << Param("code", code) << Param("client_id", client_id_)
<< Param("client_id", client_id_)
<< Param("client_secret", client_secret_) << Param("client_secret", client_secret_)
<< Param("grant_type", "authorization_code") << Param("grant_type", "authorization_code")
// Even though we don't use this URI anymore, it must match the // Even though we don't use this URI anymore, it must match the

View File

@ -1,5 +1,25 @@
#ifndef OAUTHENTICATOR_H /* This file is part of Clementine.
#define OAUTHENTICATOR_H Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_CORE_OAUTHENTICATOR_H_
#define INTERNET_CORE_OAUTHENTICATOR_H_
#include <QDateTime> #include <QDateTime>
#include <QObject> #include <QObject>
@ -11,6 +31,7 @@ class QTcpSocket;
class OAuthenticator : public QObject { class OAuthenticator : public QObject {
Q_OBJECT Q_OBJECT
public: public:
enum class RedirectStyle { enum class RedirectStyle {
// Redirect to localhost immediately. // Redirect to localhost immediately.
@ -67,4 +88,4 @@ signals:
RedirectStyle redirect_style_; RedirectStyle redirect_style_;
}; };
#endif #endif // INTERNET_CORE_OAUTHENTICATOR_H_

View File

@ -0,0 +1,54 @@
/* This file is part of Clementine.
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_CORE_SCROBBLER_H_
#define INTERNET_CORE_SCROBBLER_H_
#include <QObject>
class Song;
class Scrobbler : public QObject {
Q_OBJECT
public:
explicit Scrobbler(QObject* parent = nullptr) {}
virtual bool IsAuthenticated() const = 0;
virtual bool IsScrobblingEnabled() const = 0;
virtual bool AreButtonsVisible() const = 0;
virtual bool IsScrobbleButtonVisible() const = 0;
virtual bool PreferAlbumArtist() const = 0;
public slots:
virtual void NowPlaying(const Song& song) = 0;
virtual void Scrobble() = 0;
virtual void Love() = 0;
virtual void ToggleScrobbling() = 0;
virtual void ShowConfig() = 0;
signals:
void AuthenticationComplete(bool success, const QString& error_message);
void ScrobblingEnabledChanged(bool value);
void ButtonVisibilityChanged(bool value);
void ScrobbleButtonVisibilityChanged(bool value);
void ScrobbleSubmitted();
void ScrobbleError(int value);
};
#endif // INTERNET_CORE_SCROBBLER_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, Maltsev Vlad <shedwardx@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,15 +18,16 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "internetservice.h" #include "internet/core/searchboxwidget.h"
#include "searchboxwidget.h"
#include "ui_searchboxwidget.h" #include "ui_searchboxwidget.h"
#include "ui/iconloader.h"
#include "widgets/didyoumean.h"
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include "internet/core/internetservice.h"
#include "ui/iconloader.h"
#include "widgets/didyoumean.h"
SearchBoxWidget::SearchBoxWidget(InternetService* service) SearchBoxWidget::SearchBoxWidget(InternetService* service)
: service_(service), : service_(service),
ui_(new Ui_SearchBoxWidget), ui_(new Ui_SearchBoxWidget),
@ -58,8 +62,7 @@ void SearchBoxWidget::FocusOnFilter(QKeyEvent* event) {
QApplication::sendEvent(ui_->filter, event); QApplication::sendEvent(ui_->filter, event);
} }
void SearchBoxWidget::SetText(const QString &text) void SearchBoxWidget::SetText(const QString& text) {
{
ui_->filter->setText(text); ui_->filter->setText(text);
} }

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, Maltsev Vlad <shedwardx@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef SEARCHBOXWIDGET_H #ifndef INTERNET_CORE_SEARCHBOXWIDGET_H_
#define SEARCHBOXWIDGET_H #define INTERNET_CORE_SEARCHBOXWIDGET_H_
#include <QWidget> #include <QWidget>
@ -31,7 +34,7 @@ class SearchBoxWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
SearchBoxWidget(InternetService* service); explicit SearchBoxWidget(InternetService* service);
~SearchBoxWidget(); ~SearchBoxWidget();
DidYouMean* did_you_mean() { return did_you_mean_; } DidYouMean* did_you_mean() { return did_you_mean_; }
@ -53,4 +56,4 @@ signals:
DidYouMean* did_you_mean_; DidYouMean* did_you_mean_;
}; };
#endif // SEARCHBOXWIDGET_H #endif // INTERNET_CORE_SEARCHBOXWIDGET_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,14 +18,15 @@
*/ */
#include "digitallyimportedclient.h" #include "digitallyimportedclient.h"
#include "core/logging.h"
#include "core/network.h"
#include <qjson/parser.h> #include <qjson/parser.h>
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkRequest> #include <QNetworkRequest>
#include "core/logging.h"
#include "core/network.h"
// The API used here is undocumented - it was reverse engineered by watching // The API used here is undocumented - it was reverse engineered by watching
// calls made by the sky.fm android app: // calls made by the sky.fm android app:
// https://market.android.com/details?id=com.audioaddict.sky // https://market.android.com/details?id=com.audioaddict.sky
@ -44,10 +47,10 @@ DigitallyImportedClient::DigitallyImportedClient(const QString& service_name,
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
service_name_(service_name) {} service_name_(service_name) {}
void DigitallyImportedClient::SetAuthorisationHeader(QNetworkRequest* req) void DigitallyImportedClient::SetAuthorisationHeader(
const { QNetworkRequest* req) const {
req->setRawHeader("Authorization", req->setRawHeader("Authorization", "Basic " +
"Basic " + QString("%1:%2") QString("%1:%2")
.arg(kApiUsername, kApiPassword) .arg(kApiUsername, kApiPassword)
.toAscii() .toAscii()
.toBase64()); .toBase64());

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef DIGITALLYIMPORTEDCLIENT_H #ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDCLIENT_H_
#define DIGITALLYIMPORTEDCLIENT_H #define INTERNET_DIGITALLY_DIGITALLYIMPORTEDCLIENT_H_
#include <QDateTime> #include <QDateTime>
#include <QObject> #include <QObject>
@ -31,7 +33,7 @@ class DigitallyImportedClient : public QObject {
Q_OBJECT Q_OBJECT
public: public:
DigitallyImportedClient(const QString& service_name, QObject* parent = nullptr); explicit DigitallyImportedClient(const QString& service_name, QObject* parent = nullptr);
static const char* kApiUsername; static const char* kApiUsername;
static const char* kApiPassword; static const char* kApiPassword;
@ -84,4 +86,4 @@ QDataStream& operator>>(QDataStream& in,
DigitallyImportedClient::Channel& channel); DigitallyImportedClient::Channel& channel);
Q_DECLARE_METATYPE(DigitallyImportedClient::Channel) Q_DECLARE_METATYPE(DigitallyImportedClient::Channel)
#endif // DIGITALLYIMPORTEDCLIENT_H #endif // INTERNET_DIGITALLY_DIGITALLYIMPORTEDCLIENT_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2011-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -24,7 +27,7 @@
#include "digitallyimportedclient.h" #include "digitallyimportedclient.h"
#include "digitallyimportedurlhandler.h" #include "digitallyimportedurlhandler.h"
#include "internetmodel.h" #include "internet/core/internetmodel.h"
#include "core/application.h" #include "core/application.h"
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
@ -249,16 +252,14 @@ SkyFmService::SkyFmService(Application* app, InternetModel* model,
JazzRadioService::JazzRadioService(Application* app, InternetModel* model, JazzRadioService::JazzRadioService(Application* app, InternetModel* model,
QObject* parent) QObject* parent)
: DigitallyImportedServiceBase( : DigitallyImportedServiceBase("JazzRadio", "JAZZRADIO.com",
"JazzRadio", "JAZZRADIO.com", QUrl("http://www.jazzradio.com"), QUrl("http://www.jazzradio.com"),
QIcon(":/providers/jazzradio.png"), "jazzradio", app, model, true, QIcon(":/providers/jazzradio.png"),
parent) { "jazzradio", app, model, true, parent) {}
}
RockRadioService::RockRadioService(Application* app, InternetModel* model, RockRadioService::RockRadioService(Application* app, InternetModel* model,
QObject* parent) QObject* parent)
: DigitallyImportedServiceBase( : DigitallyImportedServiceBase("RockRadio", "ROCKRADIO.com",
"RockRadio", "ROCKRADIO.com", QUrl("http://www.rockradio.com"), QUrl("http://www.rockradio.com"),
QIcon(":/providers/rockradio.png"), "rockradio", app, model, false, QIcon(":/providers/rockradio.png"),
parent) { "rockradio", app, model, false, parent) {}
}

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,13 +17,13 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef DIGITALLYIMPORTEDSERVICEBASE_H #ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDSERVICEBASE_H_
#define DIGITALLYIMPORTEDSERVICEBASE_H #define INTERNET_DIGITALLY_DIGITALLYIMPORTEDSERVICEBASE_H_
#include <memory> #include <memory>
#include "digitallyimportedclient.h" #include "digitallyimportedclient.h"
#include "internetservice.h" #include "internet/core/internetservice.h"
#include "core/cachedlist.h" #include "core/cachedlist.h"
class DigitallyImportedClient; class DigitallyImportedClient;
@ -38,8 +40,7 @@ class DigitallyImportedServiceBase : public InternetService {
const QUrl& homepage_url, const QIcon& icon, const QUrl& homepage_url, const QIcon& icon,
const QString& api_service_name, const QString& api_service_name,
Application* app, InternetModel* model, Application* app, InternetModel* model,
bool has_premium, bool has_premium, QObject* parent = nullptr);
QObject* parent = nullptr);
~DigitallyImportedServiceBase(); ~DigitallyImportedServiceBase();
static const char* kSettingsGroup; static const char* kSettingsGroup;
@ -118,7 +119,8 @@ class DigitallyImportedService : public DigitallyImportedServiceBase {
class SkyFmService : public DigitallyImportedServiceBase { class SkyFmService : public DigitallyImportedServiceBase {
public: public:
SkyFmService(Application* app, InternetModel* model, QObject* parent = nullptr); SkyFmService(Application* app, InternetModel* model,
QObject* parent = nullptr);
}; };
class JazzRadioService : public DigitallyImportedServiceBase { class JazzRadioService : public DigitallyImportedServiceBase {
@ -133,4 +135,4 @@ class RockRadioService : public DigitallyImportedServiceBase {
QObject* parent = nullptr); QObject* parent = nullptr);
}; };
#endif // DIGITALLYIMPORTEDSERVICEBASE_H #endif // INTERNET_DIGITALLY_DIGITALLYIMPORTEDSERVICEBASE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,16 +17,17 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "digitallyimportedclient.h"
#include "digitallyimportedservicebase.h"
#include "digitallyimportedsettingspage.h" #include "digitallyimportedsettingspage.h"
#include "ui_digitallyimportedsettingspage.h" #include "ui_digitallyimportedsettingspage.h"
#include "core/closure.h"
#include <QMessageBox> #include <QMessageBox>
#include <QNetworkReply> #include <QNetworkReply>
#include <QSettings> #include <QSettings>
#include "digitallyimportedclient.h"
#include "digitallyimportedservicebase.h"
#include "core/closure.h"
DigitallyImportedSettingsPage::DigitallyImportedSettingsPage( DigitallyImportedSettingsPage::DigitallyImportedSettingsPage(
SettingsDialog* dialog) SettingsDialog* dialog)
: SettingsPage(dialog), : SettingsPage(dialog),

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef DIGITALLYIMPORTEDSETTINGSPAGE_H #ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDSETTINGSPAGE_H_
#define DIGITALLYIMPORTEDSETTINGSPAGE_H #define INTERNET_DIGITALLY_DIGITALLYIMPORTEDSETTINGSPAGE_H_
#include "ui/settingspage.h" #include "ui/settingspage.h"
@ -29,7 +31,7 @@ class DigitallyImportedSettingsPage : public SettingsPage {
Q_OBJECT Q_OBJECT
public: public:
DigitallyImportedSettingsPage(SettingsDialog* dialog); explicit DigitallyImportedSettingsPage(SettingsDialog* dialog);
~DigitallyImportedSettingsPage(); ~DigitallyImportedSettingsPage();
void Load(); void Load();
@ -51,4 +53,4 @@ class DigitallyImportedSettingsPage : public SettingsPage {
DigitallyImportedClient* client_; DigitallyImportedClient* client_;
}; };
#endif // DIGITALLYIMPORTEDSETTINGSPAGE_H #endif // INTERNET_DIGITALLY_DIGITALLYIMPORTEDSETTINGSPAGE_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,9 +18,10 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "digitallyimportedservicebase.h"
#include "digitallyimportedurlhandler.h" #include "digitallyimportedurlhandler.h"
#include "internetmodel.h"
#include "digitallyimportedservicebase.h"
#include "internet/core/internetmodel.h"
#include "core/application.h" #include "core/application.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/taskmanager.h" #include "core/taskmanager.h"

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef DIGITALLYIMPORTEDURLHANDLER_H #ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDURLHANDLER_H_
#define DIGITALLYIMPORTEDURLHANDLER_H #define INTERNET_DIGITALLY_DIGITALLYIMPORTEDURLHANDLER_H_
#include "core/urlhandler.h" #include "core/urlhandler.h"
@ -43,4 +45,4 @@ class DigitallyImportedUrlHandler : public UrlHandler {
QUrl last_original_url_; QUrl last_original_url_;
}; };
#endif // DIGITALLYIMPORTEDURLHANDLER_H #endif // INTERNET_DIGITALLY_DIGITALLYIMPORTEDURLHANDLER_H_

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dropboxauthenticator.h" #include "dropboxauthenticator.h"
#include <time.h> #include <time.h>
@ -11,7 +29,7 @@
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/network.h" #include "core/network.h"
#include "internet/localredirectserver.h" #include "internet/core/localredirectserver.h"
namespace { namespace {
static const char* kAppKey = "qh6ca27eclt9p2k"; static const char* kAppKey = "qh6ca27eclt9p2k";
@ -61,7 +79,7 @@ QMap<QString, QString> ParseParamList(const QString& params) {
} }
return ret; return ret;
} }
} } // namespace
void DropboxAuthenticator::RequestTokenFinished(QNetworkReply* reply) { void DropboxAuthenticator::RequestTokenFinished(QNetworkReply* reply) {
reply->deleteLater(); reply->deleteLater();

View File

@ -1,5 +1,23 @@
#ifndef DROPBOXAUTHENTICATOR_H /* This file is part of Clementine.
#define DROPBOXAUTHENTICATOR_H Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_DROPBOX_DROPBOXAUTHENTICATOR_H_
#define INTERNET_DROPBOX_DROPBOXAUTHENTICATOR_H_
#include <QObject> #include <QObject>
#include <QTcpServer> #include <QTcpServer>
@ -10,6 +28,7 @@ class QNetworkReply;
class DropboxAuthenticator : public QObject { class DropboxAuthenticator : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit DropboxAuthenticator(QObject* parent = nullptr); explicit DropboxAuthenticator(QObject* parent = nullptr);
void StartAuthorisation(); void StartAuthorisation();
@ -54,4 +73,4 @@ signals:
QString name_; QString name_;
}; };
#endif // DROPBOXAUTHENTICATOR_H #endif // INTERNET_DROPBOX_DROPBOXAUTHENTICATOR_H_

View File

@ -1,3 +1,22 @@
/* This file is part of Clementine.
Copyright 2012-2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Martin Brodbeck <martin@brodbeck-online.de>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dropboxservice.h" #include "dropboxservice.h"
#include <QFileInfo> #include <QFileInfo>
@ -11,8 +30,8 @@
#include "core/player.h" #include "core/player.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "core/waitforsignal.h" #include "core/waitforsignal.h"
#include "internet/dropboxauthenticator.h" #include "internet/dropbox/dropboxauthenticator.h"
#include "internet/dropboxurlhandler.h" #include "internet/dropbox/dropboxurlhandler.h"
#include "library/librarybackend.h" #include "library/librarybackend.h"
using Utilities::ParseRFC822DateTime; using Utilities::ParseRFC822DateTime;

View File

@ -1,7 +1,25 @@
#ifndef DROPBOXSERVICE_H /* This file is part of Clementine.
#define DROPBOXSERVICE_H Copyright 2012-2013, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
#include "internet/cloudfileservice.h" Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_DROPBOX_DROPBOXSERVICE_H_
#define INTERNET_DROPBOX_DROPBOXSERVICE_H_
#include "internet/core/cloudfileservice.h"
#include "core/tagreaderclient.h" #include "core/tagreaderclient.h"
@ -11,6 +29,7 @@ class QNetworkReply;
class DropboxService : public CloudFileService { class DropboxService : public CloudFileService {
Q_OBJECT Q_OBJECT
public: public:
DropboxService(Application* app, InternetModel* parent); DropboxService(Application* app, InternetModel* parent);
@ -46,4 +65,4 @@ signals:
NetworkAccessManager* network_; NetworkAccessManager* network_;
}; };
#endif // DROPBOXSERVICE_H #endif // INTERNET_DROPBOX_DROPBOXSERVICE_H_

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -19,9 +20,9 @@
#include "ui_dropboxsettingspage.h" #include "ui_dropboxsettingspage.h"
#include "core/application.h" #include "core/application.h"
#include "internet/dropboxauthenticator.h" #include "internet/dropbox/dropboxauthenticator.h"
#include "internet/dropboxservice.h" #include "internet/dropbox/dropboxservice.h"
#include "internet/internetmodel.h" #include "internet/core/internetmodel.h"
#include "ui/settingsdialog.h" #include "ui/settingsdialog.h"
DropboxSettingsPage::DropboxSettingsPage(SettingsDialog* parent) DropboxSettingsPage::DropboxSettingsPage(SettingsDialog* parent)

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +16,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef DROPBOXSETTINGSPAGE_H #ifndef INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_
#define DROPBOXSETTINGSPAGE_H #define INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_
#include "ui/settingspage.h" #include "ui/settingspage.h"
@ -31,7 +32,7 @@ class DropboxSettingsPage : public SettingsPage {
Q_OBJECT Q_OBJECT
public: public:
DropboxSettingsPage(SettingsDialog* parent = nullptr); explicit DropboxSettingsPage(SettingsDialog* parent = nullptr);
~DropboxSettingsPage(); ~DropboxSettingsPage();
void Load(); void Load();
@ -51,4 +52,4 @@ class DropboxSettingsPage : public SettingsPage {
DropboxService* service_; DropboxService* service_;
}; };
#endif // DROPBOXSETTINGSPAGE_H #endif // INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_

View File

@ -0,0 +1,29 @@
/* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dropboxurlhandler.h"
#include "internet/dropbox/dropboxservice.h"
DropboxUrlHandler::DropboxUrlHandler(DropboxService* service, QObject* parent)
: UrlHandler(parent), service_(service) {}
UrlHandler::LoadResult DropboxUrlHandler::StartLoading(const QUrl& url) {
return LoadResult(url, LoadResult::TrackAvailable,
service_->GetStreamingUrlFromSongId(url));
}

View File

@ -0,0 +1,39 @@
/* This file is part of Clementine.
Copyright 2012, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_DROPBOX_DROPBOXURLHANDLER_H_
#define INTERNET_DROPBOX_DROPBOXURLHANDLER_H_
#include "core/urlhandler.h"
class DropboxService;
class DropboxUrlHandler : public UrlHandler {
Q_OBJECT
public:
explicit DropboxUrlHandler(DropboxService* service, QObject* parent = nullptr);
QString scheme() const { return "dropbox"; }
QIcon icon() const { return QIcon(":providers/dropbox.png"); }
LoadResult StartLoading(const QUrl& url);
private:
DropboxService* service_;
};
#endif // INTERNET_DROPBOX_DROPBOXURLHANDLER_H_

View File

@ -1,11 +0,0 @@
#include "dropboxurlhandler.h"
#include "internet/dropboxservice.h"
DropboxUrlHandler::DropboxUrlHandler(DropboxService* service, QObject* parent)
: UrlHandler(parent), service_(service) {}
UrlHandler::LoadResult DropboxUrlHandler::StartLoading(const QUrl& url) {
return LoadResult(url, LoadResult::TrackAvailable,
service_->GetStreamingUrlFromSongId(url));
}

View File

@ -1,21 +0,0 @@
#ifndef DROPBOXURLHANDLER_H
#define DROPBOXURLHANDLER_H
#include "core/urlhandler.h"
class DropboxService;
class DropboxUrlHandler : public UrlHandler {
Q_OBJECT
public:
DropboxUrlHandler(DropboxService* service, QObject* parent = nullptr);
QString scheme() const { return "dropbox"; }
QIcon icon() const { return QIcon(":providers/dropbox.png"); }
LoadResult StartLoading(const QUrl& url);
private:
DropboxService* service_;
};
#endif

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2012, 2014, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -19,7 +21,7 @@
#include <qjson/parser.h> #include <qjson/parser.h>
#include "oauthenticator.h" #include "internet/core/oauthenticator.h"
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/network.h" #include "core/network.h"
@ -44,7 +46,7 @@ static const char* kOAuthScope =
"https://www.googleapis.com/auth/userinfo.email"; "https://www.googleapis.com/auth/userinfo.email";
static const char* kClientId = "679260893280.apps.googleusercontent.com"; static const char* kClientId = "679260893280.apps.googleusercontent.com";
static const char* kClientSecret = "l3cWb8efUZsrBI4wmY3uKl6i"; static const char* kClientSecret = "l3cWb8efUZsrBI4wmY3uKl6i";
} } // namespace
QStringList File::parent_ids() const { QStringList File::parent_ids() const {
QStringList ret; QStringList ret;
@ -201,7 +203,7 @@ void Client::ListChangesFinished(ListChangesResponse* response,
QJson::Parser parser; QJson::Parser parser;
bool ok = false; bool ok = false;
// TODO: Put this on a separate thread as the response could be large. // TODO(John Maguire): Put this on a separate thread as the response could be large.
QVariantMap result = parser.parse(reply, &ok).toMap(); QVariantMap result = parser.parse(reply, &ok).toMap();
if (!ok) { if (!ok) {
qLog(Error) << "Failed to fetch changes" << response->cursor(); qLog(Error) << "Failed to fetch changes" << response->cursor();

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GOOGLEDRIVECLIENT_H #ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVECLIENT_H_
#define GOOGLEDRIVECLIENT_H #define INTERNET_GOOGLEDRIVE_GOOGLEDRIVECLIENT_H_
#include <QDateTime> #include <QDateTime>
#include <QList> #include <QList>
@ -37,7 +39,7 @@ class Client;
// Holds the metadata for a file on Google Drive. // Holds the metadata for a file on Google Drive.
class File { class File {
public: public:
File(const QVariantMap& data = QVariantMap()) : data_(data) {} explicit File(const QVariantMap& data = QVariantMap()) : data_(data) {}
static const char* kFolderMimeType; static const char* kFolderMimeType;
@ -46,7 +48,7 @@ class File {
QString title() const { return data_["title"].toString(); } QString title() const { return data_["title"].toString(); }
QString mime_type() const { return data_["mimeType"].toString(); } QString mime_type() const { return data_["mimeType"].toString(); }
QString description() const { return data_["description"].toString(); } QString description() const { return data_["description"].toString(); }
long size() const { return data_["fileSize"].toUInt(); } qint64 size() const { return data_["fileSize"].toUInt(); }
QUrl download_url() const { return data_["downloadUrl"].toUrl(); } QUrl download_url() const { return data_["downloadUrl"].toUrl(); }
QUrl alternate_link() const { return data_["alternateLink"].toUrl(); } QUrl alternate_link() const { return data_["alternateLink"].toUrl(); }
@ -89,7 +91,7 @@ signals:
void Finished(); void Finished();
private: private:
ConnectResponse(QObject* parent); explicit ConnectResponse(QObject* parent);
QString refresh_token_; QString refresh_token_;
QString user_email_; QString user_email_;
}; };
@ -134,7 +136,7 @@ class Client : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Client(QObject* parent = nullptr); explicit Client(QObject* parent = nullptr);
bool is_authenticated() const; bool is_authenticated() const;
const QString& access_token() const { return access_token_; } const QString& access_token() const { return access_token_; }
@ -166,6 +168,6 @@ signals:
QDateTime expiry_time_; QDateTime expiry_time_;
}; };
} // namespace } // namespace google_drive
#endif // GOOGLEDRIVECLIENT_H #endif // INTERNET_GOOGLEDRIVE_GOOGLEDRIVECLIENT_H_

View File

@ -1,3 +1,22 @@
/* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2012, 2014, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "googledriveservice.h" #include "googledriveservice.h"
#include <QDesktopServices> #include <QDesktopServices>
@ -23,7 +42,7 @@
#include "ui/iconloader.h" #include "ui/iconloader.h"
#include "googledriveclient.h" #include "googledriveclient.h"
#include "googledriveurlhandler.h" #include "googledriveurlhandler.h"
#include "internetmodel.h" #include "internet/core/internetmodel.h"
const char* GoogleDriveService::kServiceName = "Google Drive"; const char* GoogleDriveService::kServiceName = "Google Drive";
const char* GoogleDriveService::kSettingsGroup = "GoogleDrive"; const char* GoogleDriveService::kSettingsGroup = "GoogleDrive";
@ -92,9 +111,8 @@ void GoogleDriveService::ListChangesFinished(
if (is_indexing()) { if (is_indexing()) {
// Only save the cursor after all the songs have been indexed - that way if // Only save the cursor after all the songs have been indexed - that way if
// Clementine is closed it'll resume next time. // Clementine is closed it'll resume next time.
NewClosure(this, SIGNAL(AllIndexingTasksFinished()), NewClosure(this, SIGNAL(AllIndexingTasksFinished()), this,
this, SLOT(SaveCursor(QString)), SLOT(SaveCursor(QString)), cursor);
cursor);
} else { } else {
SaveCursor(cursor); SaveCursor(cursor);
} }
@ -198,12 +216,12 @@ void GoogleDriveService::ShowContextMenu(const QPoint& global_pos) {
QIcon(":/providers/googledrive.png"), tr("Open in Google Drive"), this, QIcon(":/providers/googledrive.png"), tr("Open in Google Drive"), this,
SLOT(OpenWithDrive())); SLOT(OpenWithDrive()));
context_menu_->addSeparator(); context_menu_->addSeparator();
update_action_ = context_menu_->addAction( update_action_ = context_menu_->addAction(IconLoader::Load("view-refresh"),
IconLoader::Load("view-refresh"), tr("Check for updates"), tr("Check for updates"), this,
this, SLOT(CheckForUpdates())); SLOT(CheckForUpdates()));
full_rescan_action_ = context_menu_->addAction( full_rescan_action_ = context_menu_->addAction(
IconLoader::Load("view-refresh"), tr("Do a full rescan..."), IconLoader::Load("view-refresh"), tr("Do a full rescan..."), this,
this, SLOT(ConfirmFullRescan())); SLOT(ConfirmFullRescan()));
context_menu_->addSeparator(); context_menu_->addSeparator();
context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"), context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"),
this, SLOT(ShowCoverManager())); this, SLOT(ShowCoverManager()));
@ -246,15 +264,14 @@ void GoogleDriveService::OpenWithDrive() {
void GoogleDriveService::ConfirmFullRescan() { void GoogleDriveService::ConfirmFullRescan() {
QMessageBox* message_box = new QMessageBox( QMessageBox* message_box = new QMessageBox(
QMessageBox::Warning, QMessageBox::Warning, tr("Do a full rescan"),
tr("Do a full rescan"),
tr("Doing a full rescan will lose any metadata you've saved in " tr("Doing a full rescan will lose any metadata you've saved in "
"Clementine such as cover art, play counts and ratings. Clementine " "Clementine such as cover art, play counts and ratings. Clementine "
"will rescan all your music in Google Drive which may take some " "will rescan all your music in Google Drive which may take some "
"time."), "time."),
QMessageBox::NoButton); QMessageBox::NoButton);
QPushButton* button = message_box->addButton( QPushButton* button = message_box->addButton(tr("Do a full rescan"),
tr("Do a full rescan"), QMessageBox::DestructiveRole); QMessageBox::DestructiveRole);
connect(button, SIGNAL(clicked()), SLOT(DoFullRescan())); connect(button, SIGNAL(clicked()), SLOT(DoFullRescan()));
message_box->addButton(QMessageBox::Cancel); message_box->addButton(QMessageBox::Cancel);

View File

@ -1,7 +1,26 @@
#ifndef GOOGLEDRIVESERVICE_H /* This file is part of Clementine.
#define GOOGLEDRIVESERVICE_H Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2012, 2014, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
#include "cloudfileservice.h" Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVESERVICE_H_
#define INTERNET_GOOGLEDRIVE_GOOGLEDRIVESERVICE_H_
#include "internet/core/cloudfileservice.h"
namespace google_drive { namespace google_drive {
class Client; class Client;
@ -13,6 +32,7 @@ class ListChangesResponse;
class GoogleDriveService : public CloudFileService { class GoogleDriveService : public CloudFileService {
Q_OBJECT Q_OBJECT
public: public:
GoogleDriveService(Application* app, InternetModel* parent); GoogleDriveService(Application* app, InternetModel* parent);
@ -58,4 +78,4 @@ signals:
QAction* full_rescan_action_; QAction* full_rescan_action_;
}; };
#endif #endif // INTERNET_GOOGLEDRIVE_GOOGLEDRIVESERVICE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,16 +17,17 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "googledriveclient.h"
#include "googledriveservice.h"
#include "googledrivesettingspage.h" #include "googledrivesettingspage.h"
#include "ui_googledrivesettingspage.h" #include "ui_googledrivesettingspage.h"
#include "core/application.h"
#include "internet/internetmodel.h"
#include "ui/settingsdialog.h"
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include "googledriveclient.h"
#include "googledriveservice.h"
#include "core/application.h"
#include "internet/core/internetmodel.h"
#include "ui/settingsdialog.h"
GoogleDriveSettingsPage::GoogleDriveSettingsPage(SettingsDialog* parent) GoogleDriveSettingsPage::GoogleDriveSettingsPage(SettingsDialog* parent)
: SettingsPage(parent), : SettingsPage(parent),
ui_(new Ui::GoogleDriveSettingsPage), ui_(new Ui::GoogleDriveSettingsPage),

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GOOGLEDRIVESETTINGSPAGE_H #ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_
#define GOOGLEDRIVESETTINGSPAGE_H #define INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_
#include "ui/settingspage.h" #include "ui/settingspage.h"
@ -30,7 +32,7 @@ class GoogleDriveSettingsPage : public SettingsPage {
Q_OBJECT Q_OBJECT
public: public:
GoogleDriveSettingsPage(SettingsDialog* parent = nullptr); explicit GoogleDriveSettingsPage(SettingsDialog* parent = nullptr);
~GoogleDriveSettingsPage(); ~GoogleDriveSettingsPage();
void Load(); void Load();
@ -50,4 +52,4 @@ class GoogleDriveSettingsPage : public SettingsPage {
GoogleDriveService* service_; GoogleDriveService* service_;
}; };
#endif // GOOGLEDRIVESETTINGSPAGE_H #endif // INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_

View File

@ -0,0 +1,31 @@
/* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "googledriveurlhandler.h"
#include "googledriveservice.h"
GoogleDriveUrlHandler::GoogleDriveUrlHandler(GoogleDriveService* service,
QObject* parent)
: UrlHandler(parent), service_(service) {}
UrlHandler::LoadResult GoogleDriveUrlHandler::StartLoading(const QUrl& url) {
QString file_id = url.path();
QUrl real_url = service_->GetStreamingUrlFromSongId(file_id);
return LoadResult(url, LoadResult::TrackAvailable, real_url);
}

View File

@ -0,0 +1,40 @@
/* This file is part of Clementine.
Copyright 2012, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVEURLHANDLER_H_
#define INTERNET_GOOGLEDRIVE_GOOGLEDRIVEURLHANDLER_H_
#include "core/urlhandler.h"
class GoogleDriveService;
class GoogleDriveUrlHandler : public UrlHandler {
Q_OBJECT
public:
explicit GoogleDriveUrlHandler(GoogleDriveService* service, QObject* parent = nullptr);
QString scheme() const { return "googledrive"; }
QIcon icon() const { return QIcon(":providers/googledrive.png"); }
LoadResult StartLoading(const QUrl& url);
private:
GoogleDriveService* service_;
};
#endif // INTERNET_GOOGLEDRIVE_GOOGLEDRIVEURLHANDLER_H_

View File

@ -1,13 +0,0 @@
#include "googledriveurlhandler.h"
#include "googledriveservice.h"
GoogleDriveUrlHandler::GoogleDriveUrlHandler(GoogleDriveService* service,
QObject* parent)
: UrlHandler(parent), service_(service) {}
UrlHandler::LoadResult GoogleDriveUrlHandler::StartLoading(const QUrl& url) {
QString file_id = url.path();
QUrl real_url = service_->GetStreamingUrlFromSongId(file_id);
return LoadResult(url, LoadResult::TrackAvailable, real_url);
}

View File

@ -1,21 +0,0 @@
#ifndef GOOGLEDRIVEURLHANDLER_H
#define GOOGLEDRIVEURLHANDLER_H
#include "core/urlhandler.h"
class GoogleDriveService;
class GoogleDriveUrlHandler : public UrlHandler {
Q_OBJECT
public:
GoogleDriveUrlHandler(GoogleDriveService* service, QObject* parent = nullptr);
QString scheme() const { return "googledrive"; }
QIcon icon() const { return QIcon(":providers/googledrive.png"); }
LoadResult StartLoading(const QUrl& url);
private:
GoogleDriveService* service_;
};
#endif

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -19,7 +21,7 @@
#include "groovesharkservice.h" #include "groovesharkservice.h"
#include "core/logging.h" #include "core/logging.h"
#include "internet/internetplaylistitem.h" #include "internet/core/internetplaylistitem.h"
GroovesharkRadio::GroovesharkRadio(GroovesharkService* service) GroovesharkRadio::GroovesharkRadio(GroovesharkService* service)
: service_(service), tag_id_(0), use_tag_(false), first_time_(true) {} : service_(service), tag_id_(0), use_tag_(false), first_time_(true) {}

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,20 +17,19 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GROOVESHARKRADIO_H #ifndef INTERNET_GROOVESHARK_GROOVESHARKRADIO_H_
#define GROOVESHARKRADIO_H #define INTERNET_GROOVESHARK_GROOVESHARKRADIO_H_
#include "smartplaylists/generator.h" #include "smartplaylists/generator.h"
class GroovesharkService; class GroovesharkService;
class GroovesharkRadio : public smart_playlists::Generator { class GroovesharkRadio : public smart_playlists::Generator {
public: public:
// Start Grooveshark radio for a particular type of music // Start Grooveshark radio for a particular type of music
GroovesharkRadio(GroovesharkService* service, int tag_id); GroovesharkRadio(GroovesharkService* service, int tag_id);
// Start Grooveshark radio based on last artists and songs you listen to // Start Grooveshark radio based on last artists and songs you listen to
GroovesharkRadio(GroovesharkService* service); explicit GroovesharkRadio(GroovesharkService* service);
QString type() const { return "Grooveshark"; } QString type() const { return "Grooveshark"; }
void Load(const QByteArray& data); void Load(const QByteArray& data);
@ -48,4 +49,4 @@ class GroovesharkRadio : public smart_playlists::Generator {
QVariantMap autoplay_state_; QVariantMap autoplay_state_;
}; };
#endif // GROOVESHARKRADIO_H #endif // INTERNET_GROOVESHARK_GROOVESHARKRADIO_H_

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011-2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2011-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, HYPNOTOAD <hypnotoad@clementine.org>
Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2014, Antonio Nicolás Pina <antonio@antonionicolaspina.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -36,10 +41,10 @@
#include "qtiocompressor.h" #include "qtiocompressor.h"
#include "internetmodel.h" #include "internet/core/internetmodel.h"
#include "groovesharkradio.h" #include "groovesharkradio.h"
#include "groovesharkurlhandler.h" #include "groovesharkurlhandler.h"
#include "searchboxwidget.h" #include "internet/core/searchboxwidget.h"
#include "core/application.h" #include "core/application.h"
#include "core/closure.h" #include "core/closure.h"
@ -118,7 +123,6 @@ GroovesharkService::GroovesharkService(Application* app, InternetModel* parent)
task_popular_id_(0), task_popular_id_(0),
task_playlists_id_(0), task_playlists_id_(0),
task_search_id_(0) { task_search_id_(0) {
app_->player()->RegisterUrlHandler(url_handler_); app_->player()->RegisterUrlHandler(url_handler_);
search_delay_->setInterval(kSearchDelayMsec); search_delay_->setInterval(kSearchDelayMsec);
@ -442,7 +446,8 @@ void GroovesharkService::RemoveItems() {
playlists_.clear(); playlists_.clear();
subscribed_playlists_parent_ = nullptr; subscribed_playlists_parent_ = nullptr;
subscribed_playlists_.clear(); subscribed_playlists_.clear();
// Cancel any pending requests and mark tasks as finished, in case they weren't // Cancel any pending requests and mark tasks as finished, in case they
// weren't
// finished yet. // finished yet.
pending_retrieve_playlists_.clear(); pending_retrieve_playlists_.clear();
app_->task_manager()->SetTaskFinished(task_playlists_id_); app_->task_manager()->SetTaskFinished(task_playlists_id_);
@ -719,7 +724,8 @@ void GroovesharkService::UserPlaylistsRetrieved(QNetworkReply* reply) {
} }
void GroovesharkService::PlaylistSongsRetrieved(QNetworkReply* reply, void GroovesharkService::PlaylistSongsRetrieved(QNetworkReply* reply,
int playlist_id, int request_id) { int playlist_id,
int request_id) {
reply->deleteLater(); reply->deleteLater();
if (!pending_retrieve_playlists_.remove(request_id)) { if (!pending_retrieve_playlists_.remove(request_id)) {
@ -1273,9 +1279,9 @@ void GroovesharkService::RefreshPlaylist(int playlist_id) {
parameters << Param("playlistID", playlist_id); parameters << Param("playlistID", playlist_id);
QNetworkReply* reply = CreateRequest("getPlaylistSongs", parameters); QNetworkReply* reply = CreateRequest("getPlaylistSongs", parameters);
int id = next_pending_playlist_retrieve_id_++; int id = next_pending_playlist_retrieve_id_++;
NewClosure(reply, SIGNAL(finished()), NewClosure(reply, SIGNAL(finished()), this,
this, SLOT(PlaylistSongsRetrieved(QNetworkReply*, int, int)), SLOT(PlaylistSongsRetrieved(QNetworkReply*, int, int)), reply,
reply, playlist_id, id); playlist_id, id);
pending_retrieve_playlists_.insert(id); pending_retrieve_playlists_.insert(id);
} }
@ -1470,7 +1476,6 @@ void GroovesharkService::RemoveCurrentFromPlaylist() {
const QModelIndexList& indexes(model()->selected_indexes()); const QModelIndexList& indexes(model()->selected_indexes());
QMap<int, QList<int>> playlists_songs_ids; QMap<int, QList<int>> playlists_songs_ids;
for (const QModelIndex& index : indexes) { for (const QModelIndex& index : indexes) {
if (index.parent().data(InternetModel::Role_Type).toInt() != if (index.parent().data(InternetModel::Role_Type).toInt() !=
InternetModel::Type_UserPlaylist) { InternetModel::Type_UserPlaylist) {
continue; continue;
@ -1508,7 +1513,6 @@ void GroovesharkService::RemoveCurrentFromFavorites() {
const QModelIndexList& indexes(model()->selected_indexes()); const QModelIndexList& indexes(model()->selected_indexes());
QList<int> songs_ids; QList<int> songs_ids;
for (const QModelIndex& index : indexes) { for (const QModelIndex& index : indexes) {
if (index.parent().data(Role_PlaylistType).toInt() != UserFavorites) { if (index.parent().data(Role_PlaylistType).toInt() != UserFavorites) {
continue; continue;
} }
@ -1561,7 +1565,6 @@ void GroovesharkService::RemoveCurrentFromLibrary() {
QList<int> songs_ids; QList<int> songs_ids;
for (const QModelIndex& index : indexes) { for (const QModelIndex& index : indexes) {
if (index.parent().data(Role_PlaylistType).toInt() != UserLibrary) { if (index.parent().data(Role_PlaylistType).toInt() != UserLibrary) {
continue; continue;
} }
@ -1619,7 +1622,6 @@ void GroovesharkService::SongsRemovedFromLibrary(QNetworkReply* reply,
QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name, QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name,
const QList<Param>& params, const QList<Param>& params,
bool use_https) { bool use_https) {
QVariantMap request_params; QVariantMap request_params;
request_params.insert("method", method_name); request_params.insert("method", method_name);
@ -1650,8 +1652,7 @@ QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name,
url.setScheme("https"); url.setScheme("https");
} }
url.setQueryItems( url.setQueryItems(
QList<QPair<QString, QString> >() QList<QPair<QString, QString>>() << QPair<QString, QString>(
<< QPair<QString, QString>(
"sig", Utilities::HmacMd5(api_key_, post_params).toHex())); "sig", Utilities::HmacMd5(api_key_, post_params).toHex()));
QNetworkRequest req(url); QNetworkRequest req(url);
QNetworkReply* reply = network_->post(req, post_params); QNetworkReply* reply = network_->post(req, post_params);
@ -1723,11 +1724,12 @@ bool CompareSongs(const QVariant& song1, const QVariant& song2) {
int song2_sort = song2_map["Sort"].toInt(); int song2_sort = song2_map["Sort"].toInt();
if (song1_sort == song2_sort) { if (song1_sort == song2_sort) {
// Favorite songs have a "TSFavorited" and (currently) no "Sort" field // Favorite songs have a "TSFavorited" and (currently) no "Sort" field
return song1_map["TSFavorited"].toString() < song2_map["TSFavorited"].toString(); return song1_map["TSFavorited"].toString() <
song2_map["TSFavorited"].toString();
} }
return song1_sort < song2_sort; return song1_sort < song2_sort;
} }
} } // namespace
SongList GroovesharkService::ExtractSongs(const QVariantMap& result) { SongList GroovesharkService::ExtractSongs(const QVariantMap& result) {
QVariantList result_songs = result["songs"].toList(); QVariantList result_songs = result["songs"].toList();

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011-2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2011-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,11 +18,11 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GROOVESHARKSERVICE_H #ifndef INTERNET_GROOVESHARK_GROOVESHARKSERVICE_H_
#define GROOVESHARKSERVICE_H #define INTERNET_GROOVESHARK_GROOVESHARKSERVICE_H_
#include "internetmodel.h" #include "internet/core/internetmodel.h"
#include "internetservice.h" #include "internet/core/internetservice.h"
#include <QSslError> #include <QSslError>
@ -35,6 +38,7 @@ class QSortFilterProxyModel;
class GroovesharkService : public InternetService { class GroovesharkService : public InternetService {
Q_OBJECT Q_OBJECT
public: public:
GroovesharkService(Application* app, InternetModel* parent); GroovesharkService(Application* app, InternetModel* parent);
~GroovesharkService(); ~GroovesharkService();
@ -332,4 +336,4 @@ signals:
static const char* kApiSecret; static const char* kApiSecret;
}; };
#endif // GROOVESHARKSERVICE_H #endif // INTERNET_GROOVESHARK_GROOVESHARKSERVICE_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011, 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,13 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "groovesharkservice.h"
#include "groovesharksettingspage.h" #include "groovesharksettingspage.h"
#include "internetmodel.h"
#include "core/logging.h"
#include "core/network.h"
#include "ui_groovesharksettingspage.h" #include "ui_groovesharksettingspage.h"
#include "ui/iconloader.h"
#include <QMessageBox> #include <QMessageBox>
#include <QNetworkReply> #include <QNetworkReply>
@ -29,6 +27,12 @@
#include <QSettings> #include <QSettings>
#include <QtDebug> #include <QtDebug>
#include "groovesharkservice.h"
#include "internet/core/internetmodel.h"
#include "core/logging.h"
#include "core/network.h"
#include "ui/iconloader.h"
GroovesharkSettingsPage::GroovesharkSettingsPage(SettingsDialog* dialog) GroovesharkSettingsPage::GroovesharkSettingsPage(SettingsDialog* dialog)
: SettingsPage(dialog), : SettingsPage(dialog),
ui_(new Ui_GroovesharkSettingsPage), ui_(new Ui_GroovesharkSettingsPage),

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GROOVESHARKSETTINGSPAGE_H #ifndef INTERNET_GROOVESHARK_GROOVESHARKSETTINGSPAGE_H_
#define GROOVESHARKSETTINGSPAGE_H #define INTERNET_GROOVESHARK_GROOVESHARKSETTINGSPAGE_H_
#include "ui/settingspage.h" #include "ui/settingspage.h"
@ -28,7 +30,7 @@ class GroovesharkSettingsPage : public SettingsPage {
Q_OBJECT Q_OBJECT
public: public:
GroovesharkSettingsPage(SettingsDialog* dialog); explicit GroovesharkSettingsPage(SettingsDialog* dialog);
~GroovesharkSettingsPage(); ~GroovesharkSettingsPage();
void Load(); void Load();
@ -51,4 +53,4 @@ class GroovesharkSettingsPage : public SettingsPage {
QString original_password_; QString original_password_;
}; };
#endif // GROOVESHARKSETTINGSPAGE_H #endif // INTERNET_GROOVESHARK_GROOVESHARKSETTINGSPAGE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com> Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show More