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 difflib
import os
@ -20,6 +21,9 @@ def main():
help='file extensions to reformat')
parser.add_argument('-i', dest='inplace', action='store_true',
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()
try:
@ -35,8 +39,14 @@ def main():
if not changed_files:
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
if args.files:
changed_files = args.files
for filename in changed_files:
if not os.path.splitext(filename)[1][1:] in args.extension:
continue

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@
#ifndef VKSEARCHPROVIDER_H
#define VKSEARCHPROVIDER_H
#include "internet/vkservice.h"
#include "internet/vk/vkservice.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 <qjson/parser.h>
@ -5,8 +23,8 @@
#include "core/application.h"
#include "core/player.h"
#include "core/waitforsignal.h"
#include "internet/boxurlhandler.h"
#include "internet/oauthenticator.h"
#include "internet/box/boxurlhandler.h"
#include "internet/core/oauthenticator.h"
#include "library/librarybackend.h"
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* kEvents = "https://api.box.com/2.0/events";
}
} // namespace
BoxService::BoxService(Application* app, InternetModel* parent)
: CloudFileService(app, parent, kServiceName, kSettingsGroup,
@ -263,7 +281,7 @@ void BoxService::UpdateFilesFromCursor(const QString& cursor) {
}
void BoxService::FetchEventsFinished(QNetworkReply* reply) {
// TODO: Page through events.
// TODO(John Maguire): Page through events.
reply->deleteLater();
QJson::Parser parser;
QVariantMap response = parser.parse(reply).toMap();

View File

@ -1,7 +1,25 @@
#ifndef BOXSERVICE_H
#define BOXSERVICE_H
/* This file is part of Clementine.
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>
@ -11,6 +29,7 @@ class QNetworkRequest;
class BoxService : public CloudFileService {
Q_OBJECT
public:
BoxService(Application* app, InternetModel* parent);
@ -24,7 +43,7 @@ class BoxService : public CloudFileService {
void Connect();
void ForgetCredentials();
signals:
signals:
void Connected();
private slots:
@ -52,4 +71,4 @@ signals:
QDateTime expiry_time_;
};
#endif // BOXSERVICE_H
#endif // INTERNET_BOX_BOXSERVICE_H_

View File

@ -1,5 +1,6 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -21,8 +22,8 @@
#include "ui_boxsettingspage.h"
#include "core/application.h"
#include "internet/boxservice.h"
#include "internet/internetmodel.h"
#include "internet/box/boxservice.h"
#include "internet/core/internetmodel.h"
#include "ui/settingsdialog.h"
BoxSettingsPage::BoxSettingsPage(SettingsDialog* parent)

View File

@ -1,5 +1,6 @@
/* 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
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/>.
*/
#ifndef BOXSETTINGSPAGE_H
#define BOXSETTINGSPAGE_H
#ifndef INTERNET_BOX_BOXSETTINGSPAGE_H_
#define INTERNET_BOX_BOXSETTINGSPAGE_H_
#include "ui/settingspage.h"
@ -30,7 +31,7 @@ class BoxSettingsPage : public SettingsPage {
Q_OBJECT
public:
BoxSettingsPage(SettingsDialog* parent = nullptr);
explicit BoxSettingsPage(SettingsDialog* parent = nullptr);
~BoxSettingsPage();
void Load();
@ -50,4 +51,4 @@ class BoxSettingsPage : public SettingsPage {
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,37 +1,31 @@
/* This file is part of Clementine.
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.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/cloudfilesearchprovider.h"
#include "internet/cloudfileservice.h"
#include "internet/internetmodel.h"
#include "internet/core/cloudfilesearchprovider.h"
#include "internet/core/cloudfileservice.h"
#include "internet/core/internetmodel.h"
CloudFileSearchProvider::CloudFileSearchProvider(
LibraryBackendInterface* backend,
const QString& id,
const QIcon& icon,
LibraryBackendInterface* backend, const QString& id, const QIcon& icon,
CloudFileService* service)
: LibrarySearchProvider(backend,
service->name(),
id,
icon,
true,
service->model()->app(),
service),
service_(service) {
: LibrarySearchProvider(backend, service->name(), id, icon, true,
service->model()->app(), service),
service_(service) {
SetHint(CanShowConfig);
}
@ -39,9 +33,7 @@ bool CloudFileSearchProvider::IsLoggedIn() {
return service_->has_credentials();
}
void CloudFileSearchProvider::ShowConfig() {
service_->ShowSettingsDialog();
}
void CloudFileSearchProvider::ShowConfig() { service_->ShowSettingsDialog(); }
InternetService* CloudFileSearchProvider::internet_service() {
return service_;

View File

@ -1,22 +1,23 @@
/* This file is part of Clementine.
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.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 CLOUDFILESEARCHPROVIDER_H
#define CLOUDFILESEARCHPROVIDER_H
#ifndef INTERNET_CORE_CLOUDFILESEARCHPROVIDER_H_
#define INTERNET_CORE_CLOUDFILESEARCHPROVIDER_H_
#include "globalsearch/librarysearchprovider.h"
@ -24,10 +25,8 @@ class CloudFileService;
class CloudFileSearchProvider : public LibrarySearchProvider {
public:
CloudFileSearchProvider(LibraryBackendInterface* backend,
const QString& id,
const QIcon& icon,
CloudFileService* service);
CloudFileSearchProvider(LibraryBackendInterface* backend, const QString& id,
const QIcon& icon, CloudFileService* service);
virtual bool IsLoggedIn();
virtual void ShowConfig();
@ -37,4 +36,4 @@ class CloudFileSearchProvider : public LibrarySearchProvider {
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 <QSortFilterProxyModel>
@ -10,8 +30,8 @@
#include "core/player.h"
#include "core/taskmanager.h"
#include "globalsearch/globalsearch.h"
#include "internet/cloudfilesearchprovider.h"
#include "internet/internetmodel.h"
#include "internet/core/cloudfilesearchprovider.h"
#include "internet/core/internetmodel.h"
#include "library/librarybackend.h"
#include "library/librarymodel.h"
#include "playlist/playlist.h"
@ -129,35 +149,34 @@ void CloudFileService::MaybeAddFileToDatabase(const Song& metadata,
}
if (indexing_task_id_ == -1) {
indexing_task_id_ =
task_manager_->StartTask(tr("Indexing %1").arg(name()));
indexing_task_id_ = task_manager_->StartTask(tr("Indexing %1").arg(name()));
indexing_task_progress_ = 0;
indexing_task_max_ = 0;
}
indexing_task_max_ ++;
task_manager_->SetTaskProgress(
indexing_task_id_, indexing_task_progress_, indexing_task_max_);
indexing_task_max_++;
task_manager_->SetTaskProgress(indexing_task_id_, indexing_task_progress_,
indexing_task_max_);
TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadCloudFile(
download_url, metadata.title(), metadata.filesize(), mime_type,
authorisation);
NewClosure(reply, SIGNAL(Finished(bool)), this,
SLOT(ReadTagsFinished(TagReaderClient::ReplyType*, Song)),
reply, metadata);
SLOT(ReadTagsFinished(TagReaderClient::ReplyType*, Song)), reply,
metadata);
}
void CloudFileService::ReadTagsFinished(TagReaderClient::ReplyType* reply,
const Song& metadata) {
reply->deleteLater();
indexing_task_progress_ ++;
indexing_task_progress_++;
if (indexing_task_progress_ == indexing_task_max_) {
task_manager_->SetTaskFinished(indexing_task_id_);
indexing_task_id_ = -1;
emit AllIndexingTasksFinished();
} else {
task_manager_->SetTaskProgress(
indexing_task_id_, indexing_task_progress_, indexing_task_max_);
task_manager_->SetTaskProgress(indexing_task_id_, indexing_task_progress_,
indexing_task_max_);
}
const pb::tagreader::ReadCloudFileResponse& message =

View File

@ -1,7 +1,26 @@
#ifndef CLOUDFILESERVICE_H
#define CLOUDFILESERVICE_H
/* This file is part of Clementine.
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>
@ -19,6 +38,7 @@ class PlaylistManager;
class CloudFileService : public InternetService {
Q_OBJECT
public:
CloudFileService(Application* app, InternetModel* parent,
const QString& service_name, const QString& service_id,
@ -76,4 +96,4 @@ class CloudFileService : public InternetService {
int indexing_task_max_;
};
#endif // CLOUDFILESERVICE_H
#endif // INTERNET_CORE_CLOUDFILESERVICE_H_

View File

@ -1,5 +1,7 @@
/* 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
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.
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
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/>.
*/
#ifndef GEOLOCATOR_H
#define GEOLOCATOR_H
#ifndef INTERNET_CORE_GEOLOCATOR_H_
#define INTERNET_CORE_GEOLOCATOR_H_
#include <QObject>
@ -24,6 +26,7 @@
class Geolocator : public QObject {
Q_OBJECT
public:
explicit Geolocator(QObject* parent = nullptr);
@ -47,7 +50,7 @@ class Geolocator : public QObject {
int lng_e6_;
};
signals:
signals:
void Finished(Geolocator::LatLng latlng);
private slots:
@ -62,4 +65,4 @@ signals:
QDebug operator<<(QDebug dbg, const Geolocator::LatLng& ll);
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.
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
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/>.
*/
#ifndef INTERNETMIMEDATA_H
#define INTERNETMIMEDATA_H
#ifndef INTERNET_CORE_INTERNETMIMEDATA_H_
#define INTERNET_CORE_INTERNETMIMEDATA_H_
#include "core/mimedata.h"
@ -29,10 +32,10 @@ class InternetMimeData : public MimeData {
Q_OBJECT
public:
InternetMimeData(const InternetModel* _model) : model(_model) {}
explicit InternetMimeData(const InternetModel* _model) : model(_model) {}
const InternetModel* model;
QModelIndexList indexes;
};
#endif // INTERNETMIMEDATA_H
#endif // INTERNET_CORE_INTERNETMIMEDATA_H_

View File

@ -1,5 +1,13 @@
/* 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
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/>.
*/
#include "internetmodel.h"
#include "internet/core/internetmodel.h"
#include <QMimeData>
#include <QtDebug>
#include "digitallyimportedservicebase.h"
#include "groovesharkservice.h"
#include "icecastservice.h"
#include "internetmimedata.h"
#include "internetservice.h"
#include "jamendoservice.h"
#include "magnatuneservice.h"
#include "savedradio.h"
#include "somafmservice.h"
#include "soundcloudservice.h"
#include "spotifyservice.h"
#include "subsonicservice.h"
#include "internet/digitally/digitallyimportedservicebase.h"
#include "internet/grooveshark/groovesharkservice.h"
#include "internet/icecast/icecastservice.h"
#include "internet/core/internetmimedata.h"
#include "internet/core/internetservice.h"
#include "internet/jamendo/jamendoservice.h"
#include "internet/magnatune/magnatuneservice.h"
#include "internet/internetradio/savedradio.h"
#include "internet/somafm/somafmservice.h"
#include "internet/soundcloud/soundcloudservice.h"
#include "internet/spotify/spotifyservice.h"
#include "internet/subsonic/subsonicservice.h"
#include "core/closure.h"
#include "core/logging.h"
#include "core/mergedproxymodel.h"
#include "podcasts/podcastservice.h"
#include "internet/podcasts/podcastservice.h"
#include "smartplaylists/generatormimedata.h"
#ifdef HAVE_GOOGLE_DRIVE
#include "googledriveservice.h"
#include "internet/googledrive/googledriveservice.h"
#endif
#ifdef HAVE_DROPBOX
#include "dropboxservice.h"
#include "internet/dropbox/dropboxservice.h"
#endif
#ifdef HAVE_SKYDRIVE
#include "skydriveservice.h"
#include "internet/skydrive/skydriveservice.h"
#endif
#ifdef HAVE_BOX
#include "boxservice.h"
#include "internet/box/boxservice.h"
#endif
#ifdef HAVE_VK
#include "vkservice.h"
#include "internet/vk/vkservice.h"
#endif
#ifdef HAVE_SEAFILE
#include "seafileservice.h"
#include "internet/seafile/seafileservice.h"
#endif
using smart_playlists::Generator;

View File

@ -1,5 +1,10 @@
/* 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
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/>.
*/
#ifndef INTERNETMODEL_H
#define INTERNETMODEL_H
#ifndef INTERNET_CORE_INTERNETMODEL_H_
#define INTERNET_CORE_INTERNETMODEL_H_
#include "core/song.h"
#include "library/librarymodel.h"
@ -42,7 +47,7 @@ class InternetModel : public QStandardItemModel {
Q_OBJECT
public:
InternetModel(Application* app, QObject* parent = nullptr);
explicit InternetModel(Application* app, QObject* parent = nullptr);
enum Role {
// Services can use this role to distinguish between different types of
@ -169,7 +174,7 @@ class InternetModel : public QStandardItemModel {
return shown_services_;
}
signals:
signals:
void StreamError(const QString& message);
void StreamMetadataFound(const QUrl& original_url, const Song& song);
@ -193,4 +198,4 @@ signals:
QModelIndex current_index_;
};
#endif // INTERNETMODEL_H
#endif // INTERNET_CORE_INTERNETMODEL_H_

View File

@ -1,5 +1,9 @@
/* 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
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/>.
*/
#include "internetplaylistitem.h"
#include "internetservice.h"
#include "internetmodel.h"
#include "core/settingsprovider.h"
#include "library/sqlrow.h"
#include "playlist/playlistbackend.h"
#include "internet/core/internetplaylistitem.h"
#include <QSettings>
#include <QApplication>
#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)
: PlaylistItem(type), set_service_icon_(false) {}

View File

@ -1,5 +1,9 @@
/* 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
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/>.
*/
#ifndef INTERNETPLAYLISTITEM_H
#define INTERNETPLAYLISTITEM_H
#ifndef INTERNET_CORE_INTERNETPLAYLISTITEM_H_
#define INTERNET_CORE_INTERNETPLAYLISTITEM_H_
#include "core/song.h"
#include "playlist/playlistitem.h"
@ -27,7 +31,7 @@ class InternetService;
class InternetPlaylistItem : public PlaylistItem {
public:
InternetPlaylistItem(const QString& type);
explicit InternetPlaylistItem(const QString& type);
InternetPlaylistItem(InternetService* service, const Song& metadata);
Options options() const;
@ -55,4 +59,4 @@ class InternetPlaylistItem : public PlaylistItem {
Song metadata_;
};
#endif // INTERNETPLAYLISTITEM_H
#endif // INTERNET_CORE_INTERNETPLAYLISTITEM_H_

View File

@ -1,5 +1,10 @@
/* 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
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/>.
*/
#include "internetservice.h"
#include "internetmodel.h"
#include "internet/core/internetservice.h"
#include <QMenu>
#include <QStandardItem>
#include "internet/core/internetmodel.h"
#include "core/logging.h"
#include "core/mergedproxymodel.h"
#include "core/mimedata.h"
#include "ui/iconloader.h"
#include <QMenu>
#include <QStandardItem>
InternetService::InternetService(const QString& name, Application* app,
InternetModel* model, QObject* parent)
: QObject(parent),

View File

@ -1,5 +1,10 @@
/* 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
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/>.
*/
#ifndef INTERNETSERVICE_H
#define INTERNETSERVICE_H
#ifndef INTERNET_CORE_INTERNETSERVICE_H_
#define INTERNET_CORE_INTERNETSERVICE_H_
#include <QObject>
#include <QList>
@ -74,7 +79,7 @@ class InternetService : public QObject {
virtual QString Icon() { return QString(); }
signals:
signals:
void StreamError(const QString& message);
void StreamMetadataFound(const QUrl& original_url, const Song& song);
@ -134,4 +139,4 @@ signals:
Q_DECLARE_METATYPE(InternetService*);
#endif // INTERNETSERVICE_H
#endif // INTERNET_CORE_INTERNETSERVICE_H_

View File

@ -1,5 +1,6 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -19,8 +20,8 @@
#include "core/application.h"
#include "ui/settingsdialog.h"
#include "internetservice.h"
#include "internetmodel.h"
#include "internet/core/internetservice.h"
#include "internet/core/internetmodel.h"
#include <QSettings>

View File

@ -1,5 +1,6 @@
/* 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
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/>.
*/
#ifndef INTERNETSHOWSETTINGSPAGE_H
#define INTERNETSHOWSETTINGSPAGE_H
#ifndef INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_
#define INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_
#include "ui/settingspage.h"
#include "ui_internetshowsettingspage.h"
@ -30,7 +31,7 @@ class InternetShowSettingsPage : public SettingsPage {
Q_OBJECT
public:
InternetShowSettingsPage(SettingsDialog* dialog);
explicit InternetShowSettingsPage(SettingsDialog* dialog);
void Load();
void Save();
@ -39,4 +40,4 @@ class InternetShowSettingsPage : public SettingsPage {
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.
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
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/>.
*/
#ifndef INTERNETSONGMIMEDATA_H
#define INTERNETSONGMIMEDATA_H
#ifndef INTERNET_CORE_INTERNETSONGMIMEDATA_H_
#define INTERNET_CORE_INTERNETSONGMIMEDATA_H_
#include "core/mimedata.h"
#include "core/song.h"
@ -27,10 +29,10 @@ class InternetSongMimeData : public MimeData {
Q_OBJECT
public:
InternetSongMimeData(InternetService* _service) : service(_service) {}
explicit InternetSongMimeData(InternetService* _service) : service(_service) {}
InternetService* service;
SongList songs;
};
#endif // INTERNETSONGMIMEDATA_H
#endif // INTERNET_CORE_INTERNETSONGMIMEDATA_H_

View File

@ -1,5 +1,9 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -16,12 +20,13 @@
*/
#include "internetview.h"
#include "internetmodel.h"
#include "core/mergedproxymodel.h"
#include "library/libraryview.h"
#include <QContextMenuEvent>
#include "internet/core/internetmodel.h"
#include "core/mergedproxymodel.h"
#include "library/libraryview.h"
InternetView::InternetView(QWidget* parent) : AutoExpandingTreeView(parent) {
setItemDelegate(new LibraryItemDelegate(this));
SetExpandOnReset(false);

View File

@ -1,5 +1,8 @@
/* 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
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/>.
*/
#ifndef INTERNETVIEW_H
#define INTERNETVIEW_H
#ifndef INTERNET_CORE_INTERNETVIEW_H_
#define INTERNET_CORE_INTERNETVIEW_H_
#include "widgets/autoexpandingtreeview.h"
@ -24,7 +27,7 @@ class InternetView : public AutoExpandingTreeView {
Q_OBJECT
public:
InternetView(QWidget* parent = nullptr);
explicit InternetView(QWidget* parent = nullptr);
// QWidget
void contextMenuEvent(QContextMenuEvent* e);
@ -33,8 +36,8 @@ class InternetView : public AutoExpandingTreeView {
void currentChanged(const QModelIndex& current, const QModelIndex& previous);
void setModel(QAbstractItemModel* model);
signals:
signals:
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.
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
it under the terms of the GNU General Public License as published by
@ -16,17 +19,18 @@
*/
#include "internetviewcontainer.h"
#include "internetmodel.h"
#include "internetservice.h"
#include "ui_internetviewcontainer.h"
#include "core/application.h"
#include "core/mergedproxymodel.h"
#include "globalsearch/globalsearch.h"
#include <QMetaMethod>
#include <QTimeLine>
#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;
InternetViewContainer::InternetViewContainer(QWidget* parent)

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef INTERNETVIEWCONTAINER_H
#define INTERNETVIEWCONTAINER_H
#ifndef INTERNET_CORE_INTERNETVIEWCONTAINER_H_
#define INTERNET_CORE_INTERNETVIEWCONTAINER_H_
#include <QWidget>
#include <QMap>
@ -34,7 +36,7 @@ class InternetViewContainer : public QWidget {
Q_OBJECT
public:
InternetViewContainer(QWidget* parent = nullptr);
explicit InternetViewContainer(QWidget* parent = nullptr);
~InternetViewContainer();
static const int kAnimationDuration;
@ -72,4 +74,4 @@ class InternetViewContainer : public QWidget {
QMap<QWidget*, HeaderData> headers_;
};
#endif // INTERNETVIEWCONTAINER_H
#endif // INTERNET_CORE_INTERNETVIEWCONTAINER_H_

View File

@ -69,7 +69,7 @@
<customwidget>
<class>InternetView</class>
<extends>QTreeView</extends>
<header>internet/internetview.h</header>
<header>internet/core/internetview.h</header>
</customwidget>
</customwidgets>
<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 <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 <QStringList>
@ -8,9 +28,10 @@
#include "core/closure.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,
const QString& client_secret,
@ -73,8 +94,7 @@ void OAuthenticator::RequestAccessToken(const QByteArray& code,
const QUrl& url) {
typedef QPair<QString, QString> Param;
QList<Param> parameters;
parameters << Param("code", code)
<< Param("client_id", client_id_)
parameters << Param("code", code) << Param("client_id", client_id_)
<< Param("client_secret", client_secret_)
<< Param("grant_type", "authorization_code")
// Even though we don't use this URI anymore, it must match the

View File

@ -1,5 +1,25 @@
#ifndef OAUTHENTICATOR_H
#define OAUTHENTICATOR_H
/* This file is part of Clementine.
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 <QObject>
@ -11,6 +31,7 @@ class QTcpSocket;
class OAuthenticator : public QObject {
Q_OBJECT
public:
enum class RedirectStyle {
// Redirect to localhost immediately.
@ -40,7 +61,7 @@ class OAuthenticator : public QObject {
const QDateTime& expiry_time() const { return expiry_time_; }
signals:
signals:
void Finished();
private slots:
@ -67,4 +88,4 @@ signals:
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.
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
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/>.
*/
#include "internetservice.h"
#include "searchboxwidget.h"
#include "internet/core/searchboxwidget.h"
#include "ui_searchboxwidget.h"
#include "ui/iconloader.h"
#include "widgets/didyoumean.h"
#include <QKeyEvent>
#include <QMenu>
#include "internet/core/internetservice.h"
#include "ui/iconloader.h"
#include "widgets/didyoumean.h"
SearchBoxWidget::SearchBoxWidget(InternetService* service)
: service_(service),
ui_(new Ui_SearchBoxWidget),
@ -58,9 +62,8 @@ void SearchBoxWidget::FocusOnFilter(QKeyEvent* event) {
QApplication::sendEvent(ui_->filter, event);
}
void SearchBoxWidget::SetText(const QString &text)
{
ui_->filter->setText(text);
void SearchBoxWidget::SetText(const QString& text) {
ui_->filter->setText(text);
}
void SearchBoxWidget::keyReleaseEvent(QKeyEvent* e) {

View File

@ -1,5 +1,8 @@
/* 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
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/>.
*/
#ifndef SEARCHBOXWIDGET_H
#define SEARCHBOXWIDGET_H
#ifndef INTERNET_CORE_SEARCHBOXWIDGET_H_
#define INTERNET_CORE_SEARCHBOXWIDGET_H_
#include <QWidget>
@ -31,12 +34,12 @@ class SearchBoxWidget : public QWidget {
Q_OBJECT
public:
SearchBoxWidget(InternetService* service);
explicit SearchBoxWidget(InternetService* service);
~SearchBoxWidget();
DidYouMean* did_you_mean() { return did_you_mean_; }
signals:
signals:
void TextChanged(const QString& text);
public slots:
@ -53,4 +56,4 @@ signals:
DidYouMean* did_you_mean_;
};
#endif // SEARCHBOXWIDGET_H
#endif // INTERNET_CORE_SEARCHBOXWIDGET_H_

View File

@ -1,5 +1,7 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -16,14 +18,15 @@
*/
#include "digitallyimportedclient.h"
#include "core/logging.h"
#include "core/network.h"
#include <qjson/parser.h>
#include <QNetworkReply>
#include <QNetworkRequest>
#include "core/logging.h"
#include "core/network.h"
// The API used here is undocumented - it was reverse engineered by watching
// calls made by the sky.fm android app:
// https://market.android.com/details?id=com.audioaddict.sky
@ -44,13 +47,13 @@ DigitallyImportedClient::DigitallyImportedClient(const QString& service_name,
network_(new NetworkAccessManager(this)),
service_name_(service_name) {}
void DigitallyImportedClient::SetAuthorisationHeader(QNetworkRequest* req)
const {
req->setRawHeader("Authorization",
"Basic " + QString("%1:%2")
.arg(kApiUsername, kApiPassword)
.toAscii()
.toBase64());
void DigitallyImportedClient::SetAuthorisationHeader(
QNetworkRequest* req) const {
req->setRawHeader("Authorization", "Basic " +
QString("%1:%2")
.arg(kApiUsername, kApiPassword)
.toAscii()
.toBase64());
}
QNetworkReply* DigitallyImportedClient::Auth(const QString& username,

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
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
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/>.
*/
#ifndef DIGITALLYIMPORTEDCLIENT_H
#define DIGITALLYIMPORTEDCLIENT_H
#ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDCLIENT_H_
#define INTERNET_DIGITALLY_DIGITALLYIMPORTEDCLIENT_H_
#include <QDateTime>
#include <QObject>
@ -31,7 +33,7 @@ class DigitallyImportedClient : public QObject {
Q_OBJECT
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* kApiPassword;
@ -84,4 +86,4 @@ QDataStream& operator>>(QDataStream& in,
DigitallyImportedClient::Channel& 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.
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
it under the terms of the GNU General Public License as published by
@ -24,7 +27,7 @@
#include "digitallyimportedclient.h"
#include "digitallyimportedurlhandler.h"
#include "internetmodel.h"
#include "internet/core/internetmodel.h"
#include "core/application.h"
#include "core/closure.h"
#include "core/logging.h"
@ -249,16 +252,14 @@ SkyFmService::SkyFmService(Application* app, InternetModel* model,
JazzRadioService::JazzRadioService(Application* app, InternetModel* model,
QObject* parent)
: DigitallyImportedServiceBase(
"JazzRadio", "JAZZRADIO.com", QUrl("http://www.jazzradio.com"),
QIcon(":/providers/jazzradio.png"), "jazzradio", app, model, true,
parent) {
}
: DigitallyImportedServiceBase("JazzRadio", "JAZZRADIO.com",
QUrl("http://www.jazzradio.com"),
QIcon(":/providers/jazzradio.png"),
"jazzradio", app, model, true, parent) {}
RockRadioService::RockRadioService(Application* app, InternetModel* model,
QObject* parent)
: DigitallyImportedServiceBase(
"RockRadio", "ROCKRADIO.com", QUrl("http://www.rockradio.com"),
QIcon(":/providers/rockradio.png"), "rockradio", app, model, false,
parent) {
}
: DigitallyImportedServiceBase("RockRadio", "ROCKRADIO.com",
QUrl("http://www.rockradio.com"),
QIcon(":/providers/rockradio.png"),
"rockradio", app, model, false, parent) {}

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef DIGITALLYIMPORTEDSERVICEBASE_H
#define DIGITALLYIMPORTEDSERVICEBASE_H
#ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDSERVICEBASE_H_
#define INTERNET_DIGITALLY_DIGITALLYIMPORTEDSERVICEBASE_H_
#include <memory>
#include "digitallyimportedclient.h"
#include "internetservice.h"
#include "internet/core/internetservice.h"
#include "core/cachedlist.h"
class DigitallyImportedClient;
@ -38,8 +40,7 @@ class DigitallyImportedServiceBase : public InternetService {
const QUrl& homepage_url, const QIcon& icon,
const QString& api_service_name,
Application* app, InternetModel* model,
bool has_premium,
QObject* parent = nullptr);
bool has_premium, QObject* parent = nullptr);
~DigitallyImportedServiceBase();
static const char* kSettingsGroup;
@ -66,7 +67,7 @@ class DigitallyImportedServiceBase : public InternetService {
public slots:
void ShowSettingsDialog();
signals:
signals:
void StreamsChanged();
private slots:
@ -98,7 +99,7 @@ signals:
int premium_audio_type_;
QString username_;
QString listen_hash_;
bool has_premium_; // Does the service has premium features?
bool has_premium_; // Does the service has premium features?
QStandardItem* root_;
@ -118,7 +119,8 @@ class DigitallyImportedService : public DigitallyImportedServiceBase {
class SkyFmService : public DigitallyImportedServiceBase {
public:
SkyFmService(Application* app, InternetModel* model, QObject* parent = nullptr);
SkyFmService(Application* app, InternetModel* model,
QObject* parent = nullptr);
};
class JazzRadioService : public DigitallyImportedServiceBase {
@ -133,4 +135,4 @@ class RockRadioService : public DigitallyImportedServiceBase {
QObject* parent = nullptr);
};
#endif // DIGITALLYIMPORTEDSERVICEBASE_H
#endif // INTERNET_DIGITALLY_DIGITALLYIMPORTEDSERVICEBASE_H_

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#include "digitallyimportedclient.h"
#include "digitallyimportedservicebase.h"
#include "digitallyimportedsettingspage.h"
#include "ui_digitallyimportedsettingspage.h"
#include "core/closure.h"
#include <QMessageBox>
#include <QNetworkReply>
#include <QSettings>
#include "digitallyimportedclient.h"
#include "digitallyimportedservicebase.h"
#include "core/closure.h"
DigitallyImportedSettingsPage::DigitallyImportedSettingsPage(
SettingsDialog* dialog)
: SettingsPage(dialog),

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef DIGITALLYIMPORTEDSETTINGSPAGE_H
#define DIGITALLYIMPORTEDSETTINGSPAGE_H
#ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDSETTINGSPAGE_H_
#define INTERNET_DIGITALLY_DIGITALLYIMPORTEDSETTINGSPAGE_H_
#include "ui/settingspage.h"
@ -29,7 +31,7 @@ class DigitallyImportedSettingsPage : public SettingsPage {
Q_OBJECT
public:
DigitallyImportedSettingsPage(SettingsDialog* dialog);
explicit DigitallyImportedSettingsPage(SettingsDialog* dialog);
~DigitallyImportedSettingsPage();
void Load();
@ -51,4 +53,4 @@ class DigitallyImportedSettingsPage : public SettingsPage {
DigitallyImportedClient* client_;
};
#endif // DIGITALLYIMPORTEDSETTINGSPAGE_H
#endif // INTERNET_DIGITALLY_DIGITALLYIMPORTEDSETTINGSPAGE_H_

View File

@ -1,5 +1,8 @@
/* 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
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/>.
*/
#include "digitallyimportedservicebase.h"
#include "digitallyimportedurlhandler.h"
#include "internetmodel.h"
#include "digitallyimportedservicebase.h"
#include "internet/core/internetmodel.h"
#include "core/application.h"
#include "core/logging.h"
#include "core/taskmanager.h"

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef DIGITALLYIMPORTEDURLHANDLER_H
#define DIGITALLYIMPORTEDURLHANDLER_H
#ifndef INTERNET_DIGITALLY_DIGITALLYIMPORTEDURLHANDLER_H_
#define INTERNET_DIGITALLY_DIGITALLYIMPORTEDURLHANDLER_H_
#include "core/urlhandler.h"
@ -43,4 +45,4 @@ class DigitallyImportedUrlHandler : public UrlHandler {
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 <time.h>
@ -11,7 +29,7 @@
#include "core/closure.h"
#include "core/logging.h"
#include "core/network.h"
#include "internet/localredirectserver.h"
#include "internet/core/localredirectserver.h"
namespace {
static const char* kAppKey = "qh6ca27eclt9p2k";
@ -61,7 +79,7 @@ QMap<QString, QString> ParseParamList(const QString& params) {
}
return ret;
}
}
} // namespace
void DropboxAuthenticator::RequestTokenFinished(QNetworkReply* reply) {
reply->deleteLater();

View File

@ -1,5 +1,23 @@
#ifndef DROPBOXAUTHENTICATOR_H
#define DROPBOXAUTHENTICATOR_H
/* 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/>.
*/
#ifndef INTERNET_DROPBOX_DROPBOXAUTHENTICATOR_H_
#define INTERNET_DROPBOX_DROPBOXAUTHENTICATOR_H_
#include <QObject>
#include <QTcpServer>
@ -10,6 +28,7 @@ class QNetworkReply;
class DropboxAuthenticator : public QObject {
Q_OBJECT
public:
explicit DropboxAuthenticator(QObject* parent = nullptr);
void StartAuthorisation();
@ -22,7 +41,7 @@ class DropboxAuthenticator : public QObject {
static QByteArray GenerateAuthorisationHeader(const QString& token,
const QString& secret);
signals:
signals:
void Finished();
private slots:
@ -54,4 +73,4 @@ signals:
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 <QFileInfo>
@ -11,8 +30,8 @@
#include "core/player.h"
#include "core/utilities.h"
#include "core/waitforsignal.h"
#include "internet/dropboxauthenticator.h"
#include "internet/dropboxurlhandler.h"
#include "internet/dropbox/dropboxauthenticator.h"
#include "internet/dropbox/dropboxurlhandler.h"
#include "library/librarybackend.h"
using Utilities::ParseRFC822DateTime;

View File

@ -1,7 +1,25 @@
#ifndef DROPBOXSERVICE_H
#define DROPBOXSERVICE_H
/* This file is part of Clementine.
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"
@ -11,6 +29,7 @@ class QNetworkReply;
class DropboxService : public CloudFileService {
Q_OBJECT
public:
DropboxService(Application* app, InternetModel* parent);
@ -21,7 +40,7 @@ class DropboxService : public CloudFileService {
QUrl GetStreamingUrlFromSongId(const QUrl& url);
signals:
signals:
void Connected();
public slots:
@ -46,4 +65,4 @@ signals:
NetworkAccessManager* network_;
};
#endif // DROPBOXSERVICE_H
#endif // INTERNET_DROPBOX_DROPBOXSERVICE_H_

View File

@ -1,5 +1,6 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -19,9 +20,9 @@
#include "ui_dropboxsettingspage.h"
#include "core/application.h"
#include "internet/dropboxauthenticator.h"
#include "internet/dropboxservice.h"
#include "internet/internetmodel.h"
#include "internet/dropbox/dropboxauthenticator.h"
#include "internet/dropbox/dropboxservice.h"
#include "internet/core/internetmodel.h"
#include "ui/settingsdialog.h"
DropboxSettingsPage::DropboxSettingsPage(SettingsDialog* parent)

View File

@ -1,5 +1,6 @@
/* 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
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/>.
*/
#ifndef DROPBOXSETTINGSPAGE_H
#define DROPBOXSETTINGSPAGE_H
#ifndef INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_
#define INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_
#include "ui/settingspage.h"
@ -31,7 +32,7 @@ class DropboxSettingsPage : public SettingsPage {
Q_OBJECT
public:
DropboxSettingsPage(SettingsDialog* parent = nullptr);
explicit DropboxSettingsPage(SettingsDialog* parent = nullptr);
~DropboxSettingsPage();
void Load();
@ -51,4 +52,4 @@ class DropboxSettingsPage : public SettingsPage {
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.
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
it under the terms of the GNU General Public License as published by
@ -19,7 +21,7 @@
#include <qjson/parser.h>
#include "oauthenticator.h"
#include "internet/core/oauthenticator.h"
#include "core/closure.h"
#include "core/logging.h"
#include "core/network.h"
@ -44,7 +46,7 @@ static const char* kOAuthScope =
"https://www.googleapis.com/auth/userinfo.email";
static const char* kClientId = "679260893280.apps.googleusercontent.com";
static const char* kClientSecret = "l3cWb8efUZsrBI4wmY3uKl6i";
}
} // namespace
QStringList File::parent_ids() const {
QStringList ret;
@ -201,7 +203,7 @@ void Client::ListChangesFinished(ListChangesResponse* response,
QJson::Parser parser;
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();
if (!ok) {
qLog(Error) << "Failed to fetch changes" << response->cursor();

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef GOOGLEDRIVECLIENT_H
#define GOOGLEDRIVECLIENT_H
#ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVECLIENT_H_
#define INTERNET_GOOGLEDRIVE_GOOGLEDRIVECLIENT_H_
#include <QDateTime>
#include <QList>
@ -37,7 +39,7 @@ class Client;
// Holds the metadata for a file on Google Drive.
class File {
public:
File(const QVariantMap& data = QVariantMap()) : data_(data) {}
explicit File(const QVariantMap& data = QVariantMap()) : data_(data) {}
static const char* kFolderMimeType;
@ -46,7 +48,7 @@ class File {
QString title() const { return data_["title"].toString(); }
QString mime_type() const { return data_["mimeType"].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 alternate_link() const { return data_["alternateLink"].toUrl(); }
@ -85,11 +87,11 @@ class ConnectResponse : public QObject {
const QString& refresh_token() const { return refresh_token_; }
const QString& user_email() const { return user_email_; }
signals:
signals:
void Finished();
private:
ConnectResponse(QObject* parent);
explicit ConnectResponse(QObject* parent);
QString refresh_token_;
QString user_email_;
};
@ -102,7 +104,7 @@ class GetFileResponse : public QObject {
const QString& file_id() const { return file_id_; }
const File& file() const { return file_; }
signals:
signals:
void Finished();
private:
@ -119,7 +121,7 @@ class ListChangesResponse : public QObject {
const QString& cursor() const { return cursor_; }
const QString& next_cursor() const { return next_cursor_; }
signals:
signals:
void FilesFound(const QList<google_drive::File>& files);
void FilesDeleted(const QList<QUrl>& files);
void Finished();
@ -134,7 +136,7 @@ class Client : public QObject {
Q_OBJECT
public:
Client(QObject* parent = nullptr);
explicit Client(QObject* parent = nullptr);
bool is_authenticated() const;
const QString& access_token() const { return access_token_; }
@ -145,7 +147,7 @@ class Client : public QObject {
GetFileResponse* GetFile(const QString& file_id);
ListChangesResponse* ListChanges(const QString& cursor);
signals:
signals:
void Authenticated();
private slots:
@ -166,6 +168,6 @@ signals:
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 <QDesktopServices>
@ -23,7 +42,7 @@
#include "ui/iconloader.h"
#include "googledriveclient.h"
#include "googledriveurlhandler.h"
#include "internetmodel.h"
#include "internet/core/internetmodel.h"
const char* GoogleDriveService::kServiceName = "Google Drive";
const char* GoogleDriveService::kSettingsGroup = "GoogleDrive";
@ -92,9 +111,8 @@ void GoogleDriveService::ListChangesFinished(
if (is_indexing()) {
// Only save the cursor after all the songs have been indexed - that way if
// Clementine is closed it'll resume next time.
NewClosure(this, SIGNAL(AllIndexingTasksFinished()),
this, SLOT(SaveCursor(QString)),
cursor);
NewClosure(this, SIGNAL(AllIndexingTasksFinished()), this,
SLOT(SaveCursor(QString)), cursor);
} else {
SaveCursor(cursor);
}
@ -198,12 +216,12 @@ void GoogleDriveService::ShowContextMenu(const QPoint& global_pos) {
QIcon(":/providers/googledrive.png"), tr("Open in Google Drive"), this,
SLOT(OpenWithDrive()));
context_menu_->addSeparator();
update_action_ = context_menu_->addAction(
IconLoader::Load("view-refresh"), tr("Check for updates"),
this, SLOT(CheckForUpdates()));
update_action_ = context_menu_->addAction(IconLoader::Load("view-refresh"),
tr("Check for updates"), this,
SLOT(CheckForUpdates()));
full_rescan_action_ = context_menu_->addAction(
IconLoader::Load("view-refresh"), tr("Do a full rescan..."),
this, SLOT(ConfirmFullRescan()));
IconLoader::Load("view-refresh"), tr("Do a full rescan..."), this,
SLOT(ConfirmFullRescan()));
context_menu_->addSeparator();
context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"),
this, SLOT(ShowCoverManager()));
@ -246,15 +264,14 @@ void GoogleDriveService::OpenWithDrive() {
void GoogleDriveService::ConfirmFullRescan() {
QMessageBox* message_box = new QMessageBox(
QMessageBox::Warning,
tr("Do a full rescan"),
QMessageBox::Warning, tr("Do a full rescan"),
tr("Doing a full rescan will lose any metadata you've saved in "
"Clementine such as cover art, play counts and ratings. Clementine "
"will rescan all your music in Google Drive which may take some "
"time."),
QMessageBox::NoButton);
QPushButton* button = message_box->addButton(
tr("Do a full rescan"), QMessageBox::DestructiveRole);
QPushButton* button = message_box->addButton(tr("Do a full rescan"),
QMessageBox::DestructiveRole);
connect(button, SIGNAL(clicked()), SLOT(DoFullRescan()));
message_box->addButton(QMessageBox::Cancel);

View File

@ -1,7 +1,26 @@
#ifndef GOOGLEDRIVESERVICE_H
#define GOOGLEDRIVESERVICE_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, 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 {
class Client;
@ -13,6 +32,7 @@ class ListChangesResponse;
class GoogleDriveService : public CloudFileService {
Q_OBJECT
public:
GoogleDriveService(Application* app, InternetModel* parent);
@ -31,7 +51,7 @@ class GoogleDriveService : public CloudFileService {
void Connect();
void ForgetCredentials();
signals:
signals:
void Connected();
private slots:
@ -58,4 +78,4 @@ signals:
QAction* full_rescan_action_;
};
#endif
#endif // INTERNET_GOOGLEDRIVE_GOOGLEDRIVESERVICE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
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
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/>.
*/
#include "googledriveclient.h"
#include "googledriveservice.h"
#include "googledrivesettingspage.h"
#include "ui_googledrivesettingspage.h"
#include "core/application.h"
#include "internet/internetmodel.h"
#include "ui/settingsdialog.h"
#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)
: SettingsPage(parent),
ui_(new Ui::GoogleDriveSettingsPage),

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef GOOGLEDRIVESETTINGSPAGE_H
#define GOOGLEDRIVESETTINGSPAGE_H
#ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_
#define INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_
#include "ui/settingspage.h"
@ -30,7 +32,7 @@ class GoogleDriveSettingsPage : public SettingsPage {
Q_OBJECT
public:
GoogleDriveSettingsPage(SettingsDialog* parent = nullptr);
explicit GoogleDriveSettingsPage(SettingsDialog* parent = nullptr);
~GoogleDriveSettingsPage();
void Load();
@ -50,4 +52,4 @@ class GoogleDriveSettingsPage : public SettingsPage {
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.
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
it under the terms of the GNU General Public License as published by
@ -19,7 +21,7 @@
#include "groovesharkservice.h"
#include "core/logging.h"
#include "internet/internetplaylistitem.h"
#include "internet/core/internetplaylistitem.h"
GroovesharkRadio::GroovesharkRadio(GroovesharkService* service)
: service_(service), tag_id_(0), use_tag_(false), first_time_(true) {}

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef GROOVESHARKRADIO_H
#define GROOVESHARKRADIO_H
#ifndef INTERNET_GROOVESHARK_GROOVESHARKRADIO_H_
#define INTERNET_GROOVESHARK_GROOVESHARKRADIO_H_
#include "smartplaylists/generator.h"
class GroovesharkService;
class GroovesharkRadio : public smart_playlists::Generator {
public:
// Start Grooveshark radio for a particular type of music
GroovesharkRadio(GroovesharkService* service, int tag_id);
// Start Grooveshark radio based on last artists and songs you listen to
GroovesharkRadio(GroovesharkService* service);
explicit GroovesharkRadio(GroovesharkService* service);
QString type() const { return "Grooveshark"; }
void Load(const QByteArray& data);
@ -48,4 +49,4 @@ class GroovesharkRadio : public smart_playlists::Generator {
QVariantMap autoplay_state_;
};
#endif // GROOVESHARKRADIO_H
#endif // INTERNET_GROOVESHARK_GROOVESHARKRADIO_H_

View File

@ -1,5 +1,10 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -36,10 +41,10 @@
#include "qtiocompressor.h"
#include "internetmodel.h"
#include "internet/core/internetmodel.h"
#include "groovesharkradio.h"
#include "groovesharkurlhandler.h"
#include "searchboxwidget.h"
#include "internet/core/searchboxwidget.h"
#include "core/application.h"
#include "core/closure.h"
@ -118,7 +123,6 @@ GroovesharkService::GroovesharkService(Application* app, InternetModel* parent)
task_popular_id_(0),
task_playlists_id_(0),
task_search_id_(0) {
app_->player()->RegisterUrlHandler(url_handler_);
search_delay_->setInterval(kSearchDelayMsec);
@ -442,7 +446,8 @@ void GroovesharkService::RemoveItems() {
playlists_.clear();
subscribed_playlists_parent_ = nullptr;
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.
pending_retrieve_playlists_.clear();
app_->task_manager()->SetTaskFinished(task_playlists_id_);
@ -719,7 +724,8 @@ void GroovesharkService::UserPlaylistsRetrieved(QNetworkReply* reply) {
}
void GroovesharkService::PlaylistSongsRetrieved(QNetworkReply* reply,
int playlist_id, int request_id) {
int playlist_id,
int request_id) {
reply->deleteLater();
if (!pending_retrieve_playlists_.remove(request_id)) {
@ -1273,9 +1279,9 @@ void GroovesharkService::RefreshPlaylist(int playlist_id) {
parameters << Param("playlistID", playlist_id);
QNetworkReply* reply = CreateRequest("getPlaylistSongs", parameters);
int id = next_pending_playlist_retrieve_id_++;
NewClosure(reply, SIGNAL(finished()),
this, SLOT(PlaylistSongsRetrieved(QNetworkReply*, int, int)),
reply, playlist_id, id);
NewClosure(reply, SIGNAL(finished()), this,
SLOT(PlaylistSongsRetrieved(QNetworkReply*, int, int)), reply,
playlist_id, id);
pending_retrieve_playlists_.insert(id);
}
@ -1468,9 +1474,8 @@ void GroovesharkService::UserLibrarySongAdded(QNetworkReply* reply,
void GroovesharkService::RemoveCurrentFromPlaylist() {
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) {
if (index.parent().data(InternetModel::Role_Type).toInt() !=
InternetModel::Type_UserPlaylist) {
continue;
@ -1483,7 +1488,7 @@ void GroovesharkService::RemoveCurrentFromPlaylist() {
}
}
for (QMap<int, QList<int> >::const_iterator it =
for (QMap<int, QList<int>>::const_iterator it =
playlists_songs_ids.constBegin();
it != playlists_songs_ids.constEnd(); ++it) {
RemoveFromPlaylist(it.key(), it.value());
@ -1508,7 +1513,6 @@ void GroovesharkService::RemoveCurrentFromFavorites() {
const QModelIndexList& indexes(model()->selected_indexes());
QList<int> songs_ids;
for (const QModelIndex& index : indexes) {
if (index.parent().data(Role_PlaylistType).toInt() != UserFavorites) {
continue;
}
@ -1561,7 +1565,6 @@ void GroovesharkService::RemoveCurrentFromLibrary() {
QList<int> songs_ids;
for (const QModelIndex& index : indexes) {
if (index.parent().data(Role_PlaylistType).toInt() != UserLibrary) {
continue;
}
@ -1619,7 +1622,6 @@ void GroovesharkService::SongsRemovedFromLibrary(QNetworkReply* reply,
QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name,
const QList<Param>& params,
bool use_https) {
QVariantMap request_params;
request_params.insert("method", method_name);
@ -1650,9 +1652,8 @@ QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name,
url.setScheme("https");
}
url.setQueryItems(
QList<QPair<QString, QString> >()
<< QPair<QString, QString>(
"sig", Utilities::HmacMd5(api_key_, post_params).toHex()));
QList<QPair<QString, QString>>() << QPair<QString, QString>(
"sig", Utilities::HmacMd5(api_key_, post_params).toHex()));
QNetworkRequest req(url);
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();
if (song1_sort == song2_sort) {
// 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;
}
}
} // namespace
SongList GroovesharkService::ExtractSongs(const QVariantMap& result) {
QVariantList result_songs = result["songs"].toList();

View File

@ -1,5 +1,8 @@
/* 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
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/>.
*/
#ifndef GROOVESHARKSERVICE_H
#define GROOVESHARKSERVICE_H
#ifndef INTERNET_GROOVESHARK_GROOVESHARKSERVICE_H_
#define INTERNET_GROOVESHARK_GROOVESHARKSERVICE_H_
#include "internetmodel.h"
#include "internetservice.h"
#include "internet/core/internetmodel.h"
#include "internet/core/internetservice.h"
#include <QSslError>
@ -35,6 +38,7 @@ class QSortFilterProxyModel;
class GroovesharkService : public InternetService {
Q_OBJECT
public:
GroovesharkService(Application* app, InternetModel* parent);
~GroovesharkService();
@ -123,7 +127,7 @@ class GroovesharkService : public InternetService {
static const char* kServiceName;
static const char* kSettingsGroup;
signals:
signals:
void LoginFinished(bool success);
void SimpleSearchResults(int id, SongList songs);
// AlbumSearchResult emits the search id and the Grooveshark ids of the
@ -222,7 +226,7 @@ signals:
// If need_authentication is true, add session_id to params.
// Returns the reply object created
QNetworkReply* CreateRequest(const QString& method_name,
const QList<QPair<QString, QVariant> >& params,
const QList<QPair<QString, QVariant>>& params,
bool use_https = false);
// Convenient function which block until 'reply' replies, or timeout after 10
// seconds. Returns false if reply has timeouted
@ -332,4 +336,4 @@ signals:
static const char* kApiSecret;
};
#endif // GROOVESHARKSERVICE_H
#endif // INTERNET_GROOVESHARK_GROOVESHARKSERVICE_H_

View File

@ -1,5 +1,8 @@
/* 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
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/>.
*/
#include "groovesharkservice.h"
#include "groovesharksettingspage.h"
#include "internetmodel.h"
#include "core/logging.h"
#include "core/network.h"
#include "ui_groovesharksettingspage.h"
#include "ui/iconloader.h"
#include <QMessageBox>
#include <QNetworkReply>
@ -29,6 +27,12 @@
#include <QSettings>
#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)
: SettingsPage(dialog),
ui_(new Ui_GroovesharkSettingsPage),

View File

@ -1,5 +1,7 @@
/* 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
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/>.
*/
#ifndef GROOVESHARKSETTINGSPAGE_H
#define GROOVESHARKSETTINGSPAGE_H
#ifndef INTERNET_GROOVESHARK_GROOVESHARKSETTINGSPAGE_H_
#define INTERNET_GROOVESHARK_GROOVESHARKSETTINGSPAGE_H_
#include "ui/settingspage.h"
@ -28,7 +30,7 @@ class GroovesharkSettingsPage : public SettingsPage {
Q_OBJECT
public:
GroovesharkSettingsPage(SettingsDialog* dialog);
explicit GroovesharkSettingsPage(SettingsDialog* dialog);
~GroovesharkSettingsPage();
void Load();
@ -51,4 +53,4 @@ class GroovesharkSettingsPage : public SettingsPage {
QString original_password_;
};
#endif // GROOVESHARKSETTINGSPAGE_H
#endif // INTERNET_GROOVESHARK_GROOVESHARKSETTINGSPAGE_H_

View File

@ -1,5 +1,7 @@
/* 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
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