This commit is contained in:
Mark Furneaux 2014-12-21 16:24:37 -05:00
commit 4f66b6d453
354 changed files with 11033 additions and 9256 deletions

View File

@ -433,9 +433,24 @@ long MPEG::File::firstFrameOffset()
{
long position = 0;
if(ID3v2Tag())
if(ID3v2Tag()) {
position = d->ID3v2Location + ID3v2Tag()->header()->completeTagSize();
// Skip duplicate ID3v2 tags.
// Workaround for some faulty files that have duplicate ID3v2 tags.
// Combination of EAC and LAME creates such files when configured incorrectly.
long location;
while((location = findID3v2(position)) >= 0) {
seek(location);
const ID3v2::Header header(readBlock(ID3v2::Header::size()));
position = location + header.completeTagSize();
debug("MPEG::File::firstFrameOffset() - Duplicate ID3v2 tag found.");
}
}
return nextFrameOffset(position);
}
@ -467,7 +482,7 @@ void MPEG::File::read(bool readProperties, Properties::ReadStyle propertiesStyle
{
// Look for an ID3v2 tag
d->ID3v2Location = findID3v2();
d->ID3v2Location = findID3v2(0);
if(d->ID3v2Location >= 0) {
@ -510,7 +525,7 @@ void MPEG::File::read(bool readProperties, Properties::ReadStyle propertiesStyle
ID3v1Tag(true);
}
long MPEG::File::findID3v2()
long MPEG::File::findID3v2(long offset)
{
// This method is based on the contents of TagLib::File::find(), but because
// of some subtlteies -- specifically the need to look for the bit pattern of
@ -534,9 +549,9 @@ long MPEG::File::findID3v2()
long originalPosition = tell();
// Start the search at the beginning of the file.
// Start the search at the offset.
seek(0);
seek(offset);
// This loop is the crux of the find method. There are three cases that we
// want to account for:
@ -547,7 +562,7 @@ long MPEG::File::findID3v2()
// (2) The search pattern is wholly contained within the current buffer.
//
// (3) The current buffer ends with a partial match of the pattern. We will
// note this for use in the next itteration, where we will check for the rest
// note this for use in the next iteration, where we will check for the rest
// of the pattern.
for(buffer = readBlock(bufferSize()); buffer.size() > 0; buffer = readBlock(bufferSize())) {
@ -561,7 +576,7 @@ long MPEG::File::findID3v2()
const int patternOffset = (bufferSize() - previousPartialMatch);
if(buffer.containsAt(ID3v2::Header::fileIdentifier(), 0, patternOffset)) {
seek(originalPosition);
return bufferOffset - bufferSize() + previousPartialMatch;
return offset + bufferOffset - bufferSize() + previousPartialMatch;
}
}
@ -570,7 +585,7 @@ long MPEG::File::findID3v2()
long location = buffer.find(ID3v2::Header::fileIdentifier());
if(location >= 0) {
seek(originalPosition);
return bufferOffset + location;
return offset + bufferOffset + location;
}
int firstSynchByte = buffer.find(char(uchar(255)));

View File

@ -242,8 +242,8 @@ namespace TagLib {
* if there is no valid ID3v2 tag. If \a create is true it will create
* an ID3v2 tag if one does not exist and returns a valid pointer.
*
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v2 tag. Use hasID3v2Tag() to check if the file
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v2 tag. Use hasID3v2Tag() to check if the file
* on disk actually has an ID3v2 tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
@ -261,8 +261,8 @@ namespace TagLib {
* if there is no valid ID3v1 tag. If \a create is true it will create
* an ID3v1 tag if one does not exist and returns a valid pointer.
*
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v1 tag. Use hasID3v1Tag() to check if the file
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v1 tag. Use hasID3v1Tag() to check if the file
* on disk actually has an ID3v1 tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
@ -280,8 +280,8 @@ namespace TagLib {
* if there is no valid APE tag. If \a create is true it will create
* an APE tag if one does not exist and returns a valid pointer.
*
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an APE tag. Use hasAPETag() to check if the file
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an APE tag. Use hasAPETag() to check if the file
* on disk actually has an APE tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
@ -370,7 +370,7 @@ namespace TagLib {
File &operator=(const File &);
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
long findID3v2();
long findID3v2(long offset);
long findID3v1();
void findAPE();

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

@ -19,10 +19,12 @@
* Boston, MA 02110-1301, USA.
*/
#include <QMutex>
#include <cstring>
#include <cmath>
#include <QMutex>
#include <QMutexLocker>
#include "gstfastspectrum.h"
GST_DEBUG_CATEGORY_STATIC (gst_fastspectrum_debug);
@ -50,8 +52,6 @@ enum {
PROP_BANDS
};
static QMutex fftw_mutex;
#define gst_fastspectrum_parent_class parent_class
G_DEFINE_TYPE (GstFastSpectrum, gst_fastspectrum, GST_TYPE_AUDIO_FILTER);
@ -111,6 +111,8 @@ gst_fastspectrum_class_init (GstFastSpectrumClass * klass)
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (filter_class, caps);
gst_caps_unref (caps);
klass->fftw_lock = new QMutex;
}
static void
@ -127,8 +129,6 @@ gst_fastspectrum_init (GstFastSpectrum * spectrum)
static void
gst_fastspectrum_alloc_channel_data (GstFastSpectrum * spectrum)
{
fftw_mutex.lock();
guint bands = spectrum->bands;
guint nfft = 2 * bands - 2;
@ -139,31 +139,36 @@ gst_fastspectrum_alloc_channel_data (GstFastSpectrum * spectrum)
fftw_malloc(sizeof(fftw_complex) * (nfft/2+1)));
spectrum->spect_magnitude = new double[bands];
spectrum->plan = fftw_plan_dft_r2c_1d(
nfft,
spectrum->fft_input,
spectrum->fft_output,
FFTW_ESTIMATE);
spectrum->channel_data_initialised = true;
fftw_mutex.unlock();
GstFastSpectrumClass* klass = reinterpret_cast<GstFastSpectrumClass*>(
G_OBJECT_GET_CLASS(spectrum));
{
QMutexLocker l(klass->fftw_lock);
spectrum->plan = fftw_plan_dft_r2c_1d(
nfft,
spectrum->fft_input,
spectrum->fft_output,
FFTW_ESTIMATE);
}
spectrum->channel_data_initialised = true;
}
static void
gst_fastspectrum_free_channel_data (GstFastSpectrum * spectrum)
{
GstFastSpectrumClass* klass = reinterpret_cast<GstFastSpectrumClass*>(
G_OBJECT_GET_CLASS(spectrum));
if (spectrum->channel_data_initialised) {
fftw_mutex.lock();
fftw_destroy_plan(spectrum->plan);
{
QMutexLocker l(klass->fftw_lock);
fftw_destroy_plan(spectrum->plan);
}
fftw_free(spectrum->fft_input);
fftw_free(spectrum->fft_output);
delete[] spectrum->input_ring_buffer;
delete[] spectrum->spect_magnitude;
spectrum->channel_data_initialised = false;
fftw_mutex.unlock();
}
}
@ -385,12 +390,11 @@ gst_fastspectrum_run_fft (GstFastSpectrum * spectrum, guint input_pos)
guint bands = spectrum->bands;
guint nfft = 2 * bands - 2;
fftw_mutex.lock();
for (i = 0; i < nfft; i++)
spectrum->fft_input[i] =
spectrum->input_ring_buffer[(input_pos + i) % nfft];
// Should be safe to execute the same plan multiple times in parallel.
fftw_execute(spectrum->plan);
gdouble val;
@ -401,8 +405,6 @@ gst_fastspectrum_run_fft (GstFastSpectrum * spectrum, guint input_pos)
val /= nfft * nfft;
spectrum->spect_magnitude[i] += val;
}
fftw_mutex.unlock();
}
static GstFlowReturn

View File

@ -43,6 +43,8 @@ G_BEGIN_DECLS
#define GST_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_FASTSPECTRUM,GstFastSpectrumClass))
#define GST_IS_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_FASTSPECTRUM))
class QMutex;
typedef void (*GstFastSpectrumInputData)(const guint8* in, double* out,
guint len, double max_value, guint op, guint nfft);
@ -84,6 +86,9 @@ struct GstFastSpectrum {
struct GstFastSpectrumClass {
GstAudioFilterClass parent_class;
// Static lock for creating & destroying FFTW plans.
QMutex* fftw_lock;
};
GType gst_fastspectrum_get_type (void);

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,27 +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/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
@ -475,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
@ -567,24 +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/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
@ -695,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
@ -719,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
@ -830,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}
)
@ -1083,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
@ -1146,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,13 +39,14 @@
#include "networkremote/networkremotehelper.h"
#include "playlist/playlistbackend.h"
#include "playlist/playlistmanager.h"
#include "podcasts/gpoddersync.h"
#include "podcasts/podcastbackend.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
@ -73,6 +74,7 @@ Application::Application(QObject* parent)
library_(nullptr),
device_manager_(nullptr),
podcast_updater_(nullptr),
podcast_deleter_(nullptr),
podcast_downloader_(nullptr),
gpodder_sync_(nullptr),
moodbar_loader_(nullptr),
@ -107,6 +109,10 @@ Application::Application(QObject* parent)
library_ = new Library(this, this);
device_manager_ = new DeviceManager(this, this);
podcast_updater_ = new PodcastUpdater(this, this);
podcast_deleter_ = new PodcastDeleter(this, this);
MoveToNewThread(podcast_deleter_);
podcast_downloader_ = new PodcastDownloader(this, this);
gpodder_sync_ = new GPodderSync(this, this);

View File

@ -44,6 +44,7 @@ class NetworkRemote;
class NetworkRemoteHelper;
class Player;
class PlaylistBackend;
class PodcastDeleter;
class PodcastDownloader;
class PlaylistManager;
class PodcastBackend;
@ -83,6 +84,7 @@ class Application : public QObject {
Library* library() const { return library_; }
DeviceManager* device_manager() const { return device_manager_; }
PodcastUpdater* podcast_updater() const { return podcast_updater_; }
PodcastDeleter* podcast_deleter() const { return podcast_deleter_; }
PodcastDownloader* podcast_downloader() const { return podcast_downloader_; }
GPodderSync* gpodder_sync() const { return gpodder_sync_; }
MoodbarLoader* moodbar_loader() const { return moodbar_loader_; }
@ -128,6 +130,7 @@ class Application : public QObject {
Library* library_;
DeviceManager* device_manager_;
PodcastUpdater* podcast_updater_;
PodcastDeleter* podcast_deleter_;
PodcastDownloader* podcast_downloader_;
GPodderSync* gpodder_sync_;
MoodbarLoader* moodbar_loader_;

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2010-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@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,6 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 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

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2010-2011, 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

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

@ -1,6 +1,7 @@
/* This file is part of Clementine.
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Andreas <asfa194@gmail.com>
Copyright 2014, Krzysztof A. Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>

View File

@ -1,6 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Andreas <asfa194@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>

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

@ -6,7 +6,7 @@
Copyright 2011, Angus Gratton <gus@projectgus.com>
Copyright 2012, Kacper "mattrick" Banasik <mattrick@jabster.pl>
Copyright 2013, Martin Brodbeck <martin@brodbeck-online.de>
Copyright 2013, Andreas <asfa194@gmail.com>
Copyright 2013-2014, Andreas <asfa194@gmail.com>
Copyright 2013, Joel Bradshaw <cincodenada@gmail.com>
Copyright 2013, Uwe Klotz <uwe.klotz@gmail.com>
Copyright 2013, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>
@ -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

@ -9,6 +9,7 @@
Copyright 2013, Joel Bradshaw <cincodenada@gmail.com>
Copyright 2013, Uwe Klotz <uwe.klotz@gmail.com>
Copyright 2013, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>
Copyright 2014, Andreas <asfa194@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify

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

@ -235,18 +235,15 @@ bool RemoveRecursive(const QString& path) {
QDir dir(path);
for (const QString& child :
dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden)) {
if (!RemoveRecursive(path + "/" + child))
return false;
if (!RemoveRecursive(path + "/" + child)) return false;
}
for (const QString& child :
dir.entryList(QDir::NoDotAndDotDot | QDir::Files | QDir::Hidden)) {
if (!QFile::remove(path + "/" + child))
return false;
if (!QFile::remove(path + "/" + child)) return false;
}
if (!dir.rmdir(path))
return false;
if (!dir.rmdir(path)) return false;
return true;
}
@ -465,19 +462,18 @@ QByteArray HmacSha1(const QByteArray& key, const QByteArray& data) {
}
QByteArray Sha256(const QByteArray& data) {
#ifndef USE_SYSTEM_SHA2
using clementine_sha2::SHA256_CTX;
using clementine_sha2::SHA256_Init;
using clementine_sha2::SHA256_Update;
using clementine_sha2::SHA256_Final;
using clementine_sha2::SHA256_DIGEST_LENGTH;
#endif
#ifndef USE_SYSTEM_SHA2
using clementine_sha2::SHA256_CTX;
using clementine_sha2::SHA256_Init;
using clementine_sha2::SHA256_Update;
using clementine_sha2::SHA256_Final;
using clementine_sha2::SHA256_DIGEST_LENGTH;
#endif
SHA256_CTX context;
SHA256_Init(&context);
SHA256_Update(
&context, reinterpret_cast<const quint8*>(data.constData()),
data.length());
SHA256_Update(&context, reinterpret_cast<const quint8*>(data.constData()),
data.length());
QByteArray ret(SHA256_DIGEST_LENGTH, '\0');
SHA256_Final(reinterpret_cast<quint8*>(ret.data()), &context);
@ -571,17 +567,43 @@ bool ParseUntilElement(QXmlStreamReader* reader, const QString& name) {
QDateTime ParseRFC822DateTime(const QString& text) {
// This sucks but we need it because some podcasts don't quite follow the
// spec properly - they might have 1-digit hour numbers for example.
QDateTime ret;
QRegExp re(
"([a-zA-Z]{3}),? (\\d{1,2}) ([a-zA-Z]{3}) (\\d{4}) "
"(\\d{1,2}):(\\d{1,2}):(\\d{1,2})");
if (re.indexIn(text) == -1) return QDateTime();
if (re.indexIn(text) != -1) {
ret = QDateTime(
QDate::fromString(QString("%1 %2 %3 %4")
.arg(re.cap(1), re.cap(3), re.cap(2), re.cap(4)),
Qt::TextDate),
QTime(re.cap(5).toInt(), re.cap(6).toInt(), re.cap(7).toInt()));
}
if (ret.isValid()) return ret;
// Because http://feeds.feedburner.com/reasonabledoubts/Msxh?format=xml
QRegExp re2(
"(\\d{1,2}) ([a-zA-Z]{3}) (\\d{4}) "
"(\\d{1,2}):(\\d{1,2}):(\\d{1,2})");
return QDateTime(
QDate::fromString(QString("%1 %2 %3 %4")
.arg(re.cap(1), re.cap(3), re.cap(2), re.cap(4)),
Qt::TextDate),
QTime(re.cap(5).toInt(), re.cap(6).toInt(), re.cap(7).toInt()));
QMap<QString, int> monthmap;
monthmap["Jan"] = 1;
monthmap["Feb"] = 2;
monthmap["Mar"] = 3;
monthmap["Apr"] = 4;
monthmap["May"] = 5;
monthmap["Jun"] = 6;
monthmap["Jul"] = 7;
monthmap["Aug"] = 8;
monthmap["Sep"] = 9;
monthmap["Oct"] = 10;
monthmap["Nov"] = 11;
monthmap["Dec"] = 12;
if (re2.indexIn(text) != -1) {
QDate date(re2.cap(3).toInt(), monthmap[re2.cap(2)], re2.cap(1).toInt());
ret = QDateTime(date, QTime(re2.cap(4).toInt(), re2.cap(5).toInt(),
re2.cap(6).toInt()));
}
return ret;
}
const char* EnumToString(const QMetaObject& meta, const char* name, int value) {

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;
@ -143,7 +151,11 @@ void InternetModel::AddService(InternetService* service) {
SIGNAL(ScrollToIndex(QModelIndex)));
connect(service, SIGNAL(destroyed()), SLOT(ServiceDeleted()));
service->ReloadSettings();
if (service->has_initial_load_settings()) {
service->InitialLoadSettings();
} else {
service->ReloadSettings();
}
}
void InternetModel::RemoveService(InternetService* service) {

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>
@ -48,7 +53,8 @@ class InternetService : public QObject {
virtual QStandardItem* CreateRootItem() = 0;
virtual void LazyPopulate(QStandardItem* parent) = 0;
virtual bool has_initial_load_settings() const { return false; }
virtual void InitialLoadSettings() {}
virtual void ShowContextMenu(const QPoint& global_pos) {}
virtual void ItemDoubleClicked(QStandardItem* item) {}
// Create a generator for smart playlists
@ -73,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);
@ -133,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_

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