diff --git a/src/internet/boxservice.cpp b/src/internet/boxservice.cpp index 56b19ef46..86c4ea68d 100644 --- a/src/internet/boxservice.cpp +++ b/src/internet/boxservice.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "boxservice.h" #include @@ -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(); diff --git a/src/internet/boxservice.h b/src/internet/boxservice.h index 97a822b24..a0cd5cdda 100644 --- a/src/internet/boxservice.h +++ b/src/internet/boxservice.h @@ -1,5 +1,23 @@ -#ifndef BOXSERVICE_H -#define BOXSERVICE_H +/* This file is part of Clementine. + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_BOXSERVICE_H_ +#define INTERNET_BOXSERVICE_H_ #include "cloudfileservice.h" @@ -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_BOXSERVICE_H_ diff --git a/src/internet/boxsettingspage.cpp b/src/internet/boxsettingspage.cpp index f8889469a..2a12002b3 100644 --- a/src/internet/boxsettingspage.cpp +++ b/src/internet/boxsettingspage.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, John Maguire + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/boxsettingspage.h b/src/internet/boxsettingspage.h index d0f6c6130..afa476287 100644 --- a/src/internet/boxsettingspage.h +++ b/src/internet/boxsettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, John Maguire + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef BOXSETTINGSPAGE_H -#define BOXSETTINGSPAGE_H +#ifndef INTERNET_BOXSETTINGSPAGE_H_ +#define INTERNET_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_BOXSETTINGSPAGE_H_ diff --git a/src/internet/boxurlhandler.cpp b/src/internet/boxurlhandler.cpp index 08d404ad3..10c042285 100644 --- a/src/internet/boxurlhandler.cpp +++ b/src/internet/boxurlhandler.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "boxurlhandler.h" #include "boxservice.h" diff --git a/src/internet/boxurlhandler.h b/src/internet/boxurlhandler.h index 563942bcd..cd9f6bbee 100644 --- a/src/internet/boxurlhandler.h +++ b/src/internet/boxurlhandler.h @@ -1,5 +1,23 @@ -#ifndef BOXURLHANDLER_H -#define BOXURLHANDLER_H +/* This file is part of Clementine. + Copyright 2013, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_BOXURLHANDLER_H_ +#define INTERNET_BOXURLHANDLER_H_ #include "core/urlhandler.h" @@ -7,8 +25,9 @@ class BoxService; class BoxUrlHandler : public UrlHandler { Q_OBJECT + public: - BoxUrlHandler(BoxService* service, QObject* parent = nullptr); + explicit BoxUrlHandler(BoxService* service, QObject* parent = nullptr); QString scheme() const { return "box"; } QIcon icon() const { return QIcon(":/providers/box.png"); } @@ -18,4 +37,4 @@ class BoxUrlHandler : public UrlHandler { BoxService* service_; }; -#endif // BOXURLHANDLER_H +#endif // INTERNET_BOXURLHANDLER_H_ diff --git a/src/internet/cloudfilesearchprovider.cpp b/src/internet/cloudfilesearchprovider.cpp index f3185b8f1..e07c76f75 100644 --- a/src/internet/cloudfilesearchprovider.cpp +++ b/src/internet/cloudfilesearchprovider.cpp @@ -1,16 +1,17 @@ /* This file is part of Clementine. + Copyright 2014, Krzysztof Sobiecki Copyright 2014, David Sansome - + 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 . */ @@ -20,18 +21,11 @@ #include "internet/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_; diff --git a/src/internet/cloudfilesearchprovider.h b/src/internet/cloudfilesearchprovider.h index 3e41298d0..c514af7f1 100644 --- a/src/internet/cloudfilesearchprovider.h +++ b/src/internet/cloudfilesearchprovider.h @@ -1,22 +1,23 @@ /* This file is part of Clementine. + Copyright 2014, Krzysztof Sobiecki Copyright 2014, David Sansome - + 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 . */ -#ifndef CLOUDFILESEARCHPROVIDER_H -#define CLOUDFILESEARCHPROVIDER_H +#ifndef INTERNET_CLOUDFILESEARCHPROVIDER_H_ +#define INTERNET_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_CLOUDFILESEARCHPROVIDER_H_ diff --git a/src/internet/cloudfileservice.cpp b/src/internet/cloudfileservice.cpp index 96699520c..f46c62559 100644 --- a/src/internet/cloudfileservice.cpp +++ b/src/internet/cloudfileservice.cpp @@ -1,3 +1,23 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2013, Martin Brodbeck + Copyright 2013-2014, David Sansome + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "cloudfileservice.h" #include @@ -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 = diff --git a/src/internet/cloudfileservice.h b/src/internet/cloudfileservice.h index 44e7cc5dc..6d78e484c 100644 --- a/src/internet/cloudfileservice.h +++ b/src/internet/cloudfileservice.h @@ -1,5 +1,24 @@ -#ifndef CLOUDFILESERVICE_H -#define CLOUDFILESERVICE_H +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome + + 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 . +*/ + +#ifndef INTERNET_CLOUDFILESERVICE_H_ +#define INTERNET_CLOUDFILESERVICE_H_ #include "internetservice.h" @@ -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_CLOUDFILESERVICE_H_ diff --git a/src/internet/digitallyimportedclient.cpp b/src/internet/digitallyimportedclient.cpp index 1a9d256b3..1b79fd5fc 100644 --- a/src/internet/digitallyimportedclient.cpp +++ b/src/internet/digitallyimportedclient.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,13 +46,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, diff --git a/src/internet/digitallyimportedclient.h b/src/internet/digitallyimportedclient.h index 0a8364280..ef86f5450 100644 --- a/src/internet/digitallyimportedclient.h +++ b/src/internet/digitallyimportedclient.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef DIGITALLYIMPORTEDCLIENT_H -#define DIGITALLYIMPORTEDCLIENT_H +#ifndef INTERNET_DIGITALLYIMPORTEDCLIENT_H_ +#define INTERNET_DIGITALLYIMPORTEDCLIENT_H_ #include #include @@ -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_DIGITALLYIMPORTEDCLIENT_H_ diff --git a/src/internet/digitallyimportedservicebase.cpp b/src/internet/digitallyimportedservicebase.cpp index 3098a5571..a9266d4ee 100644 --- a/src/internet/digitallyimportedservicebase.cpp +++ b/src/internet/digitallyimportedservicebase.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2011-2012, 2014, John Maguire + Copyright 2014, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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) {} diff --git a/src/internet/digitallyimportedservicebase.h b/src/internet/digitallyimportedservicebase.h index f210f5abf..6cb91a4fb 100644 --- a/src/internet/digitallyimportedservicebase.h +++ b/src/internet/digitallyimportedservicebase.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef DIGITALLYIMPORTEDSERVICEBASE_H -#define DIGITALLYIMPORTEDSERVICEBASE_H +#ifndef INTERNET_DIGITALLYIMPORTEDSERVICEBASE_H_ +#define INTERNET_DIGITALLYIMPORTEDSERVICEBASE_H_ #include @@ -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_DIGITALLYIMPORTEDSERVICEBASE_H_ diff --git a/src/internet/digitallyimportedsettingspage.cpp b/src/internet/digitallyimportedsettingspage.cpp index f06a2db53..b3df3d75c 100644 --- a/src/internet/digitallyimportedsettingspage.cpp +++ b/src/internet/digitallyimportedsettingspage.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/digitallyimportedsettingspage.h b/src/internet/digitallyimportedsettingspage.h index f22947925..b9268e0ad 100644 --- a/src/internet/digitallyimportedsettingspage.h +++ b/src/internet/digitallyimportedsettingspage.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef DIGITALLYIMPORTEDSETTINGSPAGE_H -#define DIGITALLYIMPORTEDSETTINGSPAGE_H +#ifndef INTERNET_DIGITALLYIMPORTEDSETTINGSPAGE_H_ +#define INTERNET_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_DIGITALLYIMPORTEDSETTINGSPAGE_H_ diff --git a/src/internet/digitallyimportedurlhandler.cpp b/src/internet/digitallyimportedurlhandler.cpp index c57cdf371..457c53b54 100644 --- a/src/internet/digitallyimportedurlhandler.cpp +++ b/src/internet/digitallyimportedurlhandler.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2012, Arnaud Bienner + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/digitallyimportedurlhandler.h b/src/internet/digitallyimportedurlhandler.h index 3386a6257..de682129b 100644 --- a/src/internet/digitallyimportedurlhandler.h +++ b/src/internet/digitallyimportedurlhandler.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef DIGITALLYIMPORTEDURLHANDLER_H -#define DIGITALLYIMPORTEDURLHANDLER_H +#ifndef INTERNET_DIGITALLYIMPORTEDURLHANDLER_H_ +#define INTERNET_DIGITALLYIMPORTEDURLHANDLER_H_ #include "core/urlhandler.h" @@ -43,4 +45,4 @@ class DigitallyImportedUrlHandler : public UrlHandler { QUrl last_original_url_; }; -#endif // DIGITALLYIMPORTEDURLHANDLER_H +#endif // INTERNET_DIGITALLYIMPORTEDURLHANDLER_H_ diff --git a/src/internet/dropboxauthenticator.cpp b/src/internet/dropboxauthenticator.cpp index b4378ad30..c69a702d7 100644 --- a/src/internet/dropboxauthenticator.cpp +++ b/src/internet/dropboxauthenticator.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "dropboxauthenticator.h" #include @@ -61,7 +79,7 @@ QMap ParseParamList(const QString& params) { } return ret; } -} +} // namespace void DropboxAuthenticator::RequestTokenFinished(QNetworkReply* reply) { reply->deleteLater(); diff --git a/src/internet/dropboxauthenticator.h b/src/internet/dropboxauthenticator.h index bd3a71809..d9e7933e4 100644 --- a/src/internet/dropboxauthenticator.h +++ b/src/internet/dropboxauthenticator.h @@ -1,5 +1,23 @@ -#ifndef DROPBOXAUTHENTICATOR_H -#define DROPBOXAUTHENTICATOR_H +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_DROPBOXAUTHENTICATOR_H_ +#define INTERNET_DROPBOXAUTHENTICATOR_H_ #include #include @@ -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_DROPBOXAUTHENTICATOR_H_ diff --git a/src/internet/dropboxservice.cpp b/src/internet/dropboxservice.cpp index f96b58cc6..dcff95c9f 100644 --- a/src/internet/dropboxservice.cpp +++ b/src/internet/dropboxservice.cpp @@ -1,3 +1,22 @@ +/* This file is part of Clementine. + Copyright 2012-2014, John Maguire + Copyright 2013, Martin Brodbeck + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "dropboxservice.h" #include diff --git a/src/internet/dropboxservice.h b/src/internet/dropboxservice.h index 9434fa5da..6df5caf74 100644 --- a/src/internet/dropboxservice.h +++ b/src/internet/dropboxservice.h @@ -1,5 +1,23 @@ -#ifndef DROPBOXSERVICE_H -#define DROPBOXSERVICE_H +/* This file is part of Clementine. + Copyright 2012-2013, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_DROPBOXSERVICE_H_ +#define INTERNET_DROPBOXSERVICE_H_ #include "internet/cloudfileservice.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_DROPBOXSERVICE_H_ diff --git a/src/internet/dropboxsettingspage.cpp b/src/internet/dropboxsettingspage.cpp index 22418d9d5..340b4d1f1 100644 --- a/src/internet/dropboxsettingspage.cpp +++ b/src/internet/dropboxsettingspage.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/dropboxsettingspage.h b/src/internet/dropboxsettingspage.h index f03f97e0a..10332f6d7 100644 --- a/src/internet/dropboxsettingspage.h +++ b/src/internet/dropboxsettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef DROPBOXSETTINGSPAGE_H -#define DROPBOXSETTINGSPAGE_H +#ifndef INTERNET_DROPBOXSETTINGSPAGE_H_ +#define INTERNET_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_DROPBOXSETTINGSPAGE_H_ diff --git a/src/internet/dropboxurlhandler.cpp b/src/internet/dropboxurlhandler.cpp index 1a2068e2c..dd5b8e568 100644 --- a/src/internet/dropboxurlhandler.cpp +++ b/src/internet/dropboxurlhandler.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "dropboxurlhandler.h" #include "internet/dropboxservice.h" diff --git a/src/internet/dropboxurlhandler.h b/src/internet/dropboxurlhandler.h index f86734f64..6ff9d5038 100644 --- a/src/internet/dropboxurlhandler.h +++ b/src/internet/dropboxurlhandler.h @@ -1,5 +1,23 @@ -#ifndef DROPBOXURLHANDLER_H -#define DROPBOXURLHANDLER_H +/* This file is part of Clementine. + Copyright 2012, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_DROPBOXURLHANDLER_H_ +#define INTERNET_DROPBOXURLHANDLER_H_ #include "core/urlhandler.h" @@ -8,7 +26,7 @@ class DropboxService; class DropboxUrlHandler : public UrlHandler { Q_OBJECT public: - DropboxUrlHandler(DropboxService* service, QObject* parent = nullptr); + explicit DropboxUrlHandler(DropboxService* service, QObject* parent = nullptr); QString scheme() const { return "dropbox"; } QIcon icon() const { return QIcon(":providers/dropbox.png"); } @@ -18,4 +36,4 @@ class DropboxUrlHandler : public UrlHandler { DropboxService* service_; }; -#endif +#endif // INTERNET_DROPBOXURLHANDLER_H_ diff --git a/src/internet/fixlastfm.cpp b/src/internet/fixlastfm.cpp index 607f5c162..8884e0e26 100644 --- a/src/internet/fixlastfm.cpp +++ b/src/internet/fixlastfm.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/fixlastfm.h b/src/internet/fixlastfm.h index f23e2702e..628f8b766 100644 --- a/src/internet/fixlastfm.h +++ b/src/internet/fixlastfm.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef FIXLASTFM_H -#define FIXLASTFM_H +#ifndef INTERNET_FIXLASTFM_H_ +#define INTERNET_FIXLASTFM_H_ // Include this before to fix a compile error in release mode @@ -27,4 +29,4 @@ QDebug& operator<<(QDebug&, const QUrl&); #endif -#endif +#endif // INTERNET_FIXLASTFM_H_ diff --git a/src/internet/geolocator.cpp b/src/internet/geolocator.cpp index 2c773b995..f527dd81d 100644 --- a/src/internet/geolocator.cpp +++ b/src/internet/geolocator.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/geolocator.h b/src/internet/geolocator.h index d0690aecc..461836a5d 100644 --- a/src/internet/geolocator.h +++ b/src/internet/geolocator.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef GEOLOCATOR_H -#define GEOLOCATOR_H +#ifndef INTERNET_GEOLOCATOR_H_ +#define INTERNET_GEOLOCATOR_H_ #include @@ -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_GEOLOCATOR_H_ diff --git a/src/internet/googledriveclient.cpp b/src/internet/googledriveclient.cpp index 5987e5165..7684264e6 100644 --- a/src/internet/googledriveclient.cpp +++ b/src/internet/googledriveclient.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2012, 2014, David Sansome + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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(); diff --git a/src/internet/googledriveclient.h b/src/internet/googledriveclient.h index 3708f55e6..b07e176fd 100644 --- a/src/internet/googledriveclient.h +++ b/src/internet/googledriveclient.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef GOOGLEDRIVECLIENT_H -#define GOOGLEDRIVECLIENT_H +#ifndef INTERNET_GOOGLEDRIVECLIENT_H_ +#define INTERNET_GOOGLEDRIVECLIENT_H_ #include #include @@ -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& files); void FilesDeleted(const QList& 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_GOOGLEDRIVECLIENT_H_ diff --git a/src/internet/googledriveservice.cpp b/src/internet/googledriveservice.cpp index 838129073..0704fb299 100644 --- a/src/internet/googledriveservice.cpp +++ b/src/internet/googledriveservice.cpp @@ -1,3 +1,22 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2012, 2014, David Sansome + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "googledriveservice.h" #include @@ -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); diff --git a/src/internet/googledriveservice.h b/src/internet/googledriveservice.h index 6d698d8df..b204aa0c1 100644 --- a/src/internet/googledriveservice.h +++ b/src/internet/googledriveservice.h @@ -1,5 +1,24 @@ -#ifndef GOOGLEDRIVESERVICE_H -#define GOOGLEDRIVESERVICE_H +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2012, 2014, David Sansome + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_GOOGLEDRIVESERVICE_H_ +#define INTERNET_GOOGLEDRIVESERVICE_H_ #include "cloudfileservice.h" @@ -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_GOOGLEDRIVESERVICE_H_ diff --git a/src/internet/googledrivesettingspage.cpp b/src/internet/googledrivesettingspage.cpp index 5a4ff2622..3c0bb5d5f 100644 --- a/src/internet/googledrivesettingspage.cpp +++ b/src/internet/googledrivesettingspage.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2012, David Sansome + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/googledrivesettingspage.h b/src/internet/googledrivesettingspage.h index 37da9cb46..ae9363c2d 100644 --- a/src/internet/googledrivesettingspage.h +++ b/src/internet/googledrivesettingspage.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef GOOGLEDRIVESETTINGSPAGE_H -#define GOOGLEDRIVESETTINGSPAGE_H +#ifndef INTERNET_GOOGLEDRIVESETTINGSPAGE_H_ +#define INTERNET_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_GOOGLEDRIVESETTINGSPAGE_H_ diff --git a/src/internet/googledriveurlhandler.cpp b/src/internet/googledriveurlhandler.cpp index 2a35297cb..a700f9e20 100644 --- a/src/internet/googledriveurlhandler.cpp +++ b/src/internet/googledriveurlhandler.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "googledriveurlhandler.h" #include "googledriveservice.h" diff --git a/src/internet/googledriveurlhandler.h b/src/internet/googledriveurlhandler.h index a4f9a4bf7..7403fe4c4 100644 --- a/src/internet/googledriveurlhandler.h +++ b/src/internet/googledriveurlhandler.h @@ -1,5 +1,23 @@ -#ifndef GOOGLEDRIVEURLHANDLER_H -#define GOOGLEDRIVEURLHANDLER_H +/* This file is part of Clementine. + Copyright 2012, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_GOOGLEDRIVEURLHANDLER_H_ +#define INTERNET_GOOGLEDRIVEURLHANDLER_H_ #include "core/urlhandler.h" @@ -7,8 +25,9 @@ class GoogleDriveService; class GoogleDriveUrlHandler : public UrlHandler { Q_OBJECT + public: - GoogleDriveUrlHandler(GoogleDriveService* service, QObject* parent = nullptr); + explicit GoogleDriveUrlHandler(GoogleDriveService* service, QObject* parent = nullptr); QString scheme() const { return "googledrive"; } QIcon icon() const { return QIcon(":providers/googledrive.png"); } @@ -18,4 +37,4 @@ class GoogleDriveUrlHandler : public UrlHandler { GoogleDriveService* service_; }; -#endif +#endif // INTERNET_GOOGLEDRIVEURLHANDLER_H_ diff --git a/src/internet/groovesharkradio.cpp b/src/internet/groovesharkradio.cpp index 64e127908..2ea49712c 100644 --- a/src/internet/groovesharkradio.cpp +++ b/src/internet/groovesharkradio.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/groovesharkradio.h b/src/internet/groovesharkradio.h index 56df3d619..6ce45da51 100644 --- a/src/internet/groovesharkradio.h +++ b/src/internet/groovesharkradio.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,20 +17,19 @@ along with Clementine. If not, see . */ -#ifndef GROOVESHARKRADIO_H -#define GROOVESHARKRADIO_H +#ifndef INTERNET_GROOVESHARKRADIO_H_ +#define INTERNET_GROOVESHARKRADIO_H_ #include "smartplaylists/generator.h" class GroovesharkService; class GroovesharkRadio : public smart_playlists::Generator { - public: // Start Grooveshark radio for a particular type of music GroovesharkRadio(GroovesharkService* service, int tag_id); // Start Grooveshark radio based on last artists and songs you listen to - GroovesharkRadio(GroovesharkService* service); + explicit GroovesharkRadio(GroovesharkService* service); QString type() const { return "Grooveshark"; } void Load(const QByteArray& data); @@ -48,4 +49,4 @@ class GroovesharkRadio : public smart_playlists::Generator { QVariantMap autoplay_state_; }; -#endif // GROOVESHARKRADIO_H +#endif // INTERNET_GROOVESHARKRADIO_H_ diff --git a/src/internet/groovesharkservice.cpp b/src/internet/groovesharkservice.cpp index dbe243587..6388d8a7a 100644 --- a/src/internet/groovesharkservice.cpp +++ b/src/internet/groovesharkservice.cpp @@ -1,5 +1,10 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011-2014, Arnaud Bienner + Copyright 2011-2012, 2014, John Maguire + Copyright 2011, HYPNOTOAD + Copyright 2011-2012, David Sansome + Copyright 2014, Antonio Nicolás Pina + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -118,7 +123,6 @@ GroovesharkService::GroovesharkService(Application* app, InternetModel* parent) task_popular_id_(0), task_playlists_id_(0), task_search_id_(0) { - app_->player()->RegisterUrlHandler(url_handler_); search_delay_->setInterval(kSearchDelayMsec); @@ -442,7 +446,8 @@ void GroovesharkService::RemoveItems() { playlists_.clear(); subscribed_playlists_parent_ = nullptr; subscribed_playlists_.clear(); - // Cancel any pending requests and mark tasks as finished, in case they weren't + // Cancel any pending requests and mark tasks as finished, in case they + // weren't // finished yet. pending_retrieve_playlists_.clear(); app_->task_manager()->SetTaskFinished(task_playlists_id_); @@ -719,7 +724,8 @@ void GroovesharkService::UserPlaylistsRetrieved(QNetworkReply* reply) { } void GroovesharkService::PlaylistSongsRetrieved(QNetworkReply* reply, - int playlist_id, int request_id) { + int playlist_id, + int request_id) { reply->deleteLater(); if (!pending_retrieve_playlists_.remove(request_id)) { @@ -1273,9 +1279,9 @@ void GroovesharkService::RefreshPlaylist(int playlist_id) { parameters << Param("playlistID", playlist_id); QNetworkReply* reply = CreateRequest("getPlaylistSongs", parameters); int id = next_pending_playlist_retrieve_id_++; - NewClosure(reply, SIGNAL(finished()), - this, SLOT(PlaylistSongsRetrieved(QNetworkReply*, int, int)), - reply, playlist_id, id); + NewClosure(reply, SIGNAL(finished()), this, + SLOT(PlaylistSongsRetrieved(QNetworkReply*, int, int)), reply, + playlist_id, id); pending_retrieve_playlists_.insert(id); } @@ -1468,9 +1474,8 @@ void GroovesharkService::UserLibrarySongAdded(QNetworkReply* reply, void GroovesharkService::RemoveCurrentFromPlaylist() { const QModelIndexList& indexes(model()->selected_indexes()); - QMap > playlists_songs_ids; + QMap> playlists_songs_ids; for (const QModelIndex& index : indexes) { - if (index.parent().data(InternetModel::Role_Type).toInt() != InternetModel::Type_UserPlaylist) { continue; @@ -1483,7 +1488,7 @@ void GroovesharkService::RemoveCurrentFromPlaylist() { } } - for (QMap >::const_iterator it = + for (QMap>::const_iterator it = playlists_songs_ids.constBegin(); it != playlists_songs_ids.constEnd(); ++it) { RemoveFromPlaylist(it.key(), it.value()); @@ -1508,7 +1513,6 @@ void GroovesharkService::RemoveCurrentFromFavorites() { const QModelIndexList& indexes(model()->selected_indexes()); QList songs_ids; for (const QModelIndex& index : indexes) { - if (index.parent().data(Role_PlaylistType).toInt() != UserFavorites) { continue; } @@ -1561,7 +1565,6 @@ void GroovesharkService::RemoveCurrentFromLibrary() { QList songs_ids; for (const QModelIndex& index : indexes) { - if (index.parent().data(Role_PlaylistType).toInt() != UserLibrary) { continue; } @@ -1619,7 +1622,6 @@ void GroovesharkService::SongsRemovedFromLibrary(QNetworkReply* reply, QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name, const QList& params, bool use_https) { - QVariantMap request_params; request_params.insert("method", method_name); @@ -1650,9 +1652,8 @@ QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name, url.setScheme("https"); } url.setQueryItems( - QList >() - << QPair( - "sig", Utilities::HmacMd5(api_key_, post_params).toHex())); + QList>() << QPair( + "sig", Utilities::HmacMd5(api_key_, post_params).toHex())); QNetworkRequest req(url); QNetworkReply* reply = network_->post(req, post_params); @@ -1723,11 +1724,12 @@ bool CompareSongs(const QVariant& song1, const QVariant& song2) { int song2_sort = song2_map["Sort"].toInt(); if (song1_sort == song2_sort) { // Favorite songs have a "TSFavorited" and (currently) no "Sort" field - return song1_map["TSFavorited"].toString() < song2_map["TSFavorited"].toString(); + return song1_map["TSFavorited"].toString() < + song2_map["TSFavorited"].toString(); } return song1_sort < song2_sort; } -} +} // namespace SongList GroovesharkService::ExtractSongs(const QVariantMap& result) { QVariantList result_songs = result["songs"].toList(); diff --git a/src/internet/groovesharkservice.h b/src/internet/groovesharkservice.h index b955b8568..59b715b4f 100644 --- a/src/internet/groovesharkservice.h +++ b/src/internet/groovesharkservice.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011-2014, Arnaud Bienner + Copyright 2011-2012, 2014, John Maguire + Copyright 2012, David Sansome + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef GROOVESHARKSERVICE_H -#define GROOVESHARKSERVICE_H +#ifndef INTERNET_GROOVESHARKSERVICE_H_ +#define INTERNET_GROOVESHARKSERVICE_H_ #include "internetmodel.h" #include "internetservice.h" @@ -35,6 +38,7 @@ class QSortFilterProxyModel; class GroovesharkService : public InternetService { Q_OBJECT + public: GroovesharkService(Application* app, InternetModel* parent); ~GroovesharkService(); @@ -123,7 +127,7 @@ class GroovesharkService : public InternetService { static const char* kServiceName; static const char* kSettingsGroup; -signals: + signals: void LoginFinished(bool success); void SimpleSearchResults(int id, SongList songs); // AlbumSearchResult emits the search id and the Grooveshark ids of the @@ -222,7 +226,7 @@ signals: // If need_authentication is true, add session_id to params. // Returns the reply object created QNetworkReply* CreateRequest(const QString& method_name, - const QList >& params, + const QList>& params, bool use_https = false); // Convenient function which block until 'reply' replies, or timeout after 10 // seconds. Returns false if reply has timeouted @@ -332,4 +336,4 @@ signals: static const char* kApiSecret; }; -#endif // GROOVESHARKSERVICE_H +#endif // INTERNET_GROOVESHARKSERVICE_H_ diff --git a/src/internet/groovesharksettingspage.cpp b/src/internet/groovesharksettingspage.cpp index ca198f5b3..9daf50df6 100644 --- a/src/internet/groovesharksettingspage.cpp +++ b/src/internet/groovesharksettingspage.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, 2014, Arnaud Bienner + Copyright 2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/groovesharksettingspage.h b/src/internet/groovesharksettingspage.h index 88b74fbe4..c36fdaa89 100644 --- a/src/internet/groovesharksettingspage.h +++ b/src/internet/groovesharksettingspage.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef GROOVESHARKSETTINGSPAGE_H -#define GROOVESHARKSETTINGSPAGE_H +#ifndef INTERNET_GROOVESHARKSETTINGSPAGE_H_ +#define INTERNET_GROOVESHARKSETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -28,7 +30,7 @@ class GroovesharkSettingsPage : public SettingsPage { Q_OBJECT public: - GroovesharkSettingsPage(SettingsDialog* dialog); + explicit GroovesharkSettingsPage(SettingsDialog* dialog); ~GroovesharkSettingsPage(); void Load(); @@ -51,4 +53,4 @@ class GroovesharkSettingsPage : public SettingsPage { QString original_password_; }; -#endif // GROOVESHARKSETTINGSPAGE_H +#endif // INTERNET_GROOVESHARKSETTINGSPAGE_H_ diff --git a/src/internet/groovesharkurlhandler.cpp b/src/internet/groovesharkurlhandler.cpp index c505baf1c..9554892c8 100644 --- a/src/internet/groovesharkurlhandler.cpp +++ b/src/internet/groovesharkurlhandler.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/groovesharkurlhandler.h b/src/internet/groovesharkurlhandler.h index cc5cad9e7..86b391c21 100644 --- a/src/internet/groovesharkurlhandler.h +++ b/src/internet/groovesharkurlhandler.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef GROOVESHARKURLHANDLER_H -#define GROOVESHARKURLHANDLER_H +#ifndef INTERNET_GROOVESHARKURLHANDLER_H_ +#define INTERNET_GROOVESHARKURLHANDLER_H_ #include "core/urlhandler.h" @@ -47,4 +49,4 @@ class GroovesharkUrlHandler : public UrlHandler { QString last_stream_key_; }; -#endif // GROOVESHARKURLHANDLER_H +#endif // INTERNET_GROOVESHARKURLHANDLER_H_ diff --git a/src/internet/icecastbackend.cpp b/src/internet/icecastbackend.cpp index c449d8cf2..6957e4293 100644 --- a/src/internet/icecastbackend.cpp +++ b/src/internet/icecastbackend.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2011, Paweł Bara + Copyright 2012, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/icecastbackend.h b/src/internet/icecastbackend.h index 3e3115488..78ee635c7 100644 --- a/src/internet/icecastbackend.h +++ b/src/internet/icecastbackend.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, 2012, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef ICECASTBACKEND_H -#define ICECASTBACKEND_H +#ifndef INTERNET_ICECASTBACKEND_H_ +#define INTERNET_ICECASTBACKEND_H_ #include "core/song.h" @@ -29,7 +31,7 @@ class IcecastBackend : public QObject { Q_OBJECT public: - IcecastBackend(QObject* parent = nullptr); + explicit IcecastBackend(QObject* parent = nullptr); void Init(Database* db); static const char* kTableName; @@ -58,11 +60,11 @@ class IcecastBackend : public QObject { bool IsEmpty(); -signals: + signals: void DatabaseReset(); private: Database* db_; }; -#endif // ICECASTBACKEND_H +#endif // INTERNET_ICECASTBACKEND_H_ diff --git a/src/internet/icecastfilterwidget.cpp b/src/internet/icecastfilterwidget.cpp index ba7bb9a9e..895433e64 100644 --- a/src/internet/icecastfilterwidget.cpp +++ b/src/internet/icecastfilterwidget.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/icecastfilterwidget.h b/src/internet/icecastfilterwidget.h index c6c019d44..7084f8821 100644 --- a/src/internet/icecastfilterwidget.h +++ b/src/internet/icecastfilterwidget.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef ICECASTFILTERWIDGET_H -#define ICECASTFILTERWIDGET_H +#ifndef INTERNET_ICECASTFILTERWIDGET_H_ +#define INTERNET_ICECASTFILTERWIDGET_H_ #include "icecastmodel.h" @@ -33,7 +35,7 @@ class IcecastFilterWidget : public QWidget { Q_OBJECT public: - IcecastFilterWidget(QWidget* parent = nullptr); + explicit IcecastFilterWidget(QWidget* parent = nullptr); ~IcecastFilterWidget(); static const char* kSettingsGroup; @@ -60,4 +62,4 @@ class IcecastFilterWidget : public QWidget { QSignalMapper* sort_mode_mapper_; }; -#endif // ICECASTFILTERWIDGET_H +#endif // INTERNET_ICECASTFILTERWIDGET_H_ diff --git a/src/internet/icecastitem.h b/src/internet/icecastitem.h index d1178d002..5f6477de5 100644 --- a/src/internet/icecastitem.h +++ b/src/internet/icecastitem.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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,22 +17,27 @@ along with Clementine. If not, see . */ -#ifndef ICECASTITEM_H -#define ICECASTITEM_H +#ifndef INTERNET_ICECASTITEM_H_ +#define INTERNET_ICECASTITEM_H_ #include "icecastbackend.h" #include "core/simpletreeitem.h" class IcecastItem : public SimpleTreeItem { public: - enum Type { Type_Root, Type_Genre, Type_Station, Type_Divider, }; + enum Type { + Type_Root, + Type_Genre, + Type_Station, + Type_Divider, + }; - IcecastItem(SimpleTreeModel* model) - : SimpleTreeItem(Type_Root, model) {} - IcecastItem(Type type, IcecastItem* parent = nullptr) - : SimpleTreeItem(type, parent) {} + explicit IcecastItem(SimpleTreeModel* model) + : SimpleTreeItem(Type_Root, model) {} + explicit IcecastItem(Type type, IcecastItem* parent = nullptr) + : SimpleTreeItem(type, parent) {} IcecastBackend::Station station; }; -#endif // ICECASTITEM_H +#endif // INTERNET_ICECASTITEM_H_ diff --git a/src/internet/icecastmodel.cpp b/src/internet/icecastmodel.cpp index c6d0e133a..98ef34493 100644 --- a/src/internet/icecastmodel.cpp +++ b/src/internet/icecastmodel.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2011, Paweł Bara + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/icecastmodel.h b/src/internet/icecastmodel.h index 02bbe8a00..3757e02a9 100644 --- a/src/internet/icecastmodel.h +++ b/src/internet/icecastmodel.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef ICECASTMODEL_H -#define ICECASTMODEL_H +#ifndef INTERNET_ICECASTMODEL_H_ +#define INTERNET_ICECASTMODEL_H_ #include "icecastitem.h" #include "core/simpletreemodel.h" @@ -30,7 +32,7 @@ class IcecastModel : public SimpleTreeModel { Q_OBJECT public: - IcecastModel(IcecastBackend* backend, QObject* parent = nullptr); + explicit IcecastModel(IcecastBackend* backend, QObject* parent = nullptr); ~IcecastModel(); // These values get saved in QSettings - don't change them @@ -40,7 +42,9 @@ class IcecastModel : public SimpleTreeModel { SortMode_StationAlphabetical = 2, }; - enum Role { Role_IsDivider = LibraryModel::Role_IsDivider, }; + enum Role { + Role_IsDivider = LibraryModel::Role_IsDivider, + }; IcecastBackend* backend() const { return backend_; } @@ -81,4 +85,4 @@ class IcecastModel : public SimpleTreeModel { QIcon station_icon_; }; -#endif // ICECASTMODEL_H +#endif // INTERNET_ICECASTMODEL_H_ diff --git a/src/internet/icecastservice.cpp b/src/internet/icecastservice.cpp index e8a8df534..55b38273c 100644 --- a/src/internet/icecastservice.cpp +++ b/src/internet/icecastservice.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2010, 2012, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2014, Krzysztof Sobiecki 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,6 +19,8 @@ along with Clementine. If not, see . */ +#include "icecastservice.h" + #include #include @@ -28,7 +34,6 @@ #include "icecastbackend.h" #include "icecastfilterwidget.h" #include "icecastmodel.h" -#include "icecastservice.h" #include "internetmodel.h" #include "core/application.h" #include "core/closure.h" @@ -134,7 +139,7 @@ void IcecastService::DownloadDirectoryFinished(QNetworkReply* reply) { namespace { template struct GenreSorter { - GenreSorter(const QMultiHash& genres) : genres_(genres) {} + explicit GenreSorter(const QMultiHash& genres) : genres_(genres) {} bool operator()(const QString& a, const QString& b) const { return genres_.count(a) > genres_.count(b); @@ -184,7 +189,7 @@ QStringList FilterGenres(const QStringList& genres) { } return ret; } -} +} // namespace void IcecastService::ParseDirectoryFinished( QFuture future) { diff --git a/src/internet/icecastservice.h b/src/internet/icecastservice.h index 52c549597..ab5eaa766 100644 --- a/src/internet/icecastservice.h +++ b/src/internet/icecastservice.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2010, 2012, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,13 +18,14 @@ along with Clementine. If not, see . */ -#ifndef ICECASTSERVICE_H -#define ICECASTSERVICE_H +#ifndef INTERNET_ICECASTSERVICE_H_ +#define INTERNET_ICECASTSERVICE_H_ + +#include "internetservice.h" #include #include "icecastbackend.h" -#include "internetservice.h" class IcecastFilterWidget; class IcecastModel; @@ -33,6 +37,7 @@ class QNetworkReply; class IcecastService : public InternetService { Q_OBJECT + public: IcecastService(Application* app, InternetModel* parent); ~IcecastService(); @@ -41,7 +46,10 @@ class IcecastService : public InternetService { static const char* kDirectoryUrl; static const char* kHomepage; - enum ItemType { Type_Stream = 3000, Type_Genre, }; + enum ItemType { + Type_Stream = 3000, + Type_Genre, + }; QStandardItem* CreateRootItem(); void LazyPopulate(QStandardItem* item); @@ -73,4 +81,4 @@ class IcecastService : public InternetService { int load_directory_task_id_; }; -#endif +#endif // INTERNET_ICECASTSERVICE_H_ diff --git a/src/internet/internetmimedata.h b/src/internet/internetmimedata.h index 3e0513a49..3b844f8ff 100644 --- a/src/internet/internetmimedata.h +++ b/src/internet/internetmimedata.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2011, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef INTERNETMIMEDATA_H -#define INTERNETMIMEDATA_H +#ifndef INTERNET_INTERNETMIMEDATA_H_ +#define INTERNET_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_INTERNETMIMEDATA_H_ diff --git a/src/internet/internetmodel.cpp b/src/internet/internetmodel.cpp index f06e574df..243d452af 100644 --- a/src/internet/internetmodel.cpp +++ b/src/internet/internetmodel.cpp @@ -1,5 +1,13 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2014, David Sansome + Copyright 2010, 2012-2014, John Maguire + Copyright 2011-2012, 2014, Arnaud Bienner + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2011-2013, Alan Briolat + Copyright 2014, Maltsev Vlad + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/internetmodel.h b/src/internet/internetmodel.h index 98112c77f..19ca2db11 100644 --- a/src/internet/internetmodel.h +++ b/src/internet/internetmodel.h @@ -1,5 +1,10 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2012, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011-2012, Arnaud Bienner + Copyright 2011, Tyler Rhodes + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef INTERNETMODEL_H -#define INTERNETMODEL_H +#ifndef INTERNET_INTERNETMODEL_H_ +#define INTERNET_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_INTERNETMODEL_H_ diff --git a/src/internet/internetplaylistitem.cpp b/src/internet/internetplaylistitem.cpp index 803a0b029..6781ffa6b 100644 --- a/src/internet/internetplaylistitem.cpp +++ b/src/internet/internetplaylistitem.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2011, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/internetplaylistitem.h b/src/internet/internetplaylistitem.h index 3f636397c..83b0c93ed 100644 --- a/src/internet/internetplaylistitem.h +++ b/src/internet/internetplaylistitem.h @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2011, David Sansome + Copyright 2010, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef INTERNETPLAYLISTITEM_H -#define INTERNETPLAYLISTITEM_H +#ifndef INTERNET_INTERNETPLAYLISTITEM_H_ +#define INTERNET_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_INTERNETPLAYLISTITEM_H_ diff --git a/src/internet/internetservice.cpp b/src/internet/internetservice.cpp index ee033e651..d15642b81 100644 --- a/src/internet/internetservice.cpp +++ b/src/internet/internetservice.cpp @@ -1,5 +1,10 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2012, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2012, Arnaud Bienner + Copyright 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/internetservice.h b/src/internet/internetservice.h index bf62a28ac..f30342be6 100644 --- a/src/internet/internetservice.h +++ b/src/internet/internetservice.h @@ -1,5 +1,10 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2012, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011-2012, Arnaud Bienner + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef INTERNETSERVICE_H -#define INTERNETSERVICE_H +#ifndef INTERNET_INTERNETSERVICE_H_ +#define INTERNET_INTERNETSERVICE_H_ #include #include @@ -74,7 +79,7 @@ class InternetService : public QObject { virtual QString Icon() { return QString(); } -signals: + signals: void StreamError(const QString& message); void StreamMetadataFound(const QUrl& original_url, const Song& song); @@ -134,4 +139,4 @@ signals: Q_DECLARE_METATYPE(InternetService*); -#endif // INTERNETSERVICE_H +#endif // INTERNET_INTERNETSERVICE_H_ diff --git a/src/internet/internetshowsettingspage.cpp b/src/internet/internetshowsettingspage.cpp index c6cc13dd4..59d4b17f2 100644 --- a/src/internet/internetshowsettingspage.cpp +++ b/src/internet/internetshowsettingspage.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/internetshowsettingspage.h b/src/internet/internetshowsettingspage.h index 3c63ca583..f3b653d44 100644 --- a/src/internet/internetshowsettingspage.h +++ b/src/internet/internetshowsettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef INTERNETSHOWSETTINGSPAGE_H -#define INTERNETSHOWSETTINGSPAGE_H +#ifndef INTERNET_INTERNETSHOWSETTINGSPAGE_H_ +#define INTERNET_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_; }; -#endif // INTERNETSHOWSETTINGSPAGE_H +#endif // INTERNET_INTERNETSHOWSETTINGSPAGE_H_ diff --git a/src/internet/internetsongmimedata.h b/src/internet/internetsongmimedata.h index 07e86d237..8788dfba6 100644 --- a/src/internet/internetsongmimedata.h +++ b/src/internet/internetsongmimedata.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef INTERNETSONGMIMEDATA_H -#define INTERNETSONGMIMEDATA_H +#ifndef INTERNET_INTERNETSONGMIMEDATA_H_ +#define INTERNET_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_INTERNETSONGMIMEDATA_H_ diff --git a/src/internet/internetview.cpp b/src/internet/internetview.cpp index 4b14dcf5e..a3343b5a2 100644 --- a/src/internet/internetview.cpp +++ b/src/internet/internetview.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2010, 2012, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/internetview.h b/src/internet/internetview.h index ef5d7be2b..e01f1b9f5 100644 --- a/src/internet/internetview.h +++ b/src/internet/internetview.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2010, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef INTERNETVIEW_H -#define INTERNETVIEW_H +#ifndef INTERNET_INTERNETVIEW_H_ +#define INTERNET_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_INTERNETVIEW_H_ diff --git a/src/internet/internetviewcontainer.cpp b/src/internet/internetviewcontainer.cpp index c9beec672..38284db2f 100644 --- a/src/internet/internetviewcontainer.cpp +++ b/src/internet/internetviewcontainer.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/internetviewcontainer.h b/src/internet/internetviewcontainer.h index f57f4b177..5eb281419 100644 --- a/src/internet/internetviewcontainer.h +++ b/src/internet/internetviewcontainer.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef INTERNETVIEWCONTAINER_H -#define INTERNETVIEWCONTAINER_H +#ifndef INTERNET_INTERNETVIEWCONTAINER_H_ +#define INTERNET_INTERNETVIEWCONTAINER_H_ #include #include @@ -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 headers_; }; -#endif // INTERNETVIEWCONTAINER_H +#endif // INTERNET_INTERNETVIEWCONTAINER_H_ diff --git a/src/internet/jamendodynamicplaylist.cpp b/src/internet/jamendodynamicplaylist.cpp index b6daa0712..749ba48f6 100644 --- a/src/internet/jamendodynamicplaylist.cpp +++ b/src/internet/jamendodynamicplaylist.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/jamendodynamicplaylist.h b/src/internet/jamendodynamicplaylist.h index d69318208..081fd2255 100644 --- a/src/internet/jamendodynamicplaylist.h +++ b/src/internet/jamendodynamicplaylist.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2011, David Sansome + Copyright 2010, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef JAMENDODYNAMICPLAYLIST_H -#define JAMENDODYNAMICPLAYLIST_H +#ifndef INTERNET_JAMENDODYNAMICPLAYLIST_H_ +#define INTERNET_JAMENDODYNAMICPLAYLIST_H_ #include "smartplaylists/generator.h" @@ -36,7 +39,10 @@ class JamendoDynamicPlaylist : public smart_playlists::Generator { }; // These values are persisted - only add to the end - enum OrderDirection { Order_Ascending = 0, Order_Descending = 1, }; + enum OrderDirection { + Order_Ascending = 0, + Order_Descending = 1, + }; JamendoDynamicPlaylist(); JamendoDynamicPlaylist(const QString& name, OrderBy order_by); @@ -73,4 +79,4 @@ class JamendoDynamicPlaylist : public smart_playlists::Generator { QDataStream& operator<<(QDataStream& s, const JamendoDynamicPlaylist& p); QDataStream& operator>>(QDataStream& s, JamendoDynamicPlaylist& p); -#endif +#endif // INTERNET_JAMENDODYNAMICPLAYLIST_H_ diff --git a/src/internet/jamendoplaylistitem.cpp b/src/internet/jamendoplaylistitem.cpp index 253ac4134..8eb1b2ad0 100644 --- a/src/internet/jamendoplaylistitem.cpp +++ b/src/internet/jamendoplaylistitem.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/jamendoplaylistitem.h b/src/internet/jamendoplaylistitem.h index 06e35a3e1..505345b26 100644 --- a/src/internet/jamendoplaylistitem.h +++ b/src/internet/jamendoplaylistitem.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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,19 +17,19 @@ along with Clementine. If not, see . */ -#ifndef JAMENDOPLAYLISTITEM_H -#define JAMENDOPLAYLISTITEM_H +#ifndef INTERNET_JAMENDOPLAYLISTITEM_H_ +#define INTERNET_JAMENDOPLAYLISTITEM_H_ #include "library/libraryplaylistitem.h" class JamendoPlaylistItem : public LibraryPlaylistItem { public: - JamendoPlaylistItem(const QString& type); - JamendoPlaylistItem(const Song& song); + explicit JamendoPlaylistItem(const QString& type); + explicit JamendoPlaylistItem(const Song& song); bool InitFromQuery(const SqlRow& query); QUrl Url() const; }; -#endif // JAMENDOPLAYLISTITEM_H +#endif // INTERNET_JAMENDOPLAYLISTITEM_H_ diff --git a/src/internet/jamendoservice.cpp b/src/internet/jamendoservice.cpp index 2434a20ea..63c1b5469 100644 --- a/src/internet/jamendoservice.cpp +++ b/src/internet/jamendoservice.cpp @@ -1,5 +1,11 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2013, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2011, Andrea Decorte + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -116,12 +122,11 @@ JamendoService::JamendoService(Application* app, InternetModel* parent) << GeneratorPtr(new JamendoDynamicPlaylist( tr("Jamendo Most Listened Tracks"), JamendoDynamicPlaylist::OrderBy_Listened))) - << (LibraryModel::GeneratorList() - << GeneratorPtr(new QueryGenerator( - tr("Dynamic random mix"), - Search(Search::Type_All, Search::TermList(), - Search::Sort_Random, SearchTerm::Field_Title), - true)))); + << (LibraryModel::GeneratorList() << GeneratorPtr(new QueryGenerator( + tr("Dynamic random mix"), + Search(Search::Type_All, Search::TermList(), Search::Sort_Random, + SearchTerm::Field_Title), + true)))); library_sort_model_->setSourceModel(library_model_); library_sort_model_->setSortRole(LibraryModel::Role_SortText); @@ -197,9 +202,10 @@ void JamendoService::DownloadDirectory() { } void JamendoService::DownloadDirectoryProgress(qint64 received, qint64 total) { - float progress = float(received) / total; + float progress = static_cast(received) / total; app_->task_manager()->SetTaskProgress(load_database_task_id_, - int(progress * 100), 100); + static_cast(progress * 100), + 100); } void JamendoService::DownloadDirectoryFinished() { @@ -209,7 +215,7 @@ void JamendoService::DownloadDirectoryFinished() { app_->task_manager()->SetTaskFinished(load_database_task_id_); load_database_task_id_ = 0; - // TODO: Not leak reply. + // TODO(John Maguire): Not leak reply. QtIOCompressor* gzip = new QtIOCompressor(reply); gzip->setStreamFormat(QtIOCompressor::GzipFormat); if (!gzip->open(QIODevice::ReadOnly)) { diff --git a/src/internet/jamendoservice.h b/src/internet/jamendoservice.h index b658da0ef..e5a19ed84 100644 --- a/src/internet/jamendoservice.h +++ b/src/internet/jamendoservice.h @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Andrea Decorte + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef JAMENDOSERVICE_H -#define JAMENDOSERVICE_H +#ifndef INTERNET_JAMENDOSERVICE_H_ +#define INTERNET_JAMENDOSERVICE_H_ #include "internetservice.h" @@ -37,6 +41,7 @@ class QSortFilterProxyModel; class JamendoService : public InternetService { Q_OBJECT + public: JamendoService(Application* app, InternetModel* parent); ~JamendoService(); @@ -118,4 +123,4 @@ class JamendoService : public InternetService { bool accepted_download_; }; -#endif +#endif // INTERNET_JAMENDOSERVICE_H_ diff --git a/src/internet/lastfmcompat.cpp b/src/internet/lastfmcompat.cpp index 8f4d1579e..2a06c59b8 100644 --- a/src/internet/lastfmcompat.cpp +++ b/src/internet/lastfmcompat.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012-2013, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +32,9 @@ bool ParseQuery(const QByteArray& data, XmlQuery* query, const bool ret = query->parse(data); if (connection_problems) { - *connection_problems = !ret && query->parseError().enumValue() == - lastfm::ws::MalformedResponse; + *connection_problems = + !ret && + query->parseError().enumValue() == lastfm::ws::MalformedResponse; } return ret; @@ -65,15 +68,13 @@ bool ParseQuery(const QByteArray& data, XmlQuery* query, return false; } #endif // Q_OS_WIN32 - } - catch (lastfm::ws::ParseError e) { + } catch (lastfm::ws::ParseError e) { qLog(Error) << "Last.fm parse error: " << e.enumValue(); if (connection_problems) { *connection_problems = e.enumValue() == lastfm::ws::MalformedResponse; } return false; - } - catch (std::runtime_error& e) { + } catch (std::runtime_error& e) { qLog(Error) << e.what(); return false; } @@ -98,8 +99,7 @@ bool ParseUserList(QNetworkReply* reply, QList* users) { return false; } #endif // Q_OS_WIN32 - } - catch (std::runtime_error& e) { + } catch (std::runtime_error& e) { qLog(Error) << e.what(); return false; } @@ -109,5 +109,5 @@ bool ParseUserList(QNetworkReply* reply, QList* users) { uint ScrobbleTimeMin() { return ScrobblePoint::kScrobbleMinLength; } #endif // HAVE_LIBLASTFM1 -} -} +} // namespace compat +} // namespace lastfm diff --git a/src/internet/lastfmcompat.h b/src/internet/lastfmcompat.h index cdd149be4..3854f2c0f 100644 --- a/src/internet/lastfmcompat.h +++ b/src/internet/lastfmcompat.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2012, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef LASTFMCOMPAT_H -#define LASTFMCOMPAT_H +#ifndef INTERNET_LASTFMCOMPAT_H_ +#define INTERNET_LASTFMCOMPAT_H_ #include "config.h" #include "fixlastfm.h" @@ -58,7 +60,7 @@ typedef lastfm::User AuthenticatedUser; typedef ::ScrobbleCache ScrobbleCache; typedef lastfm::AuthenticatedUser AuthenticatedUser; #endif -} -} +} // namespace compat +} // namespace lastfm -#endif // LASTFMCOMPAT_H +#endif // INTERNET_LASTFMCOMPAT_H_ diff --git a/src/internet/lastfmservice.cpp b/src/internet/lastfmservice.cpp index e3091eb2f..fc286f627 100644 --- a/src/internet/lastfmservice.cpp +++ b/src/internet/lastfmservice.cpp @@ -1,5 +1,12 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2013, David Sansome + Copyright 2010-2012, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2011, Andrea Decorte + Copyright 2012, Arnaud Bienner + Copyright 2012, Kacper "mattrick" Banasik + Copyright 2012, Harald Sitter + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -339,7 +346,7 @@ void LastFMService::NowPlaying(const Song& song) { return; } #else -// TODO: validity was removed from liblastfm1 but might reappear, it should have +// TODO(John Maguire): validity was removed from liblastfm1 but might reappear, it should have // no impact as we get a different error when actually trying to scrobble. #endif diff --git a/src/internet/lastfmservice.h b/src/internet/lastfmservice.h index aae8b8e2b..a5a3fa396 100644 --- a/src/internet/lastfmservice.h +++ b/src/internet/lastfmservice.h @@ -1,5 +1,10 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2013, David Sansome + Copyright 2010-2012, 2014, John Maguire + Copyright 2011, Andrea Decorte + Copyright 2012, Kacper "mattrick" Banasik + Copyright 2012, Harald Sitter + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef LASTFMSERVICE_H -#define LASTFMSERVICE_H +#ifndef INTERNET_LASTFMSERVICE_H_ +#define INTERNET_LASTFMSERVICE_H_ #include @@ -41,7 +46,7 @@ class LastFMService : public Scrobbler { Q_OBJECT public: - LastFMService(Application* app, QObject* parent = nullptr); + explicit LastFMService(Application* app, QObject* parent = nullptr); ~LastFMService(); static const char* kServiceName; @@ -75,7 +80,7 @@ class LastFMService : public Scrobbler { void ShowConfig(); void ToggleScrobbling(); -signals: + signals: void AuthenticationComplete(bool success, const QString& error_message); void ScrobblingEnabledChanged(bool value); void ButtonVisibilityChanged(bool value); @@ -122,4 +127,4 @@ signals: Application* app_; }; -#endif // LASTFMSERVICE_H +#endif // INTERNET_LASTFMSERVICE_H_ diff --git a/src/internet/lastfmsettingspage.cpp b/src/internet/lastfmsettingspage.cpp index 58715669e..8c915676a 100644 --- a/src/internet/lastfmsettingspage.cpp +++ b/src/internet/lastfmsettingspage.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2011, 2013, David Sansome + Copyright 2011, Andrea Decorte + Copyright 2011, 2014, John Maguire + Copyright 2012, Kacper "mattrick" Banasik + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/lastfmsettingspage.h b/src/internet/lastfmsettingspage.h index cf5e12580..31c91b26d 100644 --- a/src/internet/lastfmsettingspage.h +++ b/src/internet/lastfmsettingspage.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2009-2011, 2013, David Sansome + Copyright 2011, Andrea Decorte + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef LASTFMSETTINGSPAGE_H -#define LASTFMSETTINGSPAGE_H +#ifndef INTERNET_LASTFMSETTINGSPAGE_H_ +#define INTERNET_LASTFMSETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -27,7 +30,7 @@ class LastFMSettingsPage : public SettingsPage { Q_OBJECT public: - LastFMSettingsPage(SettingsDialog* dialog); + explicit LastFMSettingsPage(SettingsDialog* dialog); ~LastFMSettingsPage(); void Load(); @@ -47,4 +50,4 @@ class LastFMSettingsPage : public SettingsPage { void RefreshControls(bool authenticated); }; -#endif // LASTFMSETTINGSPAGE_H +#endif // INTERNET_LASTFMSETTINGSPAGE_H_ diff --git a/src/internet/lastfmurlhandler.h b/src/internet/lastfmurlhandler.h index 4cfcb9757..c6b61bf43 100644 --- a/src/internet/lastfmurlhandler.h +++ b/src/internet/lastfmurlhandler.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef LASTFMURLHANDLER_H -#define LASTFMURLHANDLER_H +#ifndef INTERNET_LASTFMURLHANDLER_H_ +#define INTERNET_LASTFMURLHANDLER_H_ #include "core/urlhandler.h" @@ -40,4 +42,4 @@ class LastFMUrlHandler : public UrlHandler { LastFMService* service_; }; -#endif // LASTFMURLHANDLER_H +#endif // INTERNET_LASTFMURLHANDLER_H_ diff --git a/src/internet/localredirectserver.cpp b/src/internet/localredirectserver.cpp index b961385d3..4b787b09d 100644 --- a/src/internet/localredirectserver.cpp +++ b/src/internet/localredirectserver.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "localredirectserver.h" #include diff --git a/src/internet/localredirectserver.h b/src/internet/localredirectserver.h index c919dbbf7..4e27525f9 100644 --- a/src/internet/localredirectserver.h +++ b/src/internet/localredirectserver.h @@ -1,5 +1,23 @@ -#ifndef LOCALREDIRECTSERVER_H -#define LOCALREDIRECTSERVER_H +/* This file is part of Clementine. + Copyright 2012, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_LOCALREDIRECTSERVER_H_ +#define INTERNET_LOCALREDIRECTSERVER_H_ #include #include @@ -10,8 +28,9 @@ class QTcpSocket; class LocalRedirectServer : public QObject { Q_OBJECT + public: - LocalRedirectServer(QObject* parent = nullptr); + explicit LocalRedirectServer(QObject* parent = nullptr); // Causes the server to listen for _one_ request. void Listen(); @@ -22,7 +41,7 @@ class LocalRedirectServer : public QObject { // Returns the URL requested by the OAuth redirect. const QUrl& request_url() const { return request_url_; } -signals: + signals: void Finished(); private slots: @@ -39,4 +58,4 @@ signals: QUrl request_url_; }; -#endif // LOCALREDIRECTSERVER_H +#endif // INTERNET_LOCALREDIRECTSERVER_H_ diff --git a/src/internet/magnatunedownloaddialog.cpp b/src/internet/magnatunedownloaddialog.cpp index 5a171a7af..8e7ab4478 100644 --- a/src/internet/magnatunedownloaddialog.cpp +++ b/src/internet/magnatunedownloaddialog.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, 2012, David Sansome + Copyright 2011-2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -227,7 +229,7 @@ void MagnatuneDownloadDialog::DownloadFinished() { } void MagnatuneDownloadDialog::DownloadProgress(qint64 received, qint64 total) { - int percent = float(received) / total * 100; + int percent = static_cast(received) / total * 100; ui_->albums->topLevelItem(next_row_)->setData(1, Qt::DisplayRole, percent); } diff --git a/src/internet/magnatunedownloaddialog.h b/src/internet/magnatunedownloaddialog.h index 89ecdd3b0..22b4d1dd3 100644 --- a/src/internet/magnatunedownloaddialog.h +++ b/src/internet/magnatunedownloaddialog.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef MAGNATUNEDOWNLOADDIALOG_H -#define MAGNATUNEDOWNLOADDIALOG_H +#ifndef INTERNET_MAGNATUNEDOWNLOADDIALOG_H_ +#define INTERNET_MAGNATUNEDOWNLOADDIALOG_H_ #include @@ -34,13 +36,14 @@ class QXmlStreamReader; class MagnatuneDownloadDialog : public QDialog { Q_OBJECT + public: - MagnatuneDownloadDialog(MagnatuneService* service, QWidget* parent = nullptr); + explicit MagnatuneDownloadDialog(MagnatuneService* service, QWidget* parent = nullptr); ~MagnatuneDownloadDialog(); void Show(const SongList& songs); -signals: + signals: void Finished(const QStringList& albums); public slots: @@ -76,4 +79,4 @@ signals: int next_row_; }; -#endif // MAGNATUNEDOWNLOADDIALOG_H +#endif // INTERNET_MAGNATUNEDOWNLOADDIALOG_H_ diff --git a/src/internet/magnatuneplaylistitem.cpp b/src/internet/magnatuneplaylistitem.cpp index c582517c6..b60027509 100644 --- a/src/internet/magnatuneplaylistitem.cpp +++ b/src/internet/magnatuneplaylistitem.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/magnatuneplaylistitem.h b/src/internet/magnatuneplaylistitem.h index e6b0f3ba2..f2edc3f17 100644 --- a/src/internet/magnatuneplaylistitem.h +++ b/src/internet/magnatuneplaylistitem.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010, John Maguire + Copyright 2010, David Sansome + Copyright 2014, Krzysztof Sobiecki 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,19 +17,19 @@ along with Clementine. If not, see . */ -#ifndef MAGNATUNEPLAYLISTITEM_H -#define MAGNATUNEPLAYLISTITEM_H +#ifndef INTERNET_MAGNATUNEPLAYLISTITEM_H_ +#define INTERNET_MAGNATUNEPLAYLISTITEM_H_ #include "library/libraryplaylistitem.h" class MagnatunePlaylistItem : public LibraryPlaylistItem { public: - MagnatunePlaylistItem(const QString& type); - MagnatunePlaylistItem(const Song& song); + explicit MagnatunePlaylistItem(const QString& type); + explicit MagnatunePlaylistItem(const Song& song); bool InitFromQuery(const SqlRow& query); QUrl Url() const; }; -#endif // MAGNATUNEPLAYLISTITEM_H +#endif // INTERNET_MAGNATUNEPLAYLISTITEM_H_ diff --git a/src/internet/magnatuneservice.cpp b/src/internet/magnatuneservice.cpp index a776eec12..25af13da8 100644 --- a/src/internet/magnatuneservice.cpp +++ b/src/internet/magnatuneservice.cpp @@ -1,5 +1,11 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2013, David Sansome + Copyright 2011, Arnaud Bienner + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2012, 2014, John Maguire + Copyright 2013, Alan Briolat + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -159,7 +165,7 @@ void MagnatuneService::ReloadDatabaseFinished() { load_database_task_id_ = 0; if (reply->error() != QNetworkReply::NoError) { - // TODO: Error handling + // TODO(David Sansome): Error handling qLog(Error) << reply->errorString(); return; } @@ -238,7 +244,7 @@ Song MagnatuneService::ReadTrack(QXmlStreamReader& reader) { return song; } -// TODO: Replace with readElementText(SkipChildElements) in Qt 4.6 +// TODO(David Sansome): Replace with readElementText(SkipChildElements) in Qt 4.6 QString MagnatuneService::ReadElementText(QXmlStreamReader& reader) { int level = 1; QString ret; diff --git a/src/internet/magnatuneservice.h b/src/internet/magnatuneservice.h index 4050d926c..32f9a2789 100644 --- a/src/internet/magnatuneservice.h +++ b/src/internet/magnatuneservice.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef MAGNATUNESERVICE_H -#define MAGNATUNESERVICE_H +#ifndef INTERNET_MAGNATUNESERVICE_H_ +#define INTERNET_MAGNATUNESERVICE_H_ #include @@ -86,7 +88,7 @@ class MagnatuneService : public InternetService { QUrl ModifyUrl(const QUrl& url) const; -signals: + signals: void DownloadFinished(const QStringList& albums); private slots: @@ -127,4 +129,4 @@ signals: QNetworkAccessManager* network_; }; -#endif // MAGNATUNESERVICE_H +#endif // INTERNET_MAGNATUNESERVICE_H_ diff --git a/src/internet/magnatunesettingspage.cpp b/src/internet/magnatunesettingspage.cpp index e87db600a..1118bfca8 100644 --- a/src/internet/magnatunesettingspage.cpp +++ b/src/internet/magnatunesettingspage.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011, Andrea Decorte + Copyright 2011, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/magnatunesettingspage.h b/src/internet/magnatunesettingspage.h index e9231ee8e..31d6b56ca 100644 --- a/src/internet/magnatunesettingspage.h +++ b/src/internet/magnatunesettingspage.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2011, David Sansome + Copyright 2011, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef MAGNATUNESETTINGSPAGE_H -#define MAGNATUNESETTINGSPAGE_H +#ifndef INTERNET_MAGNATUNESETTINGSPAGE_H_ +#define INTERNET_MAGNATUNESETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -29,7 +31,7 @@ class Ui_MagnatuneSettingsPage; class MagnatuneSettingsPage : public SettingsPage { Q_OBJECT public: - MagnatuneSettingsPage(SettingsDialog* dialog); + explicit MagnatuneSettingsPage(SettingsDialog* dialog); ~MagnatuneSettingsPage(); void Load(); @@ -52,4 +54,4 @@ class MagnatuneSettingsPage : public SettingsPage { bool logged_in_; }; -#endif // MAGNATUNESETTINGSPAGE_H +#endif // INTERNET_MAGNATUNESETTINGSPAGE_H_ diff --git a/src/internet/magnatuneurlhandler.cpp b/src/internet/magnatuneurlhandler.cpp index c98ca552b..f281ecb38 100644 --- a/src/internet/magnatuneurlhandler.cpp +++ b/src/internet/magnatuneurlhandler.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/magnatuneurlhandler.h b/src/internet/magnatuneurlhandler.h index e971c05fb..17505c2d1 100644 --- a/src/internet/magnatuneurlhandler.h +++ b/src/internet/magnatuneurlhandler.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef MAGNATUNEURLHANDLER_H -#define MAGNATUNEURLHANDLER_H +#ifndef INTERNET_MAGNATUNEURLHANDLER_H_ +#define INTERNET_MAGNATUNEURLHANDLER_H_ #include "core/urlhandler.h" @@ -34,4 +36,4 @@ class MagnatuneUrlHandler : public UrlHandler { MagnatuneService* service_; }; -#endif // MAGNATUNEURLHANDLER_H +#endif // INTERNET_MAGNATUNEURLHANDLER_H_ diff --git a/src/internet/oauthenticator.cpp b/src/internet/oauthenticator.cpp index d86ade803..ba8dc9144 100644 --- a/src/internet/oauthenticator.cpp +++ b/src/internet/oauthenticator.cpp @@ -1,3 +1,23 @@ +/* This file is part of Clementine. + Copyright 2012-2014, John Maguire + Copyright 2012, 2014, David Sansome + Copyright 2014, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "oauthenticator.h" #include @@ -10,7 +30,8 @@ #include "core/logging.h" #include "internet/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 Param; QList 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 diff --git a/src/internet/oauthenticator.h b/src/internet/oauthenticator.h index 274b0383c..233085d23 100644 --- a/src/internet/oauthenticator.h +++ b/src/internet/oauthenticator.h @@ -1,5 +1,25 @@ -#ifndef OAUTHENTICATOR_H -#define OAUTHENTICATOR_H +/* This file is part of Clementine. + Copyright 2012, David Sansome + Copyright 2012, 2014, John Maguire + Copyright 2014, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_OAUTHENTICATOR_H_ +#define INTERNET_OAUTHENTICATOR_H_ #include #include @@ -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_OAUTHENTICATOR_H_ diff --git a/src/internet/savedradio.cpp b/src/internet/savedradio.cpp index 64ce750ff..dd4d78959 100644 --- a/src/internet/savedradio.cpp +++ b/src/internet/savedradio.cpp @@ -1,5 +1,10 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2014, Arnaud Bienner + Copyright 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/savedradio.h b/src/internet/savedradio.h index d96a5e524..762d09a5c 100644 --- a/src/internet/savedradio.h +++ b/src/internet/savedradio.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2012, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef SAVEDRADIO_H -#define SAVEDRADIO_H +#ifndef INTERNET_SAVEDRADIO_H_ +#define INTERNET_SAVEDRADIO_H_ #include @@ -33,11 +36,13 @@ class SavedRadio : public InternetService { SavedRadio(Application* app, InternetModel* parent); ~SavedRadio(); - enum ItemType { Type_Stream = 2000, }; + enum ItemType { + Type_Stream = 2000, + }; struct Stream { - Stream(const QUrl& url, const QString& name = QString()) - : url_(url), name_(name) {} + explicit Stream(const QUrl& url, const QString& name = QString()) + : url_(url), name_(name) {} // For QList::contains bool operator==(const Stream& other) const { return url_ == other.url_; } @@ -59,7 +64,7 @@ class SavedRadio : public InternetService { StreamList Streams() const { return streams_; } -signals: + signals: void ShowAddStreamDialog(); void StreamsChanged(); @@ -84,4 +89,4 @@ signals: std::unique_ptr edit_dialog_; }; -#endif // SAVEDRADIO_H +#endif // INTERNET_SAVEDRADIO_H_ diff --git a/src/internet/scrobbler.h b/src/internet/scrobbler.h index 9beece9fa..e2c987710 100644 --- a/src/internet/scrobbler.h +++ b/src/internet/scrobbler.h @@ -1,5 +1,23 @@ -#ifndef SCROBBLER_H -#define SCROBBLER_H +/* This file is part of Clementine. + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire + + 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 . +*/ + +#ifndef INTERNET_SCROBBLER_H_ +#define INTERNET_SCROBBLER_H_ #include @@ -9,7 +27,7 @@ class Scrobbler : public QObject { Q_OBJECT public: - Scrobbler(QObject* parent = nullptr) {} + explicit Scrobbler(QObject* parent = nullptr) {} virtual bool IsAuthenticated() const = 0; virtual bool IsScrobblingEnabled() const = 0; @@ -24,7 +42,7 @@ class Scrobbler : public QObject { virtual void ToggleScrobbling() = 0; virtual void ShowConfig() = 0; -signals: + signals: void AuthenticationComplete(bool success, const QString& error_message); void ScrobblingEnabledChanged(bool value); void ButtonVisibilityChanged(bool value); @@ -33,4 +51,4 @@ signals: void ScrobbleError(int value); }; -#endif // SCROBBLER_H +#endif // INTERNET_SCROBBLER_H_ diff --git a/src/internet/seafileservice.cpp b/src/internet/seafileservice.cpp index 7f1672a0d..e5d5d56d1 100644 --- a/src/internet/seafileservice.cpp +++ b/src/internet/seafileservice.cpp @@ -1,3 +1,23 @@ +/* This file is part of Clementine. + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome + Copyright 2014, John Maguire + + 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 . +*/ + #include "seafileservice.h" #include @@ -26,7 +46,7 @@ static const char* kFileUrl = "/api2/repos/%1/file/"; static const char* kFileContentUrl = "/api2/repos/%1/file/detail/"; static const int kMaxTries = 10; -} +} // namespace SeafileService::SeafileService(Application* app, InternetModel* parent) : CloudFileService(app, parent, kServiceName, kSettingsGroup, @@ -212,9 +232,8 @@ void SeafileService::UpdateLibrariesInProgress( SeafileTree::Entry(library.value(), library.key(), SeafileTree::Entry::LIBRARY), "/"); - } // If not, we can destroy the library from the tree - else { + } else { // If the library was not in the tree, it's not a problem because // DeleteEntry won't do anything DeleteEntry(library.key(), "/", @@ -531,8 +550,7 @@ void SeafileService::DeleteEntry(const QString& library, const QString& path, bool SeafileService::CheckReply(QNetworkReply** reply, int tries) { if (!(*reply)) { return false; - } - else if (tries > kMaxTries) { + } else if (tries > kMaxTries) { (*reply)->deleteLater(); return false; } diff --git a/src/internet/seafileservice.h b/src/internet/seafileservice.h index 3cad45d10..ce56c8c4e 100644 --- a/src/internet/seafileservice.h +++ b/src/internet/seafileservice.h @@ -1,3 +1,22 @@ +/* This file is part of Clementine. + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome + + 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 . +*/ + /* Contacts (for explanations, congratulations, insults) : * - * @@ -23,8 +42,8 @@ * - Stop Tagreader when user changes the library */ -#ifndef SEAFILESERVICE_H -#define SEAFILESERVICE_H +#ifndef INTERNET_SEAFILESERVICE_H_ +#define INTERNET_SEAFILESERVICE_H_ #include "cloudfileservice.h" @@ -39,6 +58,7 @@ class QNetworkRequest; // Interface between the seafile server and Clementine class SeafileService : public CloudFileService { Q_OBJECT + public: enum ApiError { NO_ERROR = 200, NOT_FOUND = 404, TOO_MANY_REQUESTS = 429 }; @@ -62,7 +82,7 @@ class SeafileService : public CloudFileService { void Connect(); void ForgetCredentials(); -signals: + signals: void Connected(); // QMap, key : library's id, value : library's name void GetLibrariesFinishedSignal(QMap); @@ -129,4 +149,4 @@ signals: QString library_updated_; }; -#endif // SEAFILESERVICE_H +#endif // INTERNET_SEAFILESERVICE_H_ diff --git a/src/internet/seafilesettingspage.cpp b/src/internet/seafilesettingspage.cpp index e146a1726..df27fbb98 100644 --- a/src/internet/seafilesettingspage.cpp +++ b/src/internet/seafilesettingspage.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/seafilesettingspage.h b/src/internet/seafilesettingspage.h index a0902498d..6ac7c53a0 100644 --- a/src/internet/seafilesettingspage.h +++ b/src/internet/seafilesettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef SEAFILESETTINGSPAGE_H -#define SEAFILESETTINGSPAGE_H +#ifndef INTERNET_SEAFILESETTINGSPAGE_H_ +#define INTERNET_SEAFILESETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -30,7 +31,7 @@ class SeafileSettingsPage : public SettingsPage { Q_OBJECT public: - SeafileSettingsPage(SettingsDialog* dialog); + explicit SeafileSettingsPage(SettingsDialog* dialog); ~SeafileSettingsPage(); void Load(); @@ -47,4 +48,4 @@ class SeafileSettingsPage : public SettingsPage { SeafileService* service_; }; -#endif // SEAFILESETTINGSPAGE_H +#endif // INTERNET_SEAFILESETTINGSPAGE_H_ diff --git a/src/internet/seafiletree.cpp b/src/internet/seafiletree.cpp index 44dc6bdd8..82479e9f4 100644 --- a/src/internet/seafiletree.cpp +++ b/src/internet/seafiletree.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "seafiletree.h" #include @@ -184,9 +202,8 @@ QList> SeafileTree::GetRecursiveFilesOfDir( if (item->entry().is_file()) { files.append(qMakePair(path, item->entry())); - } // Get files of the dir - else { + } else { for (TreeItem* child_item : item->children()) { if (child_item->entry().is_file()) { files.append(qMakePair(path, child_item->entry())); diff --git a/src/internet/seafiletree.h b/src/internet/seafiletree.h index 23dde0538..61e4d1b7b 100644 --- a/src/internet/seafiletree.h +++ b/src/internet/seafiletree.h @@ -1,9 +1,27 @@ +/* This file is part of Clementine. + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + /* Contacts (for explanations, congratulations, insults) : * - */ -#ifndef SEAFILETREE_H -#define SEAFILETREE_H +#ifndef INTERNET_SEAFILETREE_H_ +#define INTERNET_SEAFILETREE_H_ #include #include @@ -30,7 +48,7 @@ class SeafileTree : public QObject { const Type& type = NONE) : name_(name), id_(id), type_(type) {} Entry(const Entry& entry) - : name_(entry.name()), id_(entry.id()), type_(entry.type()) {} + : name_(entry.name()), id_(entry.id()), type_(entry.type()) {} ~Entry(); QString name() const; @@ -72,7 +90,7 @@ class SeafileTree : public QObject { const QList& children = QList()) : entry_(entry), children_(children) {} TreeItem(const TreeItem& copy) - : entry_(copy.entry()), children_(copy.children()) {} + : entry_(copy.entry()), children_(copy.children()) {} ~TreeItem(); TreeItem* child(int i) const; @@ -137,7 +155,7 @@ class SeafileTree : public QObject { // Print the tree in the debug log void Print() const; -signals: + signals: // Entry to delete in the tree void ToDelete(const QString& library, const QString& path, const SeafileTree::Entry& entry); @@ -164,4 +182,4 @@ QDataStream& operator>>(QDataStream& in, SeafileTree::Entry& entry); QDataStream& operator<<(QDataStream& out, SeafileTree::TreeItem* item); QDataStream& operator>>(QDataStream& in, SeafileTree::TreeItem*& item); -#endif // SEAFILETREE_H +#endif // INTERNET_SEAFILETREE_H_ diff --git a/src/internet/seafileurlhandler.cpp b/src/internet/seafileurlhandler.cpp index 31025da48..b2c6f3ed5 100644 --- a/src/internet/seafileurlhandler.cpp +++ b/src/internet/seafileurlhandler.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "seafileurlhandler.h" #include "seafileservice.h" @@ -9,8 +27,8 @@ UrlHandler::LoadResult SeafileUrlHandler::StartLoading(const QUrl& url) { QString file_library_and_path = url.path(); QRegExp reg("/([^/]+)(/.*)$"); - if(reg.indexIn(file_library_and_path) == -1) { - qLog(Debug) << "Can't find repo and file path in " << url; + if (reg.indexIn(file_library_and_path) == -1) { + qLog(Debug) << "Can't find repo and file path in " << url; } QString library = reg.cap(1); diff --git a/src/internet/seafileurlhandler.h b/src/internet/seafileurlhandler.h index e378d8833..9493e763a 100644 --- a/src/internet/seafileurlhandler.h +++ b/src/internet/seafileurlhandler.h @@ -1,5 +1,23 @@ -#ifndef SEAFILEURLHANDLER_H -#define SEAFILEURLHANDLER_H +/* This file is part of Clementine. + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_SEAFILEURLHANDLER_H_ +#define INTERNET_SEAFILEURLHANDLER_H_ #include "core/urlhandler.h" @@ -8,7 +26,7 @@ class SeafileService; class SeafileUrlHandler : public UrlHandler { Q_OBJECT public: - SeafileUrlHandler(SeafileService* service, QObject* parent = nullptr); + explicit SeafileUrlHandler(SeafileService* service, QObject* parent = nullptr); QString scheme() const { return "seafile"; } QIcon icon() const { return QIcon(":/providers/seafile.png"); } @@ -18,4 +36,4 @@ class SeafileUrlHandler : public UrlHandler { SeafileService* service_; }; -#endif // SEAFILEURLHANDLER_H +#endif // INTERNET_SEAFILEURLHANDLER_H_ diff --git a/src/internet/searchboxwidget.cpp b/src/internet/searchboxwidget.cpp index 11fa26344..6d0207df0 100644 --- a/src/internet/searchboxwidget.cpp +++ b/src/internet/searchboxwidget.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, Arnaud Bienner + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Maltsev Vlad Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,9 +61,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) { diff --git a/src/internet/searchboxwidget.h b/src/internet/searchboxwidget.h index 1762eb3f3..a4787a37f 100644 --- a/src/internet/searchboxwidget.h +++ b/src/internet/searchboxwidget.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, Arnaud Bienner + Copyright 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Maltsev Vlad 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 . */ -#ifndef SEARCHBOXWIDGET_H -#define SEARCHBOXWIDGET_H +#ifndef INTERNET_SEARCHBOXWIDGET_H_ +#define INTERNET_SEARCHBOXWIDGET_H_ #include @@ -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_SEARCHBOXWIDGET_H_ diff --git a/src/internet/skydriveservice.cpp b/src/internet/skydriveservice.cpp index d80b2cfae..2126a9f9f 100644 --- a/src/internet/skydriveservice.cpp +++ b/src/internet/skydriveservice.cpp @@ -1,3 +1,22 @@ +/* This file is part of Clementine. + Copyright 2012-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome + + 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 . +*/ + #include "skydriveservice.h" #include diff --git a/src/internet/skydriveservice.h b/src/internet/skydriveservice.h index 5599ee60c..a7f866167 100644 --- a/src/internet/skydriveservice.h +++ b/src/internet/skydriveservice.h @@ -1,5 +1,24 @@ -#ifndef SKYDRIVESERVICE_H -#define SKYDRIVESERVICE_H +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome + + 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 . +*/ + +#ifndef INTERNET_SKYDRIVESERVICE_H_ +#define INTERNET_SKYDRIVESERVICE_H_ #include "cloudfileservice.h" @@ -43,4 +62,4 @@ class SkydriveService : public CloudFileService { QDateTime expiry_time_; }; -#endif // SKYDRIVESERVICE_H +#endif // INTERNET_SKYDRIVESERVICE_H_ diff --git a/src/internet/skydrivesettingspage.cpp b/src/internet/skydrivesettingspage.cpp index e7a6b33c4..20f111687 100644 --- a/src/internet/skydrivesettingspage.cpp +++ b/src/internet/skydrivesettingspage.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/skydrivesettingspage.h b/src/internet/skydrivesettingspage.h index 4b27cc487..2761a94ec 100644 --- a/src/internet/skydrivesettingspage.h +++ b/src/internet/skydrivesettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, John Maguire + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, David Sansome 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 . */ -#ifndef SKYDRIVESETTINGSPAGE_H -#define SKYDRIVESETTINGSPAGE_H +#ifndef INTERNET_SKYDRIVESETTINGSPAGE_H_ +#define INTERNET_SKYDRIVESETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -30,7 +31,7 @@ class SkydriveSettingsPage : public SettingsPage { Q_OBJECT public: - SkydriveSettingsPage(SettingsDialog* parent = nullptr); + explicit SkydriveSettingsPage(SettingsDialog* parent = nullptr); ~SkydriveSettingsPage(); void Load(); @@ -50,4 +51,4 @@ class SkydriveSettingsPage : public SettingsPage { SkydriveService* service_; }; -#endif // SKYDRIVESETTINGSPAGE_H +#endif // INTERNET_SKYDRIVESETTINGSPAGE_H_ diff --git a/src/internet/skydriveurlhandler.cpp b/src/internet/skydriveurlhandler.cpp index ae00ed3d9..faaf189de 100644 --- a/src/internet/skydriveurlhandler.cpp +++ b/src/internet/skydriveurlhandler.cpp @@ -1,3 +1,21 @@ +/* This file is part of Clementine. + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "skydriveurlhandler.h" #include "skydriveservice.h" diff --git a/src/internet/skydriveurlhandler.h b/src/internet/skydriveurlhandler.h index 1e7e61d15..a789a01a7 100644 --- a/src/internet/skydriveurlhandler.h +++ b/src/internet/skydriveurlhandler.h @@ -1,5 +1,23 @@ -#ifndef SKYDRIVEURLHANDLER_H -#define SKYDRIVEURLHANDLER_H +/* This file is part of Clementine. + Copyright 2012, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_SKYDRIVEURLHANDLER_H_ +#define INTERNET_SKYDRIVEURLHANDLER_H_ #include "core/urlhandler.h" @@ -7,8 +25,9 @@ class SkydriveService; class SkydriveUrlHandler : public UrlHandler { Q_OBJECT + public: - SkydriveUrlHandler(SkydriveService* service, QObject* parent = nullptr); + explicit SkydriveUrlHandler(SkydriveService* service, QObject* parent = nullptr); QString scheme() const { return "skydrive"; } QIcon icon() const { return QIcon(":providers/skydrive.png"); } @@ -18,4 +37,4 @@ class SkydriveUrlHandler : public UrlHandler { SkydriveService* service_; }; -#endif // SKYDRIVEURLHANDLER_H +#endif // INTERNET_SKYDRIVEURLHANDLER_H_ diff --git a/src/internet/somafmservice.cpp b/src/internet/somafmservice.cpp index 8d7db7a30..346980078 100644 --- a/src/internet/somafmservice.cpp +++ b/src/internet/somafmservice.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2013, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011, Paweł Bara + Copyright 2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -124,7 +128,7 @@ void SomaFMServiceBase::RefreshStreamsFinished(QNetworkReply* reply, reply->deleteLater(); if (reply->error() != QNetworkReply::NoError) { - // TODO: Error handling + // TODO(David Sansome): Error handling qLog(Error) << reply->errorString(); return; } diff --git a/src/internet/somafmservice.h b/src/internet/somafmservice.h index 9c34e1c89..025a95fe1 100644 --- a/src/internet/somafmservice.h +++ b/src/internet/somafmservice.h @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2010-2013, David Sansome + Copyright 2010, 2014, John Maguire + Copyright 2011, Tyler Rhodes + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef SOMAFMSERVICE_H -#define SOMAFMSERVICE_H +#ifndef INTERNET_SOMAFMSERVICE_H_ +#define INTERNET_SOMAFMSERVICE_H_ #include @@ -39,7 +42,9 @@ class SomaFMServiceBase : public InternetService { const QIcon& icon); ~SomaFMServiceBase(); - enum ItemType { Type_Stream = 2000, }; + enum ItemType { + Type_Stream = 2000, + }; struct Stream { QString title_; @@ -67,7 +72,7 @@ class SomaFMServiceBase : public InternetService { bool IsStreamListStale() const { return streams_.IsStale(); } StreamList Streams(); -signals: + signals: void StreamsChanged(); private slots: @@ -114,4 +119,4 @@ QDataStream& operator<<(QDataStream& out, const SomaFMService::Stream& stream); QDataStream& operator>>(QDataStream& in, SomaFMService::Stream& stream); Q_DECLARE_METATYPE(SomaFMService::Stream) -#endif // SOMAFMSERVICE_H +#endif // INTERNET_SOMAFMSERVICE_H_ diff --git a/src/internet/somafmurlhandler.cpp b/src/internet/somafmurlhandler.cpp index 2e4f1cba7..a0ed32b59 100644 --- a/src/internet/somafmurlhandler.cpp +++ b/src/internet/somafmurlhandler.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011-2013, David Sansome + Copyright 2012, Olaf Christ + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,7 +64,7 @@ void SomaFMUrlHandler::LoadPlaylistFinished() { original_url.setScheme(scheme()); if (reply->error() != QNetworkReply::NoError) { - // TODO: Error handling + // TODO((David Sansome): Error handling qLog(Error) << reply->errorString(); emit AsyncLoadComplete(LoadResult(original_url, LoadResult::NoMoreTracks)); return; diff --git a/src/internet/somafmurlhandler.h b/src/internet/somafmurlhandler.h index e2919393e..82eff48aa 100644 --- a/src/internet/somafmurlhandler.h +++ b/src/internet/somafmurlhandler.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2013, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef SOMAFMURLHANDLER_H -#define SOMAFMURLHANDLER_H +#ifndef INTERNET_SOMAFMURLHANDLER_H_ +#define INTERNET_SOMAFMURLHANDLER_H_ #include "core/urlhandler.h" @@ -44,4 +46,4 @@ class SomaFMUrlHandler : public UrlHandler { int task_id_; }; -#endif // SOMAFMURLHANDLER_H +#endif // INTERNET_SOMAFMURLHANDLER_H_ diff --git a/src/internet/soundcloudservice.cpp b/src/internet/soundcloudservice.cpp index 82cbfce3f..ba8038106 100644 --- a/src/internet/soundcloudservice.cpp +++ b/src/internet/soundcloudservice.cpp @@ -1,5 +1,8 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, 2014, Arnaud Bienner + Copyright 2014, maximko + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -74,7 +77,6 @@ SoundCloudService::SoundCloudService(Application* app, InternetModel* parent) search_box_(new SearchBoxWidget(this)), search_delay_(new QTimer(this)), next_pending_search_id_(0) { - search_delay_->setInterval(kSearchDelayMsec); search_delay_->setSingleShot(true); connect(search_delay_, SIGNAL(timeout()), SLOT(DoSearch())); @@ -119,30 +121,26 @@ void SoundCloudService::EnsureItemsCreated() { InternetModel::Role_PlayBehaviour); root_->appendRow(search_); } - if (!user_tracks_ && !user_activities_ &&!user_playlists_ && IsLoggedIn()) { - user_activities_ = - new QStandardItem(tr("Activities stream")); + if (!user_tracks_ && !user_activities_ && !user_playlists_ && IsLoggedIn()) { + user_activities_ = new QStandardItem(tr("Activities stream")); user_activities_->setData(InternetModel::PlayBehaviour_MultipleItems, - InternetModel::Role_PlayBehaviour); + InternetModel::Role_PlayBehaviour); root_->appendRow(user_activities_); - user_playlists_ = - new QStandardItem(tr("Playlists")); + user_playlists_ = new QStandardItem(tr("Playlists")); root_->appendRow(user_playlists_); - user_tracks_ = - new QStandardItem(tr("Tracks")); + user_tracks_ = new QStandardItem(tr("Tracks")); user_tracks_->setData(InternetModel::PlayBehaviour_MultipleItems, - InternetModel::Role_PlayBehaviour); + InternetModel::Role_PlayBehaviour); root_->appendRow(user_tracks_); - RetrieveUserData(); // at least, try to (this will do nothing if user isn't logged) + RetrieveUserData(); // at least, try to (this will do nothing if user isn't + // logged) } } -QWidget* SoundCloudService::HeaderWidget() const { - return search_box_; -} +QWidget* SoundCloudService::HeaderWidget() const { return search_box_; } void SoundCloudService::ShowConfig() { app_->OpenSettingsDialogAtPage(SettingsDialog::Page_SoundCloud); @@ -154,7 +152,8 @@ void SoundCloudService::Homepage() { void SoundCloudService::Connect() { OAuthenticator* oauth = new OAuthenticator( - kApiClientId, kApiClientSecret, OAuthenticator::RedirectStyle::REMOTE_WITH_STATE, this); + kApiClientId, kApiClientSecret, + OAuthenticator::RedirectStyle::REMOTE_WITH_STATE, this); oauth->StartAuthorisation(kOAuthEndpoint, kOAuthTokenEndpoint, kOAuthScope); @@ -200,12 +199,9 @@ void SoundCloudService::Logout() { access_token_.clear(); s.remove("access_token"); pending_playlists_requests_.clear(); - if (user_activities_) - root_->removeRow(user_activities_->row()); - if (user_tracks_) - root_->removeRow(user_tracks_->row()); - if (user_playlists_) - root_->removeRow(user_playlists_->row()); + if (user_activities_) root_->removeRow(user_activities_->row()); + if (user_tracks_) root_->removeRow(user_tracks_->row()); + if (user_playlists_) root_->removeRow(user_playlists_->row()); user_activities_ = nullptr; user_tracks_ = nullptr; user_playlists_ = nullptr; @@ -261,7 +257,6 @@ void SoundCloudService::RetrieveUserPlaylists() { QNetworkReply* reply = CreateRequest("me/playlists", parameters); NewClosure(reply, SIGNAL(finished()), this, SLOT(UserPlaylistsRetrieved(QNetworkReply*)), reply); - } void SoundCloudService::UserPlaylistsRetrieved(QNetworkReply* reply) { @@ -374,7 +369,6 @@ QStandardItem* SoundCloudService::CreatePlaylistItem(const QString& playlist_nam QNetworkReply* SoundCloudService::CreateRequest(const QString& ressource_name, const QList& params) { - QUrl url(kUrl); url.setPath(ressource_name); @@ -394,7 +388,8 @@ QNetworkReply* SoundCloudService::CreateRequest(const QString& ressource_name, QVariant SoundCloudService::ExtractResult(QNetworkReply* reply) { if (reply->error() != QNetworkReply::NoError) { - qLog(Error) << "Error when retrieving SoundCloud results:" << reply->errorString() << QString(" (%1)").arg(reply->error()); + qLog(Error) << "Error when retrieving SoundCloud results:" + << reply->errorString() << QString(" (%1)").arg(reply->error()); if (reply->error() == QNetworkReply::ContentAccessDenied || reply->error() == QNetworkReply::ContentOperationNotPermittedError || reply->error() == QNetworkReply::ContentNotFoundError || @@ -413,21 +408,22 @@ QVariant SoundCloudService::ExtractResult(QNetworkReply* reply) { return result; } -void SoundCloudService::RetrievePlaylist(int playlist_id, QStandardItem* playlist_item) { +void SoundCloudService::RetrievePlaylist(int playlist_id, + QStandardItem* playlist_item) { const int request_id = next_retrieve_playlist_id_++; - pending_playlists_requests_.insert( - request_id, - PlaylistInfo(playlist_id, playlist_item)); + pending_playlists_requests_.insert(request_id, + PlaylistInfo(playlist_id, playlist_item)); QList parameters; parameters << Param("oauth_token", access_token_); - QNetworkReply* reply = CreateRequest("playlists/" + QString::number(playlist_id), parameters); + QNetworkReply* reply = + CreateRequest("playlists/" + QString::number(playlist_id), parameters); NewClosure(reply, SIGNAL(finished()), this, SLOT(PlaylistRetrieved(QNetworkReply*, int)), reply, request_id); } -void SoundCloudService::PlaylistRetrieved(QNetworkReply* reply, int request_id) { - if (!pending_playlists_requests_.contains(request_id)) - return; +void SoundCloudService::PlaylistRetrieved(QNetworkReply* reply, + int request_id) { + if (!pending_playlists_requests_.contains(request_id)) return; PlaylistInfo playlist_info = pending_playlists_requests_.take(request_id); QVariant res = ExtractResult(reply); SongList songs = ExtractSongs(res.toMap()["tracks"]); diff --git a/src/internet/soundcloudservice.h b/src/internet/soundcloudservice.h index 48fec7ec0..05340c8a3 100644 --- a/src/internet/soundcloudservice.h +++ b/src/internet/soundcloudservice.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2012, David Sansome + Copyright 2012, 2014, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef SOUNDCLOUDSERVICE_H -#define SOUNDCLOUDSERVICE_H +#ifndef INTERNET_SOUNDCLOUDSERVICE_H_ +#define INTERNET_SOUNDCLOUDSERVICE_H_ #include "internetmodel.h" #include "internetservice.h" @@ -30,6 +32,7 @@ class QNetworkReply; class SoundCloudService : public InternetService { Q_OBJECT + public: SoundCloudService(Application* app, InternetModel* parent); ~SoundCloudService(); @@ -38,7 +41,7 @@ class SoundCloudService : public InternetService { QStandardItem* CreateRootItem(); void LazyPopulate(QStandardItem* parent); - // TODO + // TODO(Arnaud Bienner) // QList playlistitem_actions(const Song& song); void ShowContextMenu(const QPoint& global_pos); QWidget* HeaderWidget() const; @@ -75,8 +78,7 @@ class SoundCloudService : public InternetService { private: struct PlaylistInfo { PlaylistInfo() {} - PlaylistInfo(int id, QStandardItem* item) - : id_(id), item_(item) {} + PlaylistInfo(int id, QStandardItem* item) : id_(id), item_(item) {} int id_; QStandardItem* item_; @@ -97,7 +99,7 @@ class SoundCloudService : public InternetService { QStandardItem* CreatePlaylistItem(const QString& playlist_name); QNetworkReply* CreateRequest(const QString& ressource_name, - const QList >& params); + const QList>& params); // Convenient function for extracting result from reply QVariant ExtractResult(QNetworkReply* reply); // Returns items directly, as activities can be playlists or songs @@ -142,4 +144,4 @@ class SoundCloudService : public InternetService { static const char* kApiClientSecret; }; -#endif // SOUNDCLOUDSERVICE_H +#endif // INTERNET_SOUNDCLOUDSERVICE_H_ diff --git a/src/internet/soundcloudsettingspage.cpp b/src/internet/soundcloudsettingspage.cpp index 2813d361b..8b4eb97c9 100644 --- a/src/internet/soundcloudsettingspage.cpp +++ b/src/internet/soundcloudsettingspage.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2014, David Sansome + Copyright 2014, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/soundcloudsettingspage.h b/src/internet/soundcloudsettingspage.h index 568c44b1e..8c8dbb70c 100644 --- a/src/internet/soundcloudsettingspage.h +++ b/src/internet/soundcloudsettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2014, David Sansome + Copyright 2014, Arnaud Bienner + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef SOUNDCLOUDSETTINGSPAGE_H -#define SOUNDCLOUDSETTINGSPAGE_H +#ifndef INTERNET_SOUNDCLOUDSETTINGSPAGE_H_ +#define INTERNET_SOUNDCLOUDSETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -27,7 +28,7 @@ class SoundCloudSettingsPage : public SettingsPage { Q_OBJECT public: - SoundCloudSettingsPage(SettingsDialog* parent = nullptr); + explicit SoundCloudSettingsPage(SettingsDialog* parent = nullptr); ~SoundCloudSettingsPage(); void Load(); @@ -47,4 +48,4 @@ class SoundCloudSettingsPage : public SettingsPage { SoundCloudService* service_; }; -#endif // SOUNDCLOUDSETTINGSPAGE_H +#endif // INTERNET_SOUNDCLOUDSETTINGSPAGE_H_ diff --git a/src/internet/spotifyblobdownloader.cpp b/src/internet/spotifyblobdownloader.cpp index b51c63ef7..dd8604bcf 100644 --- a/src/internet/spotifyblobdownloader.cpp +++ b/src/internet/spotifyblobdownloader.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/spotifyblobdownloader.h b/src/internet/spotifyblobdownloader.h index 974cdff88..b6b64190e 100644 --- a/src/internet/spotifyblobdownloader.h +++ b/src/internet/spotifyblobdownloader.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef SPOTIFYBLOBDOWNLOADER_H -#define SPOTIFYBLOBDOWNLOADER_H +#ifndef INTERNET_SPOTIFYBLOBDOWNLOADER_H_ +#define INTERNET_SPOTIFYBLOBDOWNLOADER_H_ #include @@ -38,7 +40,7 @@ class SpotifyBlobDownloader : public QObject { void Start(); -signals: + signals: void Finished(); private slots: @@ -60,4 +62,4 @@ signals: QProgressDialog* progress_; }; -#endif // SPOTIFYBLOBDOWNLOADER_H +#endif // INTERNET_SPOTIFYBLOBDOWNLOADER_H_ diff --git a/src/internet/spotifyserver.cpp b/src/internet/spotifyserver.cpp index 6e8a54cf0..dd87063dc 100644 --- a/src/internet/spotifyserver.cpp +++ b/src/internet/spotifyserver.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, 2014, John Maguire + Copyright 2011-2012, 2014, David Sansome + Copyright 2014, Arnaud Bienner + Copyright 2014, pie.or.paj + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/spotifyserver.h b/src/internet/spotifyserver.h index f360304cd..0221e308f 100644 --- a/src/internet/spotifyserver.h +++ b/src/internet/spotifyserver.h @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011-2012, 2014, John Maguire + Copyright 2011-2012, 2014, David Sansome + Copyright 2014, Arnaud Bienner + Copyright 2014, pie.or.paj + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef SPOTIFYSERVER_H -#define SPOTIFYSERVER_H +#ifndef INTERNET_SPOTIFYSERVER_H_ +#define INTERNET_SPOTIFYSERVER_H_ #include "spotifymessages.pb.h" #include "core/messagehandler.h" @@ -31,7 +35,7 @@ class SpotifyServer : public AbstractMessageHandler { Q_OBJECT public: - SpotifyServer(QObject* parent = nullptr); + explicit SpotifyServer(QObject* parent = nullptr); void Init(); void Login(const QString& username, const QString& password, @@ -61,7 +65,7 @@ class SpotifyServer : public AbstractMessageHandler { void StartPlayback(const QString& uri, quint16 port); void Seek(qint64 offset_nsec); -signals: + signals: void LoginCompleted(bool success, const QString& error, pb::spotify::LoginResponse_Error error_code); void PlaylistsUpdated(const pb::spotify::Playlists& playlists); @@ -94,4 +98,4 @@ signals: QList queued_messages_; }; -#endif // SPOTIFYSERVER_H +#endif // INTERNET_SPOTIFYSERVER_H_ diff --git a/src/internet/spotifyservice.cpp b/src/internet/spotifyservice.cpp index af19eb8da..78611068f 100644 --- a/src/internet/spotifyservice.cpp +++ b/src/internet/spotifyservice.cpp @@ -1,3 +1,26 @@ +/* This file is part of Clementine. + Copyright 2011-2014, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011-2012, 2014, John Maguire + Copyright 2012, 2014, Arnaud Bienner + Copyright 2014, Chocobozzz + Copyright 2014, pie.or.paj + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "blobversion.h" #include "config.h" #include "internetmodel.h" @@ -761,11 +784,11 @@ void SpotifyService::DropMimeData(const QMimeData* data, const QModelIndex& index) { QVariant q_playlist_index = index.data(Role_UserPlaylistIndex); if (!q_playlist_index.isValid()) { - // In case song was dropped on a playlist item, not on the playlist title/root element + // In case song was dropped on a playlist item, not on the playlist + // title/root element q_playlist_index = index.parent().data(Role_UserPlaylistIndex); } - if (!q_playlist_index.isValid()) - return; + if (!q_playlist_index.isValid()) return; AddSongsToPlaylist(q_playlist_index.toInt(), data->urls()); } diff --git a/src/internet/spotifyservice.h b/src/internet/spotifyservice.h index f94308a4c..5c236f0ef 100644 --- a/src/internet/spotifyservice.h +++ b/src/internet/spotifyservice.h @@ -1,5 +1,26 @@ -#ifndef SPOTIFYSERVICE_H -#define SPOTIFYSERVICE_H +/* This file is part of Clementine. + Copyright 2011, Tyler Rhodes + Copyright 2011-2012, 2014, Arnaud Bienner + Copyright 2011-2012, 2014, John Maguire + Copyright 2011-2012, 2014, David Sansome + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_SPOTIFYSERVICE_H_ +#define INTERNET_SPOTIFYSERVICE_H_ #include "internetmodel.h" #include "internetservice.h" @@ -28,7 +49,9 @@ class SpotifyService : public InternetService { Type_Toplist, }; - enum Role { Role_UserPlaylistIndex = InternetModel::RoleCount, }; + enum Role { + Role_UserPlaylistIndex = InternetModel::RoleCount, + }; // Values are persisted - don't change. enum LoginState { @@ -72,7 +95,7 @@ class SpotifyService : public InternetService { static void SongFromProtobuf(const pb::spotify::Track& track, Song* song); -signals: + signals: void BlobStateChanged(); void LoginFinished(bool success); void ImageLoaded(const QString& id, const QImage& image); @@ -161,4 +184,4 @@ signals: bool volume_normalisation_; }; -#endif +#endif // INTERNET_SPOTIFYSERVICE_H_ diff --git a/src/internet/spotifysettingspage.cpp b/src/internet/spotifysettingspage.cpp index 011457674..480c37ac4 100644 --- a/src/internet/spotifysettingspage.cpp +++ b/src/internet/spotifysettingspage.cpp @@ -1,5 +1,9 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, Tyler Rhodes + Copyright 2011, Andrea Decorte + Copyright 2011-2013, David Sansome + Copyright 2011-2012, 2014, John Maguire + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/spotifysettingspage.h b/src/internet/spotifysettingspage.h index 68ac10c29..6625bfe39 100644 --- a/src/internet/spotifysettingspage.h +++ b/src/internet/spotifysettingspage.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2010, David Sansome + Copyright 2011, David Sansome + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire 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 . */ -#ifndef SPOTIFYSETTINGSPAGE_H -#define SPOTIFYSETTINGSPAGE_H +#ifndef INTERNET_SPOTIFYSETTINGSPAGE_H_ +#define INTERNET_SPOTIFYSETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -28,7 +30,7 @@ class SpotifySettingsPage : public SettingsPage { Q_OBJECT public: - SpotifySettingsPage(SettingsDialog* dialog); + explicit SpotifySettingsPage(SettingsDialog* dialog); ~SpotifySettingsPage(); void Load(); @@ -55,4 +57,4 @@ class SpotifySettingsPage : public SettingsPage { QString original_password_; }; -#endif // SPOTIFYSETTINGSPAGE_H +#endif // INTERNET_SPOTIFYSETTINGSPAGE_H_ diff --git a/src/internet/subsonicservice.cpp b/src/internet/subsonicservice.cpp index afeb437b3..689bba31d 100644 --- a/src/internet/subsonicservice.cpp +++ b/src/internet/subsonicservice.cpp @@ -1,3 +1,25 @@ +/* This file is part of Clementine. + Copyright 2011-2013, Alan Briolat + Copyright 2013, David Sansome + Copyright 2013, Ross Wolfson + Copyright 2013-2014, John Maguire + Copyright 2014, Chocobozzz + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + #include "subsonicservice.h" #include @@ -241,7 +263,7 @@ void SubsonicService::ReloadDatabaseFinished() { void SubsonicService::OnLoginStateChanged( SubsonicService::LoginState newstate) { - // TODO: library refresh logic? + // TODO(Alan Briolat): library refresh logic? } void SubsonicService::OnPingFinished(QNetworkReply* reply) { @@ -422,7 +444,7 @@ void SubsonicLibraryScanner::OnGetAlbumFinished(QNetworkReply* reply) { reader.readNextStartElement(); Q_ASSERT(reader.name() == "subsonic-response"); if (reader.attributes().value("status") != "ok") { - // TODO: error handling + // TODO(Alan Briolat): error handling return; } diff --git a/src/internet/subsonicservice.h b/src/internet/subsonicservice.h index d05d90ab2..50a013a9f 100644 --- a/src/internet/subsonicservice.h +++ b/src/internet/subsonicservice.h @@ -1,5 +1,26 @@ -#ifndef SUBSONICSERVICE_H -#define SUBSONICSERVICE_H +/* This file is part of Clementine. + Copyright 2011-2013, Alan Briolat + Copyright 2013, Ross Wolfson + Copyright 2013, David Sansome + Copyright 2013-2014, John Maguire + Copyright 2014, Krzysztof Sobiecki + + 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 . +*/ + +#ifndef INTERNET_SUBSONICSERVICE_H_ +#define INTERNET_SUBSONICSERVICE_H_ #include @@ -52,9 +73,15 @@ class SubsonicService : public InternetService { ApiError_NotFound = 70, }; - enum Type { Type_Artist = InternetModel::TypeCount, Type_Album, Type_Track, }; + enum Type { + Type_Artist = InternetModel::TypeCount, + Type_Album, + Type_Track, + }; - enum Role { Role_Id = InternetModel::RoleCount, }; + enum Role { + Role_Id = InternetModel::RoleCount, + }; typedef QMap RequestOptions; @@ -92,7 +119,7 @@ class SubsonicService : public InternetService { static const int kMaxRedirects; -signals: + signals: void LoginStateChanged(SubsonicService::LoginState newstate); private: @@ -140,7 +167,7 @@ class SubsonicLibraryScanner : public QObject { Q_OBJECT public: - SubsonicLibraryScanner(SubsonicService* service, QObject* parent = nullptr); + explicit SubsonicLibraryScanner(SubsonicService* service, QObject* parent = nullptr); ~SubsonicLibraryScanner(); void Scan(); @@ -149,7 +176,7 @@ class SubsonicLibraryScanner : public QObject { static const int kAlbumChunkSize; static const int kConcurrentRequests; -signals: + signals: void ScanFinished(); private slots: @@ -169,4 +196,4 @@ signals: SongList songs_; }; -#endif // SUBSONICSERVICE_H +#endif // INTERNET_SUBSONICSERVICE_H_ diff --git a/src/internet/subsonicsettingspage.cpp b/src/internet/subsonicsettingspage.cpp index cafa9d607..970920faf 100644 --- a/src/internet/subsonicsettingspage.cpp +++ b/src/internet/subsonicsettingspage.cpp @@ -1,3 +1,23 @@ +/* This file is part of Clementine. + Copyright 2011, 2013, Alan Briolat + Copyright 2013, Ross Wolfson + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire + + 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 . +*/ + #include "subsonicsettingspage.h" #include "ui_subsonicsettingspage.h" #include "core/logging.h" diff --git a/src/internet/subsonicsettingspage.h b/src/internet/subsonicsettingspage.h index 111f43140..5de4fe7fa 100644 --- a/src/internet/subsonicsettingspage.h +++ b/src/internet/subsonicsettingspage.h @@ -1,5 +1,24 @@ -#ifndef SUBSONICSETTINGSPAGE_H -#define SUBSONICSETTINGSPAGE_H +/* This file is part of Clementine. + Copyright 2011, 2013, Alan Briolat + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire + + 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 . +*/ + +#ifndef INTERNET_SUBSONICSETTINGSPAGE_H_ +#define INTERNET_SUBSONICSETTINGSPAGE_H_ #include "ui/settingspage.h" #include "subsonicservice.h" @@ -10,7 +29,7 @@ class SubsonicSettingsPage : public SettingsPage { Q_OBJECT public: - SubsonicSettingsPage(SettingsDialog* dialog); + explicit SubsonicSettingsPage(SettingsDialog* dialog); ~SubsonicSettingsPage(); void Load(); @@ -29,4 +48,4 @@ class SubsonicSettingsPage : public SettingsPage { SubsonicService* service_; }; -#endif // SUBSONICSETTINGSPAGE_H +#endif // INTERNET_SUBSONICSETTINGSPAGE_H_ diff --git a/src/internet/subsonicurlhandler.cpp b/src/internet/subsonicurlhandler.cpp index ba348868a..d133f291c 100644 --- a/src/internet/subsonicurlhandler.cpp +++ b/src/internet/subsonicurlhandler.cpp @@ -1,3 +1,22 @@ +/* This file is part of Clementine. + Copyright 2012-2013, Alan Briolat + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire + + 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 . +*/ + #include "subsonicservice.h" #include "subsonicurlhandler.h" diff --git a/src/internet/subsonicurlhandler.h b/src/internet/subsonicurlhandler.h index 0b5117d5c..8ad2100d8 100644 --- a/src/internet/subsonicurlhandler.h +++ b/src/internet/subsonicurlhandler.h @@ -1,5 +1,24 @@ -#ifndef SUBSONICURLHANDLER_H -#define SUBSONICURLHANDLER_H +/* This file is part of Clementine. + Copyright 2012-2013, Alan Briolat + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, John Maguire + + 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 . +*/ + +#ifndef INTERNET_SUBSONICURLHANDLER_H_ +#define INTERNET_SUBSONICURLHANDLER_H_ #include "core/urlhandler.h" @@ -20,4 +39,4 @@ class SubsonicUrlHandler : public UrlHandler { SubsonicService* service_; }; -#endif // SUBSONICURLHANDLER_H +#endif // INTERNET_SUBSONICURLHANDLER_H_ diff --git a/src/internet/vkconnection.cpp b/src/internet/vkconnection.cpp index a3bf55d33..46523cfbb 100644 --- a/src/internet/vkconnection.cpp +++ b/src/internet/vkconnection.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. Copyright 2014, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Ivan Leontiev Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/vkconnection.h b/src/internet/vkconnection.h index 1ce81e7fb..e2cac5622 100644 --- a/src/internet/vkconnection.h +++ b/src/internet/vkconnection.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2014, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Maltsev Vlad 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 . */ -#ifndef VKCONNECTION_H -#define VKCONNECTION_H +#ifndef INTERNET_VKCONNECTION_H_ +#define INTERNET_VKCONNECTION_H_ #include "vreen/client.h" #include "vreen/connection.h" @@ -28,32 +29,27 @@ class VkConnection : public Vreen::Connection { Q_ENUMS(DisplayType) Q_FLAGS(Scopes) -public: - enum DisplayType { - Page, - Popup, - Touch, - Wap - }; + public: + enum DisplayType { Page, Popup, Touch, Wap }; enum Scope { - Notify = 0x1, - Friends = 0x2, - Photos = 0x4, - Audio = 0x8, - Video = 0x10, - Docs = 0x20, - Notes = 0x40, - Pages = 0x80, - Status = 0x100, - Offers = 0x200, - Questions = 0x400, - Wall = 0x800, - Groups = 0x1000, - Messages = 0x2000, + Notify = 0x1, + Friends = 0x2, + Photos = 0x4, + Audio = 0x8, + Video = 0x10, + Docs = 0x20, + Notes = 0x40, + Pages = 0x80, + Status = 0x100, + Offers = 0x200, + Questions = 0x400, + Wall = 0x800, + Groups = 0x1000, + Messages = 0x2000, Notifications = 0x4000, - Stats = 0x8000, - Ads = 0x10000, - Offline = 0x20000 + Stats = 0x8000, + Ads = 0x10000, + Offline = 0x20000 }; Q_DECLARE_FLAGS(Scopes, Scope) @@ -67,16 +63,16 @@ public: void clear(); bool hasAccount(); -protected: + protected: QNetworkRequest makeRequest(const QString& method, const QVariantMap& args = QVariantMap()); void decorateRequest(QNetworkRequest& request); -private slots: + private slots: void codeRecived(LocalRedirectServer* server, QUrl redirect_uri); void accessTokenRecived(QNetworkReply* reply); -private: + private: void requestAccessToken(); void setConnectionState(Vreen::Client::State state); void saveToken(); @@ -91,4 +87,4 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(VkConnection::Scopes) -#endif // VKCONNECTION_H +#endif // INTERNET_VKCONNECTION_H_ diff --git a/src/internet/vkmusiccache.cpp b/src/internet/vkmusiccache.cpp index 8a93430fe..541db2b16 100644 --- a/src/internet/vkmusiccache.cpp +++ b/src/internet/vkmusiccache.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Maltsev Vlad + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/vkmusiccache.h b/src/internet/vkmusiccache.h index 11b02a385..71567ab10 100644 --- a/src/internet/vkmusiccache.h +++ b/src/internet/vkmusiccache.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Maltsev Vlad + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef VKMUSICCACHE_H -#define VKMUSICCACHE_H +#ifndef INTERNET_VKMUSICCACHE_H_ +#define INTERNET_VKMUSICCACHE_H_ #include #include @@ -75,4 +76,4 @@ class VkMusicCache : public QObject { QNetworkReply* reply_; }; -#endif // VKMUSICCACHE_H +#endif // INTERNET_VKMUSICCACHE_H_ diff --git a/src/internet/vksearchdialog.cpp b/src/internet/vksearchdialog.cpp index 19533156b..0f99b5385 100644 --- a/src/internet/vksearchdialog.cpp +++ b/src/internet/vksearchdialog.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Maltsev Vlad 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,10 +25,10 @@ #include "ui_vksearchdialog.h" VkSearchDialog::VkSearchDialog(VkService* service, QWidget* parent) - : QDialog(parent), - ui(new Ui::VkSearchDialog), - service_(service), - last_search_(SearchID(SearchID::UserOrGroup)) { + : QDialog(parent), + ui(new Ui::VkSearchDialog), + service_(service), + last_search_(SearchID(SearchID::UserOrGroup)) { ui->setupUi(this); timer = new QTimer(this); @@ -53,12 +54,11 @@ VkSearchDialog::VkSearchDialog(VkService* service, QWidget* parent) popup->setFocusPolicy(Qt::NoFocus); popup->setFocusProxy(parent); - connect(popup, SIGNAL(itemSelectionChanged()), - SLOT(selectionChanged())); - connect(popup, SIGNAL(clicked(QModelIndex)), - SLOT(selected())); + connect(popup, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged())); + connect(popup, SIGNAL(clicked(QModelIndex)), SLOT(selected())); - connect(this, SIGNAL(Find(QString)), service_, SLOT(FindUserOrGroup(QString))); + connect(this, SIGNAL(Find(QString)), service_, + SLOT(FindUserOrGroup(QString))); connect(service_, SIGNAL(UserOrGroupSearchResult(SearchID, MusicOwnerList)), this, SLOT(ReceiveResults(SearchID, MusicOwnerList))); @@ -70,9 +70,7 @@ VkSearchDialog::~VkSearchDialog() { delete popup; } -void VkSearchDialog::suggest() { - emit Find(ui->searchLine->text()); -} +void VkSearchDialog::suggest() { emit Find(ui->searchLine->text()); } void VkSearchDialog::selected() { selectionChanged(); @@ -81,13 +79,14 @@ void VkSearchDialog::selected() { popup->hide(); } -void VkSearchDialog::ReceiveResults(const SearchID& id, const MusicOwnerList& owners) { +void VkSearchDialog::ReceiveResults(const SearchID& id, + const MusicOwnerList& owners) { if (id.id() > last_search_.id()) { popup->setUpdatesEnabled(false); popup->clear(); if (owners.count() > 0) { - for (const MusicOwner &own : owners) { + for (const MusicOwner& own : owners) { popup->addTopLevelItem(createItem(own)); } } else { @@ -98,8 +97,8 @@ void VkSearchDialog::ReceiveResults(const SearchID& id, const MusicOwnerList& ow popup->resizeColumnToContents(0); int ch = popup->columnWidth(0); - if (ch > 0.8*ui->searchLine->width()) { - popup->setColumnWidth(0, qRound(0.8*ui->searchLine->width())); + if (ch > 0.8 * ui->searchLine->width()) { + popup->setColumnWidth(0, qRound(0.8 * ui->searchLine->width())); } popup->resizeColumnToContents(1); popup->adjustSize(); @@ -151,29 +150,29 @@ bool VkSearchDialog::eventFilter(QObject* obj, QEvent* ev) { int key = static_cast(ev)->key(); switch (key) { - case Qt::Key_Enter: - case Qt::Key_Return: - selected(); - break; + case Qt::Key_Enter: + case Qt::Key_Return: + selected(); + break; - case Qt::Key_Escape: - ui->searchLine->setFocus(); - popup->hide(); - consumed = true; - break; + case Qt::Key_Escape: + ui->searchLine->setFocus(); + popup->hide(); + consumed = true; + break; - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Home: - case Qt::Key_End: - case Qt::Key_PageUp: - case Qt::Key_PageDown: - break; + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_PageUp: + case Qt::Key_PageDown: + break; - default: - ui->searchLine->setFocus(); - ui->searchLine->event(ev); - break; + default: + ui->searchLine->setFocus(); + ui->searchLine->event(ev); + break; } return consumed; diff --git a/src/internet/vksearchdialog.h b/src/internet/vksearchdialog.h index cff826ff7..f2d142790 100644 --- a/src/internet/vksearchdialog.h +++ b/src/internet/vksearchdialog.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Maltsev Vlad 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 . */ -#ifndef VKSEARCHDIALOG_H -#define VKSEARCHDIALOG_H +#ifndef INTERNET_VKSEARCHDIALOG_H_ +#define INTERNET_VKSEARCHDIALOG_H_ #include #include @@ -31,26 +32,26 @@ class VkSearchDialog; class VkSearchDialog : public QDialog { Q_OBJECT -public: + public: explicit VkSearchDialog(VkService* service, QWidget* parent = 0); ~VkSearchDialog(); MusicOwner found() const; -signals: + signals: void Find(const QString& query); -public slots: + public slots: void ReceiveResults(const SearchID& id, const MusicOwnerList& owners); -protected: + protected: void showEvent(QShowEvent*); -private slots: + private slots: void selectionChanged(); void suggest(); void selected(); -private: + private: bool eventFilter(QObject* obj, QEvent* ev); QTreeWidgetItem* createItem(const MusicOwner& own); @@ -62,4 +63,4 @@ private: QTimer* timer; }; -#endif // VKSEARCHDIALOG_H +#endif // INTERNET_VKSEARCHDIALOG_H_ diff --git a/src/internet/vkservice.cpp b/src/internet/vkservice.cpp index d80f4e035..1471cf1b1 100644 --- a/src/internet/vkservice.cpp +++ b/src/internet/vkservice.cpp @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Ivan Leontiev Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -816,7 +818,7 @@ QStandardItem* VkService::AppendAlbumList(QStandardItem* parent, bool myself) { if (myself) { item = new QStandardItem(QIcon(":vk/discography.png"), tr("My Albums")); - // TODO: Do this better. We have incomplete MusicOwner instance + // TODO(Ivan Leontiev): Do this better. We have incomplete MusicOwner instance // for logged in user. owner.setId(UserID()); my_albums_item_ = item; @@ -874,7 +876,7 @@ QStandardItem* VkService::AppendMusic(QStandardItem* parent, bool myself) { if (myself) { item = new QStandardItem(QIcon(":vk/my_music.png"), tr("My Music")); - // TODO: Do this better. We have incomplete MusicOwner instance + // TODO(Ivan Leontiev): Do this better. We have incomplete MusicOwner instance // for logged in user. owner.setId(UserID()); my_music_item_ = item; diff --git a/src/internet/vkservice.h b/src/internet/vkservice.h index 7bbdc2bf5..9c8566d5e 100644 --- a/src/internet/vkservice.h +++ b/src/internet/vkservice.h @@ -1,5 +1,7 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Ivan Leontiev 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 . */ -#ifndef VKSERVICE_H -#define VKSERVICE_H +#ifndef INTERNET_VKSERVICE_H_ +#define INTERNET_VKSERVICE_H_ #include @@ -179,7 +181,7 @@ class VkService : public InternetService { QString cacheFilename() const { return cacheFilename_; } bool isLoveAddToMyMusic() const { return love_is_add_to_mymusic_; } -signals: + signals: void NameUpdated(const QString& name); void ConnectionStateChanged(Vreen::Client::State state); void LoginSuccess(bool success); @@ -318,4 +320,4 @@ signals: QString cacheFilename_; }; -#endif // VKSERVICE_H +#endif // INTERNET_VKSERVICE_H_ diff --git a/src/internet/vksettingspage.cpp b/src/internet/vksettingspage.cpp index 2d48a1d9a..fd31087ae 100644 --- a/src/internet/vksettingspage.cpp +++ b/src/internet/vksettingspage.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Maltsev Vlad + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/vksettingspage.h b/src/internet/vksettingspage.h index 3090ab2db..5d867db9d 100644 --- a/src/internet/vksettingspage.h +++ b/src/internet/vksettingspage.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Krzysztof Sobiecki + Copyright 2014, Maltsev Vlad 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 . */ -#ifndef VKSETTINGSPAGE_H -#define VKSETTINGSPAGE_H +#ifndef INTERNET_VKSETTINGSPAGE_H_ +#define INTERNET_VKSETTINGSPAGE_H_ #include "ui/settingspage.h" @@ -29,14 +30,14 @@ class Ui_VkSettingsPage; class VkSettingsPage : public SettingsPage { Q_OBJECT -public: + public: explicit VkSettingsPage(SettingsDialog* parent); ~VkSettingsPage(); void Load(); void Save(); -private slots: + private slots: void LoginSuccess(bool success); void Login(); @@ -45,11 +46,11 @@ private slots: void CacheDirBrowse(); void ResetCasheFilenames(); -private: + private: void LoginWidgets(); void LogoutWidgets(); Ui_VkSettingsPage* ui_; VkService* service_; }; -#endif // VKSETTINGSPAGE_H +#endif // INTERNET_VKSETTINGSPAGE_H_ diff --git a/src/internet/vkurlhandler.cpp b/src/internet/vkurlhandler.cpp index 5368897d2..17ade9ed4 100644 --- a/src/internet/vkurlhandler.cpp +++ b/src/internet/vkurlhandler.cpp @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Maltsev Vlad + Copyright 2014, Krzysztof Sobiecki Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/internet/vkurlhandler.h b/src/internet/vkurlhandler.h index e25d25d26..11bcd88d3 100644 --- a/src/internet/vkurlhandler.h +++ b/src/internet/vkurlhandler.h @@ -1,5 +1,6 @@ /* This file is part of Clementine. - Copyright 2013, Vlad Maltsev + Copyright 2014, Maltsev Vlad + Copyright 2014, Krzysztof Sobiecki 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 . */ -#ifndef VKURLHANDLER_H -#define VKURLHANDLER_H +#ifndef INTERNET_VKURLHANDLER_H_ +#define INTERNET_VKURLHANDLER_H_ #include "core/urlhandler.h" #include @@ -40,4 +41,4 @@ class VkUrlHandler : public UrlHandler { VkService* service_; }; -#endif // VKURLHANDLER_H +#endif // INTERNET_VKURLHANDLER_H_