Merge branch 'coding_style_fixes_and_c++11' of https://github.com/sobkas/Clementine into sobkas-coding_style_fixes_and_c++11

Conflicts:
	src/podcasts/addpodcastbyurl.cpp
	src/podcasts/gpoddersync.cpp
	src/podcasts/podcastinfowidget.cpp
	src/podcasts/podcastupdater.cpp
This commit is contained in:
John Maguire 2014-02-10 15:55:42 +01:00
commit fd183a80ff
28 changed files with 1155 additions and 417 deletions

1379
dist/cpplint.py vendored

File diff suppressed because it is too large Load Diff

2
dist/cpplint.py.README vendored Normal file
View File

@ -0,0 +1,2 @@
While using cpplint.py use the following options:
--root=src

7
dist/cpplint.sh vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
dire=$1
if [ x$dire == "x" ];then
dire="src"
fi
find $dire -regex '.*\.\(h\|cpp\|mm\)' -type f -exec ./dist/cpplint.py --root=src {} 2>&1 \;

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADDPODCASTBYURL_H
#define ADDPODCASTBYURL_H
#ifndef PODCASTS_ADDPODCASTBYURL_H_
#define PODCASTS_ADDPODCASTBYURL_H_
#include "addpodcastpage.h"
@ -32,7 +32,7 @@ class AddPodcastByUrl : public AddPodcastPage {
Q_OBJECT
public:
AddPodcastByUrl(Application* app, QWidget* parent = 0);
AddPodcastByUrl(Application* app, QWidget* parent = nullptr);
~AddPodcastByUrl();
void Show();
@ -49,4 +49,4 @@ class AddPodcastByUrl : public AddPodcastPage {
PodcastUrlLoader* loader_;
};
#endif // ADDPODCASTBYURL_H
#endif // PODCASTS_ADDPODCASTBYURL_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADDPODCASTDIALOG_H
#define ADDPODCASTDIALOG_H
#ifndef PODCASTS_ADDPODCASTDIALOG_H_
#define PODCASTS_ADDPODCASTDIALOG_H_
#include "podcast.h"
@ -35,7 +35,7 @@ class AddPodcastDialog : public QDialog {
Q_OBJECT
public:
AddPodcastDialog(Application* app, QWidget* parent = 0);
AddPodcastDialog(Application* app, QWidget* parent = nullptr);
~AddPodcastDialog();
static const char* kBbcOpmlUrl;
@ -82,4 +82,4 @@ class AddPodcastDialog : public QDialog {
QString last_opml_path_;
};
#endif // ADDPODCASTDIALOG_H
#endif // PODCASTS_ADDPODCASTDIALOG_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADDPODCASTPAGE_H
#define ADDPODCASTPAGE_H
#ifndef PODCASTS_ADDPODCASTPAGE_H_
#define PODCASTS_ADDPODCASTPAGE_H_
#include <QWidget>
@ -27,14 +27,14 @@ class AddPodcastPage : public QWidget {
Q_OBJECT
public:
AddPodcastPage(Application* app, QWidget* parent = 0);
AddPodcastPage(Application* app, QWidget* parent = nullptr);
PodcastDiscoveryModel* model() const { return model_; }
virtual bool has_visible_widget() const { return true; }
virtual void Show() {}
signals:
signals:
void Busy(bool busy);
protected:
@ -44,4 +44,4 @@ signals:
PodcastDiscoveryModel* model_;
};
#endif // ADDPODCASTPAGE_H
#endif // PODCASTS_ADDPODCASTPAGE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FIXEDOPMLPAGE_H
#define FIXEDOPMLPAGE_H
#ifndef PODCASTS_FIXEDOPMLPAGE_H_
#define PODCASTS_FIXEDOPMLPAGE_H_
#include "addpodcastpage.h"
@ -30,7 +30,7 @@ class FixedOpmlPage : public AddPodcastPage {
public:
FixedOpmlPage(const QUrl& opml_url, const QString& title, const QIcon& icon,
Application* app, QWidget* parent = 0);
Application* app, QWidget* parent = nullptr);
bool has_visible_widget() const { return false; }
void Show();
@ -45,4 +45,4 @@ class FixedOpmlPage : public AddPodcastPage {
bool done_initial_load_;
};
#endif // FIXEDOPMLPAGE_H
#endif // PODCASTS_FIXEDOPMLPAGE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPODDERSEARCHPAGE_H
#define GPODDERSEARCHPAGE_H
#ifndef PODCASTS_GPODDERSEARCHPAGE_H_
#define PODCASTS_GPODDERSEARCHPAGE_H_
#include "addpodcastpage.h"
@ -30,7 +30,7 @@ class GPodderSearchPage : public AddPodcastPage {
Q_OBJECT
public:
GPodderSearchPage(Application* app, QWidget* parent = 0);
GPodderSearchPage(Application* app, QWidget* parent = nullptr);
~GPodderSearchPage();
void Show();
@ -47,4 +47,4 @@ class GPodderSearchPage : public AddPodcastPage {
mygpo::ApiRequest* api_;
};
#endif // GPODDERSEARCHPAGE_H
#endif // PODCASTS_GPODDERSEARCHPAGE_H_

View File

@ -284,7 +284,7 @@ void WriteContainer(const T& container, QSettings* s, const char* array_name,
const char* item_name) {
s->beginWriteArray(array_name, container.count());
int index = 0;
for (const typename T::value_type& item : container) {
for (const auto& item : container) {
s->setArrayIndex(index++);
s->setValue(item_name, item);
}
@ -302,7 +302,7 @@ void ReadContainer(T* container, QSettings* s, const char* array_name,
}
s->endArray();
}
}
} // namespace
void GPodderSync::SaveQueue() {
QSettings s;

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPODDERSYNC_H
#define GPODDERSYNC_H
#ifndef PODCASTS_GPODDERSYNC_H_
#define PODCASTS_GPODDERSYNC_H_
#include "podcastepisode.h"
@ -43,7 +43,7 @@ class GPodderSync : public QObject {
Q_OBJECT
public:
GPodderSync(Application* app, QObject* parent = 0);
GPodderSync(Application* app, QObject* parent = nullptr);
~GPodderSync();
static const char* kSettingsGroup;
@ -115,4 +115,4 @@ class GPodderSync : public QObject {
bool flushing_queue_;
};
#endif // GPODDERSYNC_H
#endif // PODCASTS_GPODDERSYNC_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPODDERTOPTAGSMODEL_H
#define GPODDERTOPTAGSMODEL_H
#ifndef PODCASTS_GPODDERTOPTAGSMODEL_H_
#define PODCASTS_GPODDERTOPTAGSMODEL_H_
#include "podcastdiscoverymodel.h"
@ -30,7 +30,7 @@ class GPodderTopTagsModel : public PodcastDiscoveryModel {
public:
GPodderTopTagsModel(mygpo::ApiRequest* api, Application* app,
QObject* parent = 0);
QObject* parent = nullptr);
enum Role {
Role_HasLazyLoaded = PodcastDiscoveryModel::RoleCount,
@ -50,4 +50,4 @@ class GPodderTopTagsModel : public PodcastDiscoveryModel {
mygpo::ApiRequest* api_;
};
#endif // GPODDERTOPTAGSMODEL_H
#endif // PODCASTS_GPODDERTOPTAGSMODEL_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPODDERTOPTAGSPAGE_H
#define GPODDERTOPTAGSPAGE_H
#ifndef PODCASTS_GPODDERTOPTAGSPAGE_H_
#define PODCASTS_GPODDERTOPTAGSPAGE_H_
#include <QScopedPointer>
@ -30,7 +30,7 @@ class GPodderTopTagsPage : public AddPodcastPage {
Q_OBJECT
public:
GPodderTopTagsPage(Application* app, QWidget* parent = 0);
GPodderTopTagsPage(Application* app, QWidget* parent = nullptr);
~GPodderTopTagsPage();
static const int kMaxTagCount;
@ -49,4 +49,4 @@ class GPodderTopTagsPage : public AddPodcastPage {
bool done_initial_load_;
};
#endif // GPODDERTOPTAGSPAGE_H
#endif // PODCASTS_GPODDERTOPTAGSPAGE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ITUNESSEARCHPAGE_H
#define ITUNESSEARCHPAGE_H
#ifndef PODCASTS_ITUNESSEARCHPAGE_H_
#define PODCASTS_ITUNESSEARCHPAGE_H_
#include "addpodcastpage.h"
@ -46,4 +46,4 @@ class ITunesSearchPage : public AddPodcastPage {
QNetworkAccessManager* network_;
};
#endif // ITUNESSEARCHPAGE_H
#endif // PODCASTS_ITUNESSEARCHPAGE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPMLCONTAINER_H
#define OPMLCONTAINER_H
#ifndef PODCASTS_OPMLCONTAINER_H_
#define PODCASTS_OPMLCONTAINER_H_
#include "podcast.h"
@ -32,4 +32,4 @@ class OpmlContainer {
Q_DECLARE_METATYPE(OpmlContainer)
#endif // OPMLCONTAINER_H
#endif // PODCASTS_OPMLCONTAINER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCAST_H
#define PODCAST_H
#ifndef PODCASTS_PODCAST_H_
#define PODCASTS_PODCAST_H_
#include "podcastepisode.h"
@ -107,4 +107,4 @@ Q_DECLARE_METATYPE(Podcast)
typedef QList<Podcast> PodcastList;
Q_DECLARE_METATYPE(QList<Podcast>)
#endif // PODCAST_H
#endif // PODCASTS_PODCAST_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTBACKEND_H
#define PODCASTBACKEND_H
#ifndef PODCASTS_PODCASTBACKEND_H_
#define PODCASTS_PODCASTBACKEND_H_
#include <QObject>
@ -29,7 +29,7 @@ class PodcastBackend : public QObject {
Q_OBJECT
public:
PodcastBackend(Application* app, QObject* parent = 0);
PodcastBackend(Application* app, QObject* parent = nullptr);
// Adds the podcast and any included Episodes to the database. Updates the
// podcast with a database ID. If this podcast already has an ID set, this
@ -70,7 +70,7 @@ class PodcastBackend : public QObject {
// local_url) on episodes that must already exist in the database.
void UpdateEpisodes(const PodcastEpisodeList& episodes);
signals:
signals:
void SubscriptionAdded(const Podcast& podcast);
void SubscriptionRemoved(const Podcast& podcast);
@ -90,4 +90,4 @@ signals:
Database* db_;
};
#endif // PODCASTBACKEND_H
#endif // PODCASTS_PODCASTBACKEND_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTDISCOVERYMODEL_H
#define PODCASTDISCOVERYMODEL_H
#ifndef PODCASTS_PODCASTDISCOVERYMODEL_H_
#define PODCASTS_PODCASTDISCOVERYMODEL_H_
#include "covers/albumcoverloaderoptions.h"
@ -32,7 +32,7 @@ class PodcastDiscoveryModel : public QStandardItemModel {
Q_OBJECT
public:
PodcastDiscoveryModel(Application* app, QObject* parent = 0);
PodcastDiscoveryModel(Application* app, QObject* parent = nullptr);
enum Type { Type_Folder, Type_Podcast, Type_LoadingIndicator };
@ -64,4 +64,4 @@ class PodcastDiscoveryModel : public QStandardItemModel {
QIcon folder_icon_;
};
#endif // PODCASTDISCOVERYMODEL_H
#endif // PODCASTS_PODCASTDISCOVERYMODEL_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTDOWNLOADER_H
#define PODCASTDOWNLOADER_H
#ifndef PODCASTS_PODCASTDOWNLOADER_H_
#define PODCASTS_PODCASTDOWNLOADER_H_
#include "podcast.h"
#include "podcastepisode.h"
@ -42,7 +42,7 @@ class PodcastDownloader : public QObject {
Q_OBJECT
public:
PodcastDownloader(Application* app, QObject* parent = 0);
PodcastDownloader(Application* app, QObject* parent = nullptr);
enum State { NotDownloading, Queued, Downloading, Finished };
@ -58,7 +58,7 @@ class PodcastDownloader : public QObject {
// Deletes downloaded data for this episode
void DeleteEpisode(const PodcastEpisode& episode);
signals:
signals:
void ProgressChanged(const PodcastEpisode& episode,
PodcastDownloader::State state, int percent);
@ -105,4 +105,4 @@ signals:
QTimer* auto_delete_timer_;
};
#endif // PODCASTDOWNLOADER_H
#endif // PODCASTS_PODCASTDOWNLOADER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTEPISODE_H
#define PODCASTEPISODE_H
#ifndef PODCASTS_PODCASTEPISODE_H_
#define PODCASTS_PODCASTEPISODE_H_
#include "core/song.h"
@ -87,4 +87,4 @@ Q_DECLARE_METATYPE(PodcastEpisode)
typedef QList<PodcastEpisode> PodcastEpisodeList;
Q_DECLARE_METATYPE(QList<PodcastEpisode>)
#endif // PODCASTEPISODE_H
#endif // PODCASTS_PODCASTEPISODE_H_

View File

@ -67,7 +67,7 @@ void SetText(const QString& value, T* label, QLabel* buddy_label = nullptr) {
label->setText(value);
}
}
}
} // namespace
void PodcastInfoWidget::SetPodcast(const Podcast& podcast) {
if (image_id_) {

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTINFOWIDGET_H
#define PODCASTINFOWIDGET_H
#ifndef PODCASTS_PODCASTINFOWIDGET_H_
#define PODCASTS_PODCASTINFOWIDGET_H_
#include "podcast.h"
#include "covers/albumcoverloaderoptions.h"
@ -32,14 +32,14 @@ class PodcastInfoWidget : public QWidget {
Q_OBJECT
public:
PodcastInfoWidget(QWidget* parent = 0);
explicit PodcastInfoWidget(QWidget* parent = nullptr);
~PodcastInfoWidget();
void SetApplication(Application* app);
void SetPodcast(const Podcast& podcast);
signals:
signals:
void LoadingFinished();
private slots:
@ -55,4 +55,4 @@ signals:
quint64 image_id_;
};
#endif // PODCASTINFOWIDGET_H
#endif // PODCASTS_PODCASTINFOWIDGET_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTPARSER_H
#define PODCASTPARSER_H
#ifndef PODCASTS_PODCASTPARSER_H_
#define PODCASTS_PODCASTPARSER_H_
#include <QStringList>
@ -64,4 +64,4 @@ class PodcastParser {
QStringList supported_mime_types_;
};
#endif // PODCASTPARSER_H
#endif // PODCASTS_PODCASTPARSER_H_

View File

@ -43,7 +43,7 @@ const char* PodcastService::kSettingsGroup = "Podcasts";
class PodcastSortProxyModel : public QSortFilterProxyModel {
public:
PodcastSortProxyModel(QObject* parent = nullptr);
explicit PodcastSortProxyModel(QObject* parent = nullptr);
protected:
bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
@ -464,7 +464,7 @@ void PodcastService::ReloadSettings() {
s.beginGroup(LibraryView::kSettingsGroup);
use_pretty_covers_ = s.value("pretty_covers", true).toBool();
// TODO: reload the podcast icons that are already loaded?
// TODO(notme): reload the podcast icons that are already loaded?
}
void PodcastService::EnsureAddPodcastDialogCreated() {

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTSERVICE_H
#define PODCASTSERVICE_H
#ifndef PODCASTS_PODCASTSERVICE_H_
#define PODCASTS_PODCASTSERVICE_H_
#include "podcastdownloader.h"
#include "internet/internetmodel.h"
@ -148,4 +148,4 @@ class PodcastService : public InternetService {
QScopedPointer<AddPodcastDialog> add_podcast_dialog_;
};
#endif // PODCASTSERVICE_H
#endif // PODCASTS_PODCASTSERVICE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTSERVICEMODEL_H
#define PODCASTSERVICEMODEL_H
#ifndef PODCASTS_PODCASTSERVICEMODEL_H_
#define PODCASTS_PODCASTSERVICEMODEL_H_
#include <QStandardItemModel>
@ -26,7 +26,7 @@ class PodcastServiceModel : public QStandardItemModel {
Q_OBJECT
public:
PodcastServiceModel(QObject* parent = 0);
explicit PodcastServiceModel(QObject* parent = nullptr);
QMimeData* mimeData(const QModelIndexList& indexes) const;
@ -37,4 +37,4 @@ class PodcastServiceModel : public QStandardItemModel {
QList<QUrl>* urls) const;
};
#endif // PODCASTSERVICEMODEL_H
#endif // PODCASTS_PODCASTSERVICEMODEL_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTSETTINGSPAGE_H
#define PODCASTSETTINGSPAGE_H
#ifndef PODCASTS_PODCASTSETTINGSPAGE_H_
#define PODCASTS_PODCASTSETTINGSPAGE_H_
#include "ui/settingspage.h"
@ -28,7 +28,7 @@ class PodcastSettingsPage : public SettingsPage {
Q_OBJECT
public:
PodcastSettingsPage(SettingsDialog* dialog);
explicit PodcastSettingsPage(SettingsDialog* dialog);
~PodcastSettingsPage();
static const char* kSettingsGroup;
@ -47,4 +47,4 @@ class PodcastSettingsPage : public SettingsPage {
Ui_PodcastSettingsPage* ui_;
};
#endif // PODCASTSETTINGSPAGE_H
#endif // PODCASTS_PODCASTSETTINGSPAGE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTUPDATER_H
#define PODCASTUPDATER_H
#ifndef PODCASTS_PODCASTUPDATER_H_
#define PODCASTS_PODCASTUPDATER_H_
#include <QDateTime>
#include <QObject>
@ -34,7 +34,7 @@ class PodcastUpdater : public QObject {
Q_OBJECT
public:
PodcastUpdater(Application* app, QObject* parent = 0);
PodcastUpdater(Application* app, QObject* parent = nullptr);
static const char* kSettingsGroup;
@ -64,4 +64,4 @@ class PodcastUpdater : public QObject {
int pending_replies_;
};
#endif // PODCASTUPDATER_H
#endif // PODCASTS_PODCASTUPDATER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PODCASTURLLOADER_H
#define PODCASTURLLOADER_H
#ifndef PODCASTS_PODCASTURLLOADER_H_
#define PODCASTS_PODCASTURLLOADER_H_
#include <QObject>
#include <QRegExp>
@ -50,7 +50,7 @@ class PodcastUrlLoaderReply : public QObject {
void SetFinished(const PodcastList& results);
void SetFinished(const OpmlContainer& results);
signals:
signals:
void Finished(bool success);
private:
@ -67,7 +67,7 @@ class PodcastUrlLoader : public QObject {
Q_OBJECT
public:
PodcastUrlLoader(QObject* parent = 0);
explicit PodcastUrlLoader(QObject* parent = nullptr);
~PodcastUrlLoader();
static const int kMaxRedirects;
@ -109,4 +109,4 @@ class PodcastUrlLoader : public QObject {
QRegExp html_link_href_re_;
};
#endif // PODCASTURLLOADER_H
#endif // PODCASTS_PODCASTURLLOADER_H_