Fix some problems

This commit is contained in:
Krzysztof Sobiecki 2014-11-02 21:37:15 +01:00
parent cabaaf3333
commit 6efb5d05b7
26 changed files with 37 additions and 31 deletions

1
dist/copyright.py vendored
View File

@ -123,6 +123,7 @@ def change_file(filename):
copyrights=gen_copyrights(filename) copyrights=gen_copyrights(filename)
if -1 == content[0].find("/* This file is part of Clementine."): if -1 == content[0].find("/* This file is part of Clementine."):
print("File {} have no Clementine copyright info".format(filename))
return 0 return 0
for i in content: for i in content:

2
dist/cpplint.py vendored
View File

@ -245,7 +245,7 @@ _ERROR_CATEGORIES = [
# flag. By default all errors are on, so only add here categories that should be # flag. By default all errors are on, so only add here categories that should be
# off by default (i.e., categories that must be enabled by the --filter= flags). # off by default (i.e., categories that must be enabled by the --filter= flags).
# All entries here should start with a '-' or '+', as in the --filter= flag. # All entries here should start with a '-' or '+', as in the --filter= flag.
_DEFAULT_FILTERS = ['-build/include_alpha', '-build/include_order', '-build/include', '-readability/function', '-runtime/references'] _DEFAULT_FILTERS = ['-build/include_alpha', '-build/include_order', '-build/include', '-readability/function', '-runtime/references', '-whitespace/line_length', '-readability/streams']
# We used to check for high-bit characters, but after much discussion we # We used to check for high-bit characters, but after much discussion we
# decided those were OK, as long as they were in UTF-8 and didn't represent # decided those were OK, as long as they were in UTF-8 and didn't represent

View File

@ -180,7 +180,7 @@ class Database : public QObject {
class MemoryDatabase : public Database { class MemoryDatabase : public Database {
public: public:
MemoryDatabase(Application* app, QObject* parent = nullptr) explicit MemoryDatabase(Application* app, QObject* parent = nullptr)
: Database(app, parent, ":memory:") {} : Database(app, parent, ":memory:") {}
~MemoryDatabase() { ~MemoryDatabase() {
// Make sure Qt doesn't reuse the same database // Make sure Qt doesn't reuse the same database

View File

@ -47,7 +47,8 @@ std::size_t hash_value(const QModelIndex& index) { return qHash(index); }
namespace { namespace {
struct Mapping { struct Mapping {
explicit Mapping(const QModelIndex& _source_index) : source_index(_source_index) {} explicit Mapping(const QModelIndex& _source_index) :
source_index(_source_index) {}
QModelIndex source_index; QModelIndex source_index;
}; };
@ -193,9 +194,9 @@ void MergedProxyModel::SourceModelReset() {
void MergedProxyModel::SubModelReset() { void MergedProxyModel::SubModelReset() {
QAbstractItemModel* submodel = static_cast<QAbstractItemModel*>(sender()); QAbstractItemModel* submodel = static_cast<QAbstractItemModel*>(sender());
// TODO(David Sansome): When we require Qt 4.6, use beginResetModel() and endResetModel() // TODO(David Sansome): When we require Qt 4.6, use beginResetModel() and
// in LibraryModel and catch those here - that will let us do away with this // endResetModel() in LibraryModel and catch those here - that will let
// std::numeric_limits<int>::max() hack. // us do away with this std::numeric_limits<int>::max() hack.
// Remove all the children of the item that got deleted // Remove all the children of the item that got deleted
QModelIndex source_parent = merge_points_.value(submodel); QModelIndex source_parent = merge_points_.value(submodel);

View File

@ -25,7 +25,7 @@
template <typename T> template <typename T>
class ModelFutureWatcher : public QFutureWatcher<T> { class ModelFutureWatcher : public QFutureWatcher<T> {
public: public:
ModelFutureWatcher(const QModelIndex& index, QObject* parent = nullptr) explicit ModelFutureWatcher(const QModelIndex& index, QObject* parent = nullptr)
: QFutureWatcher<T>(parent), index_(index) {} : QFutureWatcher<T>(parent), index_(index) {}
~ModelFutureWatcher() {} ~ModelFutureWatcher() {}

View File

@ -33,7 +33,7 @@ class Mpris : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Mpris(Application* app, QObject* parent = nullptr); explicit Mpris(Application* app, QObject* parent = nullptr);
signals: signals:
void RaiseMainWindow(); void RaiseMainWindow();

View File

@ -104,7 +104,7 @@ class Mpris1Root : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Mpris1Root(Application* app, QObject* parent = nullptr); explicit Mpris1Root(Application* app, QObject* parent = nullptr);
QString Identity(); QString Identity();
void Quit(); void Quit();
@ -118,7 +118,7 @@ class Mpris1Player : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Mpris1Player(Application* app, QObject* parent = nullptr); explicit Mpris1Player(Application* app, QObject* parent = nullptr);
void Pause(); void Pause();
void Stop(); void Stop();
@ -173,7 +173,7 @@ class Mpris1TrackList : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Mpris1TrackList(Application* app, QObject* parent = nullptr); explicit Mpris1TrackList(Application* app, QObject* parent = nullptr);
int AddTrack(const QString&, bool); int AddTrack(const QString&, bool);
void DelTrack(int index); void DelTrack(int index);

View File

@ -175,7 +175,7 @@ void Mpris2::EmitNotification(const QString& name) {
if (value.isValid()) EmitNotification(name, value); if (value.isValid()) EmitNotification(name, value);
} }
//------------------Root Interface--------------------------// // ------------------Root Interface--------------- //
bool Mpris2::CanQuit() const { return true; } bool Mpris2::CanQuit() const { return true; }

View File

@ -61,7 +61,7 @@ class RedirectFollower : public QObject {
Q_OBJECT Q_OBJECT
public: public:
RedirectFollower(QNetworkReply* first_reply, int max_redirects = 5); explicit RedirectFollower(QNetworkReply* first_reply, int max_redirects = 5);
bool hit_redirect_limit() const { return redirects_remaining_ < 0; } bool hit_redirect_limit() const { return redirects_remaining_ < 0; }
QNetworkReply* reply() const { return current_reply_; } QNetworkReply* reply() const { return current_reply_; }
@ -106,7 +106,7 @@ class NetworkTimeouts : public QObject {
Q_OBJECT Q_OBJECT
public: public:
NetworkTimeouts(int timeout_msec, QObject* parent = nullptr); explicit NetworkTimeouts(int timeout_msec, QObject* parent = nullptr);
// TODO(John Maguire): Template this to avoid code duplication. // TODO(John Maguire): Template this to avoid code duplication.
void AddReply(QNetworkReply* reply); void AddReply(QNetworkReply* reply);

View File

@ -47,8 +47,9 @@ class Organise : public QObject {
typedef QList<NewSongInfo> NewSongInfoList; typedef QList<NewSongInfo> NewSongInfoList;
Organise(TaskManager* task_manager, std::shared_ptr<MusicStorage> destination, Organise(TaskManager* task_manager, std::shared_ptr<MusicStorage> destination,
const OrganiseFormat& format, bool copy, bool overwrite, bool mark_as_listened, const OrganiseFormat& format, bool copy, bool overwrite,
const NewSongInfoList& songs, bool eject_after); bool mark_as_listened, const NewSongInfoList& songs,
bool eject_after);
static const int kBatchSize; static const int kBatchSize;
static const int kTranscodeProgressInterval; static const int kTranscodeProgressInterval;

View File

@ -177,6 +177,8 @@ QString OrganiseFormat::ParseBlock(QString block, const Song& song,
QString OrganiseFormat::TagValue(const QString& tag, const Song& song) const { QString OrganiseFormat::TagValue(const QString& tag, const Song& song) const {
QString value; QString value;
// TODO(sobkas): What about nice switch statement?
if (tag == "title") if (tag == "title")
value = song.title(); value = song.title();
else if (tag == "album") else if (tag == "album")

View File

@ -27,7 +27,7 @@
class OrganiseFormat { class OrganiseFormat {
public: public:
OrganiseFormat(const QString& format = QString()); explicit OrganiseFormat(const QString& format = QString());
static const char* kTagPattern; static const char* kTagPattern;
static const char* kBlockPattern; static const char* kBlockPattern;

View File

@ -116,7 +116,7 @@ class Player : public PlayerInterface {
Q_OBJECT Q_OBJECT
public: public:
Player(Application* app, QObject* parent = nullptr); explicit Player(Application* app, QObject* parent = nullptr);
~Player(); ~Player();
void Init(); void Init();

View File

@ -30,7 +30,7 @@ class SimpleTreeItem {
public: public:
SimpleTreeItem(int _type, SimpleTreeModel<T>* _model); // For the root item SimpleTreeItem(int _type, SimpleTreeModel<T>* _model); // For the root item
SimpleTreeItem(int _type, const QString& _key, T* _parent = nullptr); SimpleTreeItem(int _type, const QString& _key, T* _parent = nullptr);
SimpleTreeItem(int _type, T* _parent = nullptr); explicit SimpleTreeItem(int _type, T* _parent = nullptr);
virtual ~SimpleTreeItem(); virtual ~SimpleTreeItem();
void InsertNotify(T* _parent); void InsertNotify(T* _parent);

View File

@ -27,7 +27,7 @@ class QModelIndex;
template <typename T> template <typename T>
class SimpleTreeModel : public QAbstractItemModel { class SimpleTreeModel : public QAbstractItemModel {
public: public:
SimpleTreeModel(T* root = 0, QObject* parent = nullptr); explicit SimpleTreeModel(T* root = 0, QObject* parent = nullptr);
virtual ~SimpleTreeModel() {} virtual ~SimpleTreeModel() {}
// QAbstractItemModel // QAbstractItemModel

View File

@ -217,7 +217,8 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
if (!parser) { if (!parser) {
// Check the file extension as well, maybe the magic failed, or it was a // Check the file extension as well, maybe the magic failed, or it was a
// basic M3U file which is just a plain list of filenames. // basic M3U file which is just a plain list of filenames.
parser = playlist_parser_->ParserForExtension(QFileInfo(filename).suffix().toLower()); parser = playlist_parser_->
ParserForExtension(QFileInfo(filename).suffix().toLower());
} }
if (parser) { if (parser) {

View File

@ -34,7 +34,7 @@ class AddPodcastByUrl : public AddPodcastPage {
Q_OBJECT Q_OBJECT
public: public:
AddPodcastByUrl(Application* app, QWidget* parent = nullptr); explicit AddPodcastByUrl(Application* app, QWidget* parent = nullptr);
~AddPodcastByUrl(); ~AddPodcastByUrl();
void Show(); void Show();

View File

@ -37,7 +37,7 @@ class AddPodcastDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
AddPodcastDialog(Application* app, QWidget* parent = nullptr); explicit AddPodcastDialog(Application* app, QWidget* parent = nullptr);
~AddPodcastDialog(); ~AddPodcastDialog();
static const char* kBbcOpmlUrl; static const char* kBbcOpmlUrl;

View File

@ -29,7 +29,7 @@ class AddPodcastPage : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
AddPodcastPage(Application* app, QWidget* parent = nullptr); explicit AddPodcastPage(Application* app, QWidget* parent = nullptr);
PodcastDiscoveryModel* model() const { return model_; } PodcastDiscoveryModel* model() const { return model_; }

View File

@ -32,7 +32,7 @@ class GPodderSearchPage : public AddPodcastPage {
Q_OBJECT Q_OBJECT
public: public:
GPodderSearchPage(Application* app, QWidget* parent = nullptr); explicit GPodderSearchPage(Application* app, QWidget* parent = nullptr);
~GPodderSearchPage(); ~GPodderSearchPage();
void Show(); void Show();

View File

@ -45,7 +45,7 @@ class GPodderSync : public QObject {
Q_OBJECT Q_OBJECT
public: public:
GPodderSync(Application* app, QObject* parent = nullptr); explicit GPodderSync(Application* app, QObject* parent = nullptr);
~GPodderSync(); ~GPodderSync();
static const char* kSettingsGroup; static const char* kSettingsGroup;

View File

@ -32,7 +32,7 @@ class GPodderTopTagsPage : public AddPodcastPage {
Q_OBJECT Q_OBJECT
public: public:
GPodderTopTagsPage(Application* app, QWidget* parent = nullptr); explicit GPodderTopTagsPage(Application* app, QWidget* parent = nullptr);
~GPodderTopTagsPage(); ~GPodderTopTagsPage();
static const int kMaxTagCount; static const int kMaxTagCount;

View File

@ -31,7 +31,7 @@ class PodcastBackend : public QObject {
Q_OBJECT Q_OBJECT
public: public:
PodcastBackend(Application* app, QObject* parent = nullptr); explicit PodcastBackend(Application* app, QObject* parent = nullptr);
// Adds the podcast and any included Episodes to the database. Updates the // 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 // podcast with a database ID. If this podcast already has an ID set, this

View File

@ -34,7 +34,7 @@ class PodcastDiscoveryModel : public QStandardItemModel {
Q_OBJECT Q_OBJECT
public: public:
PodcastDiscoveryModel(Application* app, QObject* parent = nullptr); explicit PodcastDiscoveryModel(Application* app, QObject* parent = nullptr);
enum Type { Type_Folder, Type_Podcast, Type_LoadingIndicator }; enum Type { Type_Folder, Type_Podcast, Type_LoadingIndicator };

View File

@ -44,7 +44,7 @@ class PodcastDownloader : public QObject {
Q_OBJECT Q_OBJECT
public: public:
PodcastDownloader(Application* app, QObject* parent = nullptr); explicit PodcastDownloader(Application* app, QObject* parent = nullptr);
enum State { NotDownloading, Queued, Downloading, Finished }; enum State { NotDownloading, Queued, Downloading, Finished };

View File

@ -36,7 +36,7 @@ class PodcastUpdater : public QObject {
Q_OBJECT Q_OBJECT
public: public:
PodcastUpdater(Application* app, QObject* parent = nullptr); explicit PodcastUpdater(Application* app, QObject* parent = nullptr);
static const char* kSettingsGroup; static const char* kSettingsGroup;