1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-02-01 20:06:53 +01:00

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)
if -1 == content[0].find("/* This file is part of Clementine."):
print("File {} have no Clementine copyright info".format(filename))
return 0
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
# 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.
_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
# 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 {
public:
MemoryDatabase(Application* app, QObject* parent = nullptr)
explicit MemoryDatabase(Application* app, QObject* parent = nullptr)
: Database(app, parent, ":memory:") {}
~MemoryDatabase() {
// 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 {
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;
};
@ -193,9 +194,9 @@ void MergedProxyModel::SourceModelReset() {
void MergedProxyModel::SubModelReset() {
QAbstractItemModel* submodel = static_cast<QAbstractItemModel*>(sender());
// TODO(David Sansome): When we require Qt 4.6, use beginResetModel() and endResetModel()
// in LibraryModel and catch those here - that will let us do away with this
// std::numeric_limits<int>::max() hack.
// TODO(David Sansome): When we require Qt 4.6, use beginResetModel() and
// endResetModel() in LibraryModel and catch those here - that will let
// us do away with this std::numeric_limits<int>::max() hack.
// Remove all the children of the item that got deleted
QModelIndex source_parent = merge_points_.value(submodel);

View File

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

View File

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

View File

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

View File

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

View File

@ -61,7 +61,7 @@ class RedirectFollower : public QObject {
Q_OBJECT
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; }
QNetworkReply* reply() const { return current_reply_; }
@ -106,7 +106,7 @@ class NetworkTimeouts : public QObject {
Q_OBJECT
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.
void AddReply(QNetworkReply* reply);

View File

@ -47,8 +47,9 @@ class Organise : public QObject {
typedef QList<NewSongInfo> NewSongInfoList;
Organise(TaskManager* task_manager, std::shared_ptr<MusicStorage> destination,
const OrganiseFormat& format, bool copy, bool overwrite, bool mark_as_listened,
const NewSongInfoList& songs, bool eject_after);
const OrganiseFormat& format, bool copy, bool overwrite,
bool mark_as_listened, const NewSongInfoList& songs,
bool eject_after);
static const int kBatchSize;
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 value;
// TODO(sobkas): What about nice switch statement?
if (tag == "title")
value = song.title();
else if (tag == "album")

View File

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

View File

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

View File

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

View File

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

View File

@ -217,7 +217,8 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
if (!parser) {
// 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.
parser = playlist_parser_->ParserForExtension(QFileInfo(filename).suffix().toLower());
parser = playlist_parser_->
ParserForExtension(QFileInfo(filename).suffix().toLower());
}
if (parser) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ class PodcastBackend : public QObject {
Q_OBJECT
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
// 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
public:
PodcastDiscoveryModel(Application* app, QObject* parent = nullptr);
explicit PodcastDiscoveryModel(Application* app, QObject* parent = nullptr);
enum Type { Type_Folder, Type_Podcast, Type_LoadingIndicator };

View File

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

View File

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