Clean up src/core

This commit is contained in:
Krzysztof Sobiecki 2014-11-01 19:26:05 +01:00
parent 978a91442c
commit 0af1470cce
65 changed files with 470 additions and 253 deletions

View File

@ -15,15 +15,15 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPEARANCE_H
#define APPEARANCE_H
#ifndef CORE_APPEARANCE_H_
#define CORE_APPEARANCE_H_
#include <QColor>
#include <QPalette>
class Appearance : public QObject {
public:
Appearance(QObject* parent = nullptr);
explicit Appearance(QObject* parent = nullptr);
// Load the user preferred theme, which could the default system theme or a
// custom set of colors that user has chosen
void LoadUserTheme();
@ -42,4 +42,4 @@ class Appearance : public QObject {
QColor background_color_;
};
#endif // APPEARANCE_H
#endif // CORE_APPEARANCE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPLICATION_H
#define APPLICATION_H
#ifndef CORE_APPLICATION_H_
#define CORE_APPLICATION_H_
#include "ui/settingsdialog.h"
@ -54,7 +54,7 @@ class Application : public QObject {
public:
static bool kIsPortable;
Application(QObject* parent = nullptr);
explicit Application(QObject* parent = nullptr);
~Application();
const QString& language_name() const { return language_name_; }
@ -100,7 +100,7 @@ class Application : public QObject {
void ReloadSettings();
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
signals:
signals:
void ErrorAdded(const QString& message);
void SettingsChanged();
void SettingsDialogRequested(SettingsDialog::Page page);
@ -136,4 +136,4 @@ signals:
QList<QThread*> threads_;
};
#endif // APPLICATION_H
#endif // CORE_APPLICATION_H_

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2010-2013, David Sansome <me@davidsansome.com>
Copyright 2010-2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backgroundstreams.h"
#include <QAction>

View File

@ -1,5 +1,23 @@
#ifndef BACKGROUNDSTREAMS_H
#define BACKGROUNDSTREAMS_H
/* This file is part of Clementine.
Copyright 2010-2013, David Sansome <me@davidsansome.com>
Copyright 2010-2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_BACKGROUNDSTREAMS_H_
#define CORE_BACKGROUNDSTREAMS_H_
#include <QMap>
#include <QObject>
@ -12,8 +30,9 @@ class QAction;
class BackgroundStreams : public QObject {
Q_OBJECT
public:
explicit BackgroundStreams(EngineBase* engine, QObject* parent = nullptr);
BackgroundStreams(EngineBase* engine, QObject* parent = nullptr);
~BackgroundStreams();
void LoadStreams();
@ -29,7 +48,7 @@ class BackgroundStreams : public QObject {
void AddAction(const QString& name, QAction* action);
signals:
signals:
void StreamStarted(const QString& name);
void StreamStopped(const QString& name);
@ -65,4 +84,4 @@ signals:
static const char* kEnterpriseUrl;
};
#endif
#endif // CORE_BACKGROUNDSTREAMS_H_

View File

@ -1,5 +1,22 @@
#ifndef BOUNDFUTUREWATCHER_H
#define BOUNDFUTUREWATCHER_H
/* This file is part of Clementine.
Copyright 2010-2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_BOUNDFUTUREWATCHER_H_
#define CORE_BOUNDFUTUREWATCHER_H_
#include <QFutureWatcher>
@ -19,4 +36,4 @@ class BoundFutureWatcher : public QFutureWatcher<T>, boost::noncopyable {
D data_;
};
#endif
#endif // CORE_BOUNDFUTUREWATCHER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CACHEDLIST_H
#define CACHEDLIST_H
#ifndef CORE_CACHEDLIST_H_
#define CORE_CACHEDLIST_H_
#include <QDateTime>
#include <QSettings>
@ -98,4 +98,4 @@ class CachedList {
ListType data_;
};
#endif // CACHEDLIST_H
#endif // CORE_CACHEDLIST_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMANDLINEOPTIONS_H
#define COMMANDLINEOPTIONS_H
#ifndef CORE_COMMANDLINEOPTIONS_H_
#define CORE_COMMANDLINEOPTIONS_H_
#include <QList>
#include <QUrl>
@ -114,4 +114,4 @@ class CommandlineOptions {
QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a);
QDataStream& operator>>(QDataStream& s, CommandlineOptions& a);
#endif // COMMANDLINEOPTIONS_H
#endif // CORE_COMMANDLINEOPTIONS_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CRASHREPORTING_H
#define CRASHREPORTING_H
#ifndef CORE_CRASHREPORTING_H_
#define CORE_CRASHREPORTING_H_
#include <memory>
@ -70,7 +70,7 @@ class CrashSender : public QObject {
Q_OBJECT
public:
CrashSender(const QString& path);
explicit CrashSender(const QString& path);
// Returns false if the user doesn't want to send the crash report (caller
// should exit), or true if he does (caller should start the Qt event loop).
@ -90,4 +90,4 @@ class CrashSender : public QObject {
QProgressDialog* progress_;
};
#endif // CRASHREPORTING_H
#endif // CORE_CRASHREPORTING_H_

View File

@ -379,7 +379,7 @@ void Database::AttachDatabase(const QString& database_name,
void Database::AttachDatabaseOnDbConnection(const QString& database_name,
const AttachedDatabase& database,
QSqlDatabase& db) {
const QSqlDatabase& db) {
AttachDatabase(database_name, database);
// Attach the db
@ -408,7 +408,7 @@ void Database::DetachDatabase(const QString& database_name) {
attached_databases_.remove(database_name);
}
void Database::UpdateDatabaseSchema(int version, QSqlDatabase& db) {
void Database::UpdateDatabaseSchema(int version, const QSqlDatabase& db) {
QString filename;
if (version == 0)
filename = ":/schema/schema.sql";
@ -439,7 +439,7 @@ void Database::UpdateDatabaseSchema(int version, QSqlDatabase& db) {
}
}
void Database::UrlEncodeFilenameColumn(const QString& table, QSqlDatabase& db) {
void Database::UrlEncodeFilenameColumn(const QString& table, const QSqlDatabase& db) {
QSqlQuery select(QString("SELECT ROWID, filename FROM %1").arg(table), db);
QSqlQuery update(
QString("UPDATE %1 SET filename=:filename WHERE ROWID=:id").arg(table),
@ -463,7 +463,7 @@ void Database::UrlEncodeFilenameColumn(const QString& table, QSqlDatabase& db) {
}
}
void Database::ExecSchemaCommandsFromFile(QSqlDatabase& db,
void Database::ExecSchemaCommandsFromFile(const QSqlDatabase& db,
const QString& filename,
int schema_version,
bool in_transaction) {
@ -475,7 +475,7 @@ void Database::ExecSchemaCommandsFromFile(QSqlDatabase& db,
schema_version, in_transaction);
}
void Database::ExecSchemaCommands(QSqlDatabase& db, const QString& schema,
void Database::ExecSchemaCommands(const QSqlDatabase& db, const QString& schema,
int schema_version, bool in_transaction) {
// Run each command
const QStringList commands(schema.split(QRegExp("; *\n\n")));
@ -497,7 +497,7 @@ void Database::ExecSchemaCommands(QSqlDatabase& db, const QString& schema,
}
}
void Database::ExecSongTablesCommands(QSqlDatabase& db,
void Database::ExecSongTablesCommands(const QSqlDatabase& db,
const QStringList& song_tables,
const QStringList& commands) {
for (const QString& command : commands) {
@ -527,7 +527,7 @@ void Database::ExecSongTablesCommands(QSqlDatabase& db,
}
}
QStringList Database::SongsTables(QSqlDatabase& db, int schema_version) const {
QStringList Database::SongsTables(const QSqlDatabase& db, int schema_version) const {
QStringList ret;
// look for the tables in the main db

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASE_H
#define DATABASE_H
#ifndef CORE_DATABASE_H_
#define CORE_DATABASE_H_
#include <QMap>
#include <QMutex>
@ -30,7 +30,6 @@
#include "gtest/gtest_prod.h"
extern "C" {
struct sqlite3_tokenizer;
struct sqlite3_tokenizer_cursor;
struct sqlite3_tokenizer_module;
@ -65,7 +64,7 @@ class Database : public QObject {
QMutex* Mutex() { return &mutex_; }
void RecreateAttachedDb(const QString& database_name);
void ExecSchemaCommands(QSqlDatabase& db, const QString& schema,
void ExecSchemaCommands(const QSqlDatabase& db, const QString& schema,
int schema_version, bool in_transaction = false);
int startup_schema_version() const { return startup_schema_version_; }
@ -75,10 +74,10 @@ class Database : public QObject {
const AttachedDatabase& database);
void AttachDatabaseOnDbConnection(const QString& database_name,
const AttachedDatabase& database,
QSqlDatabase& db);
const QSqlDatabase& db);
void DetachDatabase(const QString& database_name);
signals:
signals:
void Error(const QString& message);
public slots:
@ -87,16 +86,16 @@ signals:
private:
void UpdateMainSchema(QSqlDatabase* db);
void ExecSchemaCommandsFromFile(QSqlDatabase& db, const QString& filename,
void ExecSchemaCommandsFromFile(const QSqlDatabase& db, const QString& filename,
int schema_version,
bool in_transaction = false);
void ExecSongTablesCommands(QSqlDatabase& db, const QStringList& song_tables,
void ExecSongTablesCommands(const QSqlDatabase& db, const QStringList& song_tables,
const QStringList& commands);
void UpdateDatabaseSchema(int version, QSqlDatabase& db);
void UrlEncodeFilenameColumn(const QString& table, QSqlDatabase& db);
QStringList SongsTables(QSqlDatabase& db, int schema_version) const;
bool IntegrityCheck(QSqlDatabase db);
void UpdateDatabaseSchema(int version, const QSqlDatabase& db);
void UrlEncodeFilenameColumn(const QString& table, const QSqlDatabase& db);
QStringList SongsTables(const QSqlDatabase& db, int schema_version) const;
bool IntegrityCheck(const QSqlDatabase db);
void BackupFile(const QString& filename);
bool OpenDatabase(const QString& filename, sqlite3** connection) const;
@ -183,4 +182,4 @@ class MemoryDatabase : public Database {
}
};
#endif // DATABASE_H
#endif // CORE_DATABASE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DELETEFILES_H
#define DELETEFILES_H
#ifndef CORE_DELETEFILES_H_
#define CORE_DELETEFILES_H_
#include <memory>
@ -39,7 +39,7 @@ class DeleteFiles : public QObject {
void Start(const SongList& songs);
void Start(const QStringList& filenames);
signals:
signals:
void Finished(const SongList& songs_with_errors);
private slots:
@ -61,4 +61,4 @@ signals:
SongList songs_with_errors_;
};
#endif // DELETEFILES_H
#endif // CORE_DELETEFILES_H_

View File

@ -58,11 +58,11 @@ void FHT::makeCasTable(void) {
}
float* FHT::copy(float* d, float* s) {
return (float*)memcpy(d, s, m_num * sizeof(float));
return static_cast<float*>(memcpy(d, s, m_num * sizeof(float)));
}
float* FHT::clear(float* d) {
return (float*)memset(d, 0, m_num * sizeof(float));
return static_cast<float*>(memset(d, 0, m_num * sizeof(float)));
}
void FHT::scale(float* p, float d) {
@ -77,9 +77,9 @@ void FHT::logSpectrum(float* out, float* p) {
int n = m_num / 2, i, j, k, *r;
if (!m_log) {
m_log = new int[n];
float f = n / log10((double)n);
float f = n / log10(static_cast<double>(n));
for (i = 0, r = m_log; i < n; i++, r++) {
j = int(rint(log10(i + 1.0) * f));
j = static_cast<int>(rint(log10(i + 1.0) * f));
*r = j >= n ? n - 1 : j;
}
}
@ -87,9 +87,9 @@ void FHT::logSpectrum(float* out, float* p) {
*out++ = *p = *p / 100;
for (k = i = 1, r = m_log; i < n; i++) {
j = *r++;
if (i == j)
if (i == j) {
*out++ = p[i];
else {
} else {
float base = p[k - 1];
float step = (p[j] - base) / (j - (k - 1));
for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr;
@ -108,7 +108,7 @@ void FHT::semiLogSpectrum(float* p) {
void FHT::spectrum(float* p) {
power2(p);
for (int i = 0; i < (m_num / 2); i++, p++) *p = (float)sqrt(*p * .5);
for (int i = 0; i < (m_num / 2); i++, p++) *p = static_cast<float>(sqrt(*p * .5));
}
void FHT::power(float* p) {

View File

@ -18,8 +18,8 @@
//
// $Id$
#ifndef FHT_H
#define FHT_H
#ifndef CORE_FHT_H_
#define CORE_FHT_H_
/**
* Implementation of the Hartley Transform after Bracewell's discrete
@ -54,7 +54,7 @@ class FHT {
* should be at least 3. Values of more than 3 need a trigonometry table.
* @see makeCasTable()
*/
FHT(int);
explicit FHT(int);
~FHT();
inline int sizeExp() const { return m_exp2; }
@ -115,4 +115,4 @@ class FHT {
void transform(float*);
};
#endif
#endif // CORE_FHT_H_

View File

@ -57,4 +57,4 @@ bool FilesystemMusicStorage::DeleteFromStorage(const DeleteJob& job) {
return Utilities::RemoveRecursive(path);
else
return QFile::remove(path);
}
}

View File

@ -15,14 +15,14 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILESYSTEMMUSICSTORAGE_H
#define FILESYSTEMMUSICSTORAGE_H
#ifndef CORE_FILESYSTEMMUSICSTORAGE_H_
#define CORE_FILESYSTEMMUSICSTORAGE_H_
#include "musicstorage.h"
class FilesystemMusicStorage : public virtual MusicStorage {
public:
FilesystemMusicStorage(const QString& root);
explicit FilesystemMusicStorage(const QString& root);
~FilesystemMusicStorage() {}
QString LocalPath() const { return root_; }
@ -34,4 +34,4 @@ class FilesystemMusicStorage : public virtual MusicStorage {
QString root_;
};
#endif // FILESYSTEMMUSICSTORAGE_H
#endif // CORE_FILESYSTEMMUSICSTORAGE_H_

View File

@ -15,15 +15,15 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILESYSTEMWATCHERINTERFACE_H
#define FILESYSTEMWATCHERINTERFACE_H
#ifndef CORE_FILESYSTEMWATCHERINTERFACE_H_
#define CORE_FILESYSTEMWATCHERINTERFACE_H_
#include <QObject>
class FileSystemWatcherInterface : public QObject {
Q_OBJECT
public:
FileSystemWatcherInterface(QObject* parent = nullptr);
explicit FileSystemWatcherInterface(QObject* parent = nullptr);
virtual void Init() {}
virtual void AddPath(const QString& path) = 0;
virtual void RemovePath(const QString& path) = 0;
@ -31,8 +31,8 @@ class FileSystemWatcherInterface : public QObject {
static FileSystemWatcherInterface* Create(QObject* parent = nullptr);
signals:
signals:
void PathChanged(const QString& path);
};
#endif
#endif // CORE_FILESYSTEMWATCHERINTERFACE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBALSHORTCUTBACKEND_H
#define GLOBALSHORTCUTBACKEND_H
#ifndef CORE_GLOBALSHORTCUTBACKEND_H_
#define CORE_GLOBALSHORTCUTBACKEND_H_
#include <QObject>
@ -26,7 +26,7 @@ class GlobalShortcutBackend : public QObject {
Q_OBJECT
public:
GlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
explicit GlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
virtual ~GlobalShortcutBackend() {}
bool is_active() const { return active_; }
@ -34,7 +34,7 @@ class GlobalShortcutBackend : public QObject {
bool Register();
void Unregister();
signals:
signals:
void RegisterFinished(bool success);
protected:
@ -45,4 +45,4 @@ signals:
bool active_;
};
#endif // GLOBALSHORTCUTBACKEND_H
#endif // CORE_GLOBALSHORTCUTBACKEND_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBALSHORTCUTS_H
#define GLOBALSHORTCUTS_H
#ifndef CORE_GLOBALSHORTCUTS_H_
#define CORE_GLOBALSHORTCUTS_H_
#include <QKeySequence>
#include <QMap>
@ -33,7 +33,7 @@ class GlobalShortcuts : public QWidget {
Q_OBJECT
public:
GlobalShortcuts(QWidget* parent = nullptr);
explicit GlobalShortcuts(QWidget* parent = nullptr);
static const char* kSettingsGroup;
@ -55,7 +55,7 @@ class GlobalShortcuts : public QWidget {
void Unregister();
void Register();
signals:
signals:
void Play();
void Pause();
void PlayPause();
@ -96,4 +96,4 @@ signals:
QSignalMapper* rating_signals_mapper_;
};
#endif
#endif // CORE_GLOBALSHORTCUTS_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GNOMEGLOBALSHORTCUTBACKEND_H
#define GNOMEGLOBALSHORTCUTBACKEND_H
#ifndef CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
#define CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
#include "globalshortcutbackend.h"
@ -28,7 +28,7 @@ class GnomeGlobalShortcutBackend : public GlobalShortcutBackend {
Q_OBJECT
public:
GnomeGlobalShortcutBackend(GlobalShortcuts* parent);
explicit GnomeGlobalShortcutBackend(GlobalShortcuts* parent);
static const char* kGsdService;
static const char* kGsdPath;
@ -49,4 +49,4 @@ class GnomeGlobalShortcutBackend : public GlobalShortcutBackend {
bool is_connected_;
};
#endif // GNOMEGLOBALSHORTCUTBACKEND_H
#endif // CORE_GNOMEGLOBALSHORTCUTBACKEND_H_

View File

@ -1,3 +1,20 @@
/* This file is part of Clementine.
Copyright 2011-2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#import <AppKit/NSApplication.h>
#include "config.h"

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011-2012, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAC_STARTUP_H
#define MAC_STARTUP_H
@ -32,4 +50,4 @@ void EnableFullScreen(const QWidget& main_window);
} // namespace mac
#endif
#endif // MAC_STARTUP_H

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACFSLISTENER_H
#define MACFSLISTENER_H
#ifndef CORE_MACFSLISTENER_H_
#define CORE_MACFSLISTENER_H_
#include <CoreServices/CoreServices.h>
@ -36,7 +36,7 @@ class MacFSListener : public FileSystemWatcherInterface {
void RemovePath(const QString& path);
void Clear();
signals:
signals:
void PathChanged(const QString& path);
private slots:
@ -57,4 +57,4 @@ signals:
QTimer update_timer_;
};
#endif
#endif // CORE_MACFSLISTENER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACGLOBALSHORTCUTBACKEND_H
#define MACGLOBALSHORTCUTBACKEND_H
#ifndef CORE_MACGLOBALSHORTCUTBACKEND_H_
#define CORE_MACGLOBALSHORTCUTBACKEND_H_
#include <memory>
@ -32,7 +32,7 @@ class MacGlobalShortcutBackend : public GlobalShortcutBackend {
Q_OBJECT
public:
MacGlobalShortcutBackend(GlobalShortcuts* parent);
explicit MacGlobalShortcutBackend(GlobalShortcuts* parent);
virtual ~MacGlobalShortcutBackend();
bool IsAccessibilityEnabled() const;
@ -53,4 +53,4 @@ class MacGlobalShortcutBackend : public GlobalShortcutBackend {
std::unique_ptr<MacGlobalShortcutBackendPrivate> p_;
};
#endif // MACGLOBALSHORTCUTBACKEND_H
#endif // CORE_MACGLOBALSHORTCUTBACKEND_H_

View File

@ -44,7 +44,7 @@ std::size_t hash_value(const QModelIndex& index) { return qHash(index); }
namespace {
struct Mapping {
Mapping(const QModelIndex& _source_index) : source_index(_source_index) {}
explicit Mapping(const QModelIndex& _source_index) : source_index(_source_index) {}
QModelIndex source_index;
};
@ -190,7 +190,7 @@ void MergedProxyModel::SourceModelReset() {
void MergedProxyModel::SubModelReset() {
QAbstractItemModel* submodel = static_cast<QAbstractItemModel*>(sender());
// TODO: When we require Qt 4.6, use beginResetModel() and endResetModel()
// 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.

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MERGEDPROXYMODEL_H
#define MERGEDPROXYMODEL_H
#ifndef CORE_MERGEDPROXYMODEL_H_
#define CORE_MERGEDPROXYMODEL_H_
#include <memory>
@ -30,7 +30,7 @@ class MergedProxyModel : public QAbstractProxyModel {
Q_OBJECT
public:
MergedProxyModel(QObject* parent = nullptr);
explicit MergedProxyModel(QObject* parent = nullptr);
~MergedProxyModel();
// Make another model appear as a child of the given item in the source model.
@ -73,7 +73,7 @@ class MergedProxyModel : public QAbstractProxyModel {
QModelIndexList mapFromSource(const QModelIndexList& source_indexes) const;
QModelIndexList mapToSource(const QModelIndexList& proxy_indexes) const;
signals:
signals:
void SubModelReset(const QModelIndex& root, QAbstractItemModel* model);
private slots:
@ -107,4 +107,4 @@ signals:
std::unique_ptr<MergedProxyModelPrivate> p_;
};
#endif // MERGEDPROXYMODEL_H
#endif // CORE_MERGEDPROXYMODEL_H_

View File

@ -1,3 +1,24 @@
/* This file is part of Clementine.
Copyright 2014, David Sansome <me@davidsansome.com>
Copyright 2012-2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Andreas <asfa194@gmail.com>
Copyright 2013, pie.or.paj <pie.or.paj@gmail.com>
Copyright 2014, Maltsev Vlad <shedwardx@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "metatypes.h"
#include <QMetaType>

View File

@ -1,6 +1,23 @@
#ifndef METATYPES_H
#define METATYPES_H
/* This file is part of Clementine.
Copyright 2012, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_METATYPES_H_
#define CORE_METATYPES_H_
void RegisterMetaTypes();
#endif
#endif // CORE_METATYPES_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MIMEDATA_H
#define MIMEDATA_H
#ifndef CORE_MIMEDATA_H_
#define CORE_MIMEDATA_H_
#include <QMimeData>
@ -72,4 +72,4 @@ class MimeData : public QMimeData {
}
};
#endif // MIMEDATA_H
#endif // CORE_MIMEDATA_H_

View File

@ -1,5 +1,22 @@
#ifndef MODELFUTUREWATCHER_H
#define MODELFUTUREWATCHER_H
/* This file is part of Clementine.
Copyright 2010-2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_MODELFUTUREWATCHER_H_
#define CORE_MODELFUTUREWATCHER_H_
#include <QFutureWatcher>
#include <QPersistentModelIndex>
@ -18,4 +35,4 @@ class ModelFutureWatcher : public QFutureWatcher<T> {
QPersistentModelIndex index_;
};
#endif
#endif // CORE_MODELFUTUREWATCHER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS_H
#define MPRIS_H
#ifndef CORE_MPRIS_H_
#define CORE_MPRIS_H_
#include <QObject>
@ -33,7 +33,7 @@ class Mpris : public QObject {
public:
Mpris(Application* app, QObject* parent = nullptr);
signals:
signals:
void RaiseMainWindow();
private:
@ -43,4 +43,4 @@ signals:
} // namespace mpris
#endif // MPRIS_H
#endif // CORE_MPRIS_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS1_H
#define MPRIS1_H
#ifndef CORE_MPRIS1_H_
#define CORE_MPRIS1_H_
#include "core/player.h"
@ -149,7 +149,7 @@ class Mpris1Player : public QObject {
void CurrentSongChanged(const Song& song, const QString& art_uri,
const QImage&);
signals:
signals:
void CapsChange(int);
void TrackChange(const QVariantMap&);
void StatusChange(DBusStatus);
@ -184,7 +184,7 @@ class Mpris1TrackList : public QObject {
// Amarok extension
void PlayTrack(int index);
signals:
signals:
void TrackListChange(int i);
private slots:
@ -196,4 +196,4 @@ signals:
} // namespace mpris
#endif // MPRIS1_H
#endif // CORE_MPRIS1_H_

View File

@ -345,7 +345,7 @@ void Mpris2::ArtLoaded(const Song& song, const QString& art_uri) {
double Mpris2::Volume() const {
if (mpris1_->player()) {
return double(mpris1_->player()->VolumeGet()) / 100;
return static_cast<double>(mpris1_->player()->VolumeGet()) / 100;
} else {
return 0.0;
}
@ -458,28 +458,28 @@ void Mpris2::OpenUri(const QString& uri) {
}
TrackIds Mpris2::Tracks() const {
// TODO
// TODO(John Maguire): ?
return TrackIds();
}
bool Mpris2::CanEditTracks() const { return false; }
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds& tracks) const {
// TODO
// TODO(John Maguire): ?
return TrackMetadata();
}
void Mpris2::AddTrack(const QString& uri, const QDBusObjectPath& afterTrack,
bool setAsCurrent) {
// TODO
// TODO(John Maguire): ?
}
void Mpris2::RemoveTrack(const QDBusObjectPath& trackId) {
// TODO
// TODO(John Maguire): ?
}
void Mpris2::GoTo(const QDBusObjectPath& trackId) {
// TODO
// TODO(John Maguire): ?
}
quint32 Mpris2::PlaylistCount() const {
@ -529,7 +529,7 @@ void Mpris2::ActivatePlaylist(const QDBusObjectPath& playlist_id) {
app_->player()->Next();
}
// TODO: Support sort orders.
// TODO(John Maguire): Support sort orders.
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count,
const QString& order,
bool reverse_order) {

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS2_H
#define MPRIS2_H
#ifndef CORE_MPRIS2_H_
#define CORE_MPRIS2_H_
#include "playlist/playlistitem.h"
@ -175,7 +175,7 @@ class Mpris2 : public QObject {
QList<MprisPlaylist> GetPlaylists(quint32 index, quint32 max_count,
const QString& order, bool reverse_order);
signals:
signals:
// Player
void Seeked(qlonglong position);
@ -228,4 +228,4 @@ signals:
} // namespace mpris
#endif
#endif // CORE_MPRIS2_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS_COMMON_H
#define MPRIS_COMMON_H
#ifndef CORE_MPRIS_COMMON_H_
#define CORE_MPRIS_COMMON_H_
#include <QDateTime>
#include <QObject>
@ -58,4 +58,4 @@ inline QString AsMPRISDateTimeType(uint time) {
} // namespace mpris
#endif // MPRIS_COMMON_H
#endif // CORE_MPRIS_COMMON_H_

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "multisortfilterproxy.h"
#include "core/logging.h"

View File

@ -1,11 +1,29 @@
#ifndef MULTISORTFILTERPROXY_H
#define MULTISORTFILTERPROXY_H
/* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_MULTISORTFILTERPROXY_H_
#define CORE_MULTISORTFILTERPROXY_H_
#include <QSortFilterProxyModel>
class MultiSortFilterProxy : public QSortFilterProxyModel {
public:
MultiSortFilterProxy(QObject* parent = nullptr);
explicit MultiSortFilterProxy(QObject* parent = nullptr);
void AddSortSpec(int role, Qt::SortOrder order = Qt::AscendingOrder);
@ -19,4 +37,4 @@ class MultiSortFilterProxy : public QSortFilterProxyModel {
QList<SortSpec> sorting_;
};
#endif // MULTISORTFILTERPROXY_H
#endif // CORE_MULTISORTFILTERPROXY_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUSICSTORAGE_H
#define MUSICSTORAGE_H
#ifndef CORE_MUSICSTORAGE_H_
#define CORE_MUSICSTORAGE_H_
#include "song.h"
@ -86,4 +86,4 @@ class MusicStorage {
Q_DECLARE_METATYPE(MusicStorage*);
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
#endif // MUSICSTORAGE_H
#endif // CORE_MUSICSTORAGE_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NETWORK_H
#define NETWORK_H
#ifndef CORE_NETWORK_H_
#define CORE_NETWORK_H_
#include <QAbstractNetworkCache>
#include <QMutex>
@ -27,7 +27,7 @@ class QNetworkDiskCache;
class ThreadSafeNetworkDiskCache : public QAbstractNetworkCache {
public:
ThreadSafeNetworkDiskCache(QObject* parent);
explicit ThreadSafeNetworkDiskCache(QObject* parent);
qint64 cacheSize() const;
QIODevice* data(const QUrl& url);
@ -48,7 +48,7 @@ class NetworkAccessManager : public QNetworkAccessManager {
Q_OBJECT
public:
NetworkAccessManager(QObject* parent = nullptr);
explicit NetworkAccessManager(QObject* parent = nullptr);
protected:
QNetworkReply* createRequest(Operation op, const QNetworkRequest& request,
@ -78,7 +78,7 @@ class RedirectFollower : public QObject {
QByteArray readAll() { return current_reply_->readAll(); }
void abort() { current_reply_->abort(); }
signals:
signals:
// These are all forwarded from the current reply.
void readyRead();
void error(QNetworkReply::NetworkError);
@ -106,7 +106,7 @@ class NetworkTimeouts : public QObject {
public:
NetworkTimeouts(int timeout_msec, QObject* parent = nullptr);
// TODO: Template this to avoid code duplication.
// TODO(John Maguire): Template this to avoid code duplication.
void AddReply(QNetworkReply* reply);
void AddReply(RedirectFollower* reply);
void SetTimeout(int msec) { timeout_msec_ = msec; }
@ -124,4 +124,4 @@ class NetworkTimeouts : public QObject {
QMap<RedirectFollower*, int> redirect_timers_;
};
#endif // NETWORK_H
#endif // CORE_NETWORK_H_

View File

@ -1,3 +1,22 @@
/* This file is part of Clementine.
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "networkproxyfactory.h"
#include "core/logging.h"

View File

@ -1,5 +1,23 @@
#ifndef NETWORKPROXYFACTORY_H
#define NETWORKPROXYFACTORY_H
/* This file is part of Clementine.
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_NETWORKPROXYFACTORY_H_
#define CORE_NETWORKPROXYFACTORY_H_
#include <QMutex>
#include <QNetworkProxyFactory>
@ -37,4 +55,4 @@ class NetworkProxyFactory : public QNetworkProxyFactory {
#endif
};
#endif // NETWORKPROXYFACTORY_H
#endif // CORE_NETWORKPROXYFACTORY_H_

View File

@ -189,9 +189,8 @@ void Organise::ProcessSomeFiles() {
if (!destination_->CopyToStorage(job)) {
files_with_errors_ << task.song_info_.song_.basefilename();
}
else {
if(job.mark_as_listened_) {
} else {
if (job.mark_as_listened_) {
emit FileCopied(job.metadata_.id());
}
}

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ORGANISE_H
#define ORGANISE_H
#ifndef CORE_ORGANISE_H_
#define CORE_ORGANISE_H_
#include <memory>
@ -52,7 +52,7 @@ class Organise : public QObject {
void Start();
signals:
signals:
void Finished(const QStringList& files_with_errors);
void FileCopied(int database_id);
@ -111,4 +111,4 @@ signals:
QStringList files_with_errors_;
};
#endif // ORGANISE_H
#endif // CORE_ORGANISE_H_

View File

@ -232,7 +232,7 @@ QString OrganiseFormat::TagValue(const QString& tag, const Song& song) const {
OrganiseFormat::Validator::Validator(QObject* parent) : QValidator(parent) {}
QValidator::State OrganiseFormat::Validator::validate(QString& input,
QValidator::State OrganiseFormat::Validator::validate(const QString& input,
int&) const {
QRegExp tag_regexp(kTagPattern);

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SRC_CORE_ORGANISEFORMAT_H_
#define SRC_CORE_ORGANISEFORMAT_H_
#ifndef CORE_ORGANISEFORMAT_H_
#define CORE_ORGANISEFORMAT_H_
#include <QSyntaxHighlighter>
#include <QValidator>
@ -51,7 +51,7 @@ class OrganiseFormat {
class Validator : public QValidator {
public:
explicit Validator(QObject* parent = nullptr);
QValidator::State validate(QString& format, int& pos) const;
QValidator::State validate(const QString& format, const int& pos) const;
};
class SyntaxHighlighter : public QSyntaxHighlighter {
@ -80,4 +80,4 @@ class OrganiseFormat {
bool replace_the_;
};
#endif // SRC_CORE_ORGANISEFORMAT_H_
#endif // CORE_ORGANISEFORMAT_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLAYER_H
#define PLAYER_H
#ifndef CORE_PLAYER_H_
#define CORE_PLAYER_H_
#include <memory>
@ -37,7 +37,7 @@ class PlayerInterface : public QObject {
Q_OBJECT
public:
PlayerInterface(QObject* parent = nullptr) : QObject(parent) {}
explicit PlayerInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual EngineBase* engine() const = 0;
virtual Engine::State GetState() const = 0;
@ -82,7 +82,7 @@ class PlayerInterface : public QObject {
virtual void Play() = 0;
virtual void ShowOSD() = 0;
signals:
signals:
void Playing();
void Paused();
void Stopped();
@ -190,4 +190,4 @@ class Player : public PlayerInterface {
int volume_before_mute_;
};
#endif // PLAYER_H
#endif // CORE_PLAYER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef POTRANSLATOR_H
#define POTRANSLATOR_H
#ifndef CORE_POTRANSLATOR_H_
#define CORE_POTRANSLATOR_H_
#include <QTranslator>
@ -34,4 +34,4 @@ class PoTranslator : public QTranslator {
}
};
#endif // POTRANSLATOR_H
#endif // CORE_POTRANSLATOR_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QHASH_QURL_H
#define QHASH_QURL_H
#ifndef CORE_QHASH_QURL_H_
#define CORE_QHASH_QURL_H_
#include <QUrl>
@ -24,4 +24,4 @@
inline uint qHash(const QUrl& url) { return qHash(url.toEncoded()); }
#endif
#endif // QHASH_QURL_H
#endif // CORE_QHASH_QURL_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTFSLISTENER_H
#define QTFSLISTENER_H
#ifndef CORE_QTFSLISTENER_H_
#define CORE_QTFSLISTENER_H_
#include "filesystemwatcherinterface.h"
@ -25,7 +25,7 @@
class QtFSListener : public FileSystemWatcherInterface {
Q_OBJECT
public:
QtFSListener(QObject* parent);
explicit QtFSListener(QObject* parent);
virtual void AddPath(const QString& path);
virtual void RemovePath(const QString& path);
virtual void Clear();
@ -34,4 +34,4 @@ class QtFSListener : public FileSystemWatcherInterface {
QFileSystemWatcher watcher_;
};
#endif
#endif // CORE_QTFSLISTENER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QXTGLOBALSHORTCUTBACKEND_H
#define QXTGLOBALSHORTCUTBACKEND_H
#ifndef CORE_QXTGLOBALSHORTCUTBACKEND_H_
#define CORE_QXTGLOBALSHORTCUTBACKEND_H_
#include "globalshortcutbackend.h"
@ -24,7 +24,7 @@ class QxtGlobalShortcut;
class QxtGlobalShortcutBackend : public GlobalShortcutBackend {
public:
QxtGlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
explicit QxtGlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
protected:
bool DoRegister();
@ -35,4 +35,4 @@ class QxtGlobalShortcutBackend : public GlobalShortcutBackend {
QList<QxtGlobalShortcut*> shortcuts_;
};
#endif // QXTGLOBALSHORTCUTBACKEND_H
#endif // CORE_QXTGLOBALSHORTCUTBACKEND_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SETTINGSPROVIDER_H
#define SETTINGSPROVIDER_H
#ifndef CORE_SETTINGSPROVIDER_H_
#define CORE_SETTINGSPROVIDER_H_
#include <QVariant>
#include <QSettings>
@ -55,4 +55,4 @@ class DefaultSettingsProvider : public SettingsProvider {
QSettings backend_;
};
#endif // SETTINGSPROVIDER_H
#endif // CORE_SETTINGSPROVIDER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SIGNALCHECKER_H
#define SIGNALCHECKER_H
#ifndef CORE_SIGNALCHECKER_H_
#define CORE_SIGNALCHECKER_H_
#include <glib-object.h>
@ -34,4 +34,4 @@ bool CheckedGConnect(gpointer source, const char* signal, GCallback callback,
CheckedGConnect(source, signal, G_CALLBACK(callback), data, \
FUNCTION_ARITY(callback));
#endif // SIGNALCHECKER_H
#endif // CORE_SIGNALCHECKER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SIMPLETREEITEM_H
#define SIMPLETREEITEM_H
#ifndef CORE_SIMPLETREEITEM_H_
#define CORE_SIMPLETREEITEM_H_
#include "simpletreemodel.h"
@ -154,4 +154,4 @@ T* SimpleTreeItem<T>::ChildByKey(const QString& key) const {
return nullptr;
}
#endif // SIMPLETREEITEM_H
#endif // CORE_SIMPLETREEITEM_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SIMPLETREEMODEL_H
#define SIMPLETREEMODEL_H
#ifndef CORE_SIMPLETREEMODEL_H_
#define CORE_SIMPLETREEMODEL_H_
#include <QAbstractItemModel>
@ -148,4 +148,4 @@ void SimpleTreeModel<T>::EmitDataChanged(T* item) {
emit dataChanged(index, index);
}
#endif // SIMPLETREEMODEL_H
#endif // CORE_SIMPLETREEMODEL_H_

View File

@ -614,7 +614,7 @@ void Song::InitFromQuery(const SqlRow& q, bool reliable_metadata, int col) {
void Song::InitFromFilePartial(const QString& filename) {
set_url(QUrl::fromLocalFile(filename));
// We currently rely on filename suffix to know if it's a music file or not.
// TODO: I know this is not satisfying, but currently, we rely on TagLib
// TODO(Arnaud Bienner): I know this is not satisfying, but currently, we rely on TagLib
// which seems to have the behavior (filename checks). Someday, it would be
// nice to perform some magic tests everywhere.
QFileInfo info(filename);
@ -680,7 +680,7 @@ void Song::InitFromItdb(const Itdb_Track* track, const QString& prefix) {
d->ctime_ = track->time_added;
d->filesize_ = track->size;
d->filetype_ = track->type2 ? Type_Mpeg : Type_Mp4;
d->rating_ = float(track->rating) / 100; // 100 = 20 * 5 stars
d->rating_ = static_cast<float>(track->rating) / 100; // 100 = 20 * 5 stars
d->playcount_ = track->playcount;
d->skipcount_ = track->skipcount;
d->lastplayed_ = track->time_played;
@ -747,7 +747,7 @@ void Song::InitFromMTP(const LIBMTP_track_t* track, const QString& host) {
d->mtime_ = track->modificationdate;
d->ctime_ = track->modificationdate;
d->rating_ = float(track->rating) / 100;
d->rating_ = static_cast<float>(track->rating) / 100;
d->playcount_ = track->usecount;
switch (track->filetype) {
@ -1043,7 +1043,7 @@ bool Song::IsEditable() const {
}
bool Song::operator==(const Song& other) const {
// TODO: this isn't working for radios
// TODO(Paweł Bara): this isn't working for radios
return url() == other.url() &&
beginning_nanosec() == other.beginning_nanosec();
}

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SONG_H
#define SONG_H
#ifndef CORE_SONG_H_
#define CORE_SONG_H_
#include <QFuture>
#include <QImage>
@ -301,4 +301,4 @@ uint qHash(const Song& song);
// Hash function using field checked in IsSimilar function
uint HashSimilar(const Song& song);
#endif // SONG_H
#endif // CORE_SONG_H_

View File

@ -162,7 +162,7 @@ void SongLoader::AudioCDTracksTagsLoaded(const SongList& songs) {
songs_ = songs;
emit LoadAudioCDFinished(true);
}
#endif // HAVE_AUDIOCD
#endif // HAVE_AUDIOCD
SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
qLog(Debug) << "Loading local file" << filename;
@ -195,7 +195,6 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
}
void SongLoader::LoadLocalAsync(const QString& filename) {
// First check to see if it's a directory - if so we will load all the songs
// inside right away.
if (QFileInfo(filename).isDir()) {
@ -233,7 +232,7 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
SongList song_list = cue_parser_->Load(&cue, matching_cue,
QDir(filename.section('/', 0, -2)));
for (Song song: song_list){
for (Song song : song_list) {
if (song.is_valid()) songs_ << song;
}
return;
@ -242,7 +241,9 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
// Assume it's just a normal file
Song song;
song.InitFromFilePartial(filename);
if (song.is_valid()) songs_ << song;
if (song.is_valid()) {
songs_ << song;
}
}
void SongLoader::LoadMetadataBlocking() {

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SONGLOADER_H
#define SONGLOADER_H
#ifndef CORE_SONGLOADER_H_
#define CORE_SONGLOADER_H_
#include <functional>
#include <memory>
@ -41,6 +41,7 @@ class CddaSongLoader;
class SongLoader : public QObject {
Q_OBJECT
public:
SongLoader(LibraryBackendInterface* library, const Player* player,
QObject* parent = nullptr);
@ -73,7 +74,7 @@ class SongLoader : public QObject {
void LoadMetadataBlocking();
Result LoadAudioCD();
signals:
signals:
void AudioCDTracksLoaded();
void LoadAudioCDFinished(bool success);
void LoadRemoteFinished();
@ -84,7 +85,7 @@ signals:
#ifdef HAVE_AUDIOCD
void AudioCDTracksLoadedSlot(const SongList& songs);
void AudioCDTracksTagsLoaded(const SongList& songs);
#endif // HAVE_AUDIOCD
#endif // HAVE_AUDIOCD
private:
enum State { WaitingForType, WaitingForMagic, WaitingForData, Finished, };
@ -142,4 +143,4 @@ signals:
QThreadPool thread_pool_;
};
#endif // SONGLOADER_H
#endif // CORE_SONGLOADER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef STYLESHEETLOADER_H
#define STYLESHEETLOADER_H
#ifndef CORE_STYLESHEETLOADER_H_
#define CORE_STYLESHEETLOADER_H_
#include <QString>
#include <QPalette>
@ -25,7 +25,7 @@
class StyleSheetLoader : public QObject {
public:
StyleSheetLoader(QObject* parent = nullptr);
explicit StyleSheetLoader(QObject* parent = nullptr);
// Sets the given stylesheet on the given widget.
// If the stylesheet contains strings like %palette-[role], these get replaced
@ -45,4 +45,4 @@ class StyleSheetLoader : public QObject {
QMap<QWidget*, QString> filenames_;
};
#endif // STYLESHEETLOADER_H
#endif // CORE_STYLESHEETLOADER_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TAGREADERCLIENT_H
#define TAGREADERCLIENT_H
#ifndef CORE_TAGREADERCLIENT_H_
#define CORE_TAGREADERCLIENT_H_
#include "song.h"
#include "tagreadermessages.pb.h"
@ -32,7 +32,7 @@ class TagReaderClient : public QObject {
Q_OBJECT
public:
TagReaderClient(QObject* parent = nullptr);
explicit TagReaderClient(QObject* parent = nullptr);
typedef AbstractMessageHandler<pb::tagreader::Message> HandlerType;
typedef HandlerType::ReplyType ReplyType;
@ -61,7 +61,7 @@ class TagReaderClient : public QObject {
bool IsMediaFileBlocking(const QString& filename);
QImage LoadEmbeddedArtBlocking(const QString& filename);
// TODO: Make this not a singleton
// TODO(David Sansome): Make this not a singleton
static TagReaderClient* Instance() { return sInstance; }
public slots:
@ -80,4 +80,4 @@ class TagReaderClient : public QObject {
typedef TagReaderClient::ReplyType TagReaderReply;
#endif // TAGREADERCLIENT_H
#endif // CORE_TAGREADERCLIENT_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TASKMANAGER_H
#define TASKMANAGER_H
#ifndef CORE_TASKMANAGER_H_
#define CORE_TASKMANAGER_H_
#include <QMap>
#include <QMutex>
@ -26,7 +26,7 @@ class TaskManager : public QObject {
Q_OBJECT
public:
TaskManager(QObject* parent = nullptr);
explicit TaskManager(QObject* parent = nullptr);
struct Task {
int id;
@ -60,7 +60,7 @@ class TaskManager : public QObject {
void SetTaskFinished(int id);
int GetTaskProgress(int id);
signals:
signals:
void TasksChanged();
void PauseLibraryWatchers();
@ -74,4 +74,4 @@ signals:
Q_DISABLE_COPY(TaskManager);
};
#endif // TASKMANAGER_H
#endif // CORE_TASKMANAGER_H_

View File

@ -18,8 +18,8 @@
// it is used by the Spotify blob which links against libspotify and is not GPL
// compatible.
#ifndef TIMECONSTANTS_H
#define TIMECONSTANTS_H
#ifndef CORE_TIMECONSTANTS_H_
#define CORE_TIMECONSTANTS_H_
#include <QtGlobal>
@ -33,4 +33,4 @@ const qint64 kNsecPerSec = 1000000000ll;
const qint64 kSecsPerDay = 24 * 60 * 60;
#endif // TIMECONSTANTS_H
#endif // CORE_TIMECONSTANTS_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBUNTUUNITYHACK_H
#define UBUNTUUNITYHACK_H
#ifndef CORE_UBUNTUUNITYHACK_H_
#define CORE_UBUNTUUNITYHACK_H_
#include <QObject>
@ -25,7 +25,7 @@ class QProcess;
class UbuntuUnityHack : public QObject {
Q_OBJECT
public:
UbuntuUnityHack(QObject* parent = nullptr);
explicit UbuntuUnityHack(QObject* parent = nullptr);
private slots:
void GetFinished(int exit_code);
@ -37,4 +37,4 @@ class UbuntuUnityHack : public QObject {
static const char* kUnitySystrayWhitelist;
};
#endif // UBUNTUUNITYHACK_H
#endif // CORE_UBUNTUUNITYHACK_H_

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef URLHANDLER_H
#define URLHANDLER_H
#ifndef CORE_URLHANDLER_H_
#define CORE_URLHANDLER_H_
#include <QIcon>
#include <QObject>
@ -26,7 +26,7 @@ class UrlHandler : public QObject {
Q_OBJECT
public:
UrlHandler(QObject* parent = nullptr);
explicit UrlHandler(QObject* parent = nullptr);
// The URL scheme that this handler handles.
virtual QString scheme() const = 0;
@ -75,11 +75,11 @@ class UrlHandler : public QObject {
// Functions to be warned when something happen to a track handled by
// UrlHandler.
virtual void TrackAboutToEnd() {};
virtual void TrackSkipped() {};
virtual void TrackAboutToEnd() {}
virtual void TrackSkipped() {}
signals:
signals:
void AsyncLoadComplete(const UrlHandler::LoadResult& result);
};
#endif // URLHANDLER_H
#endif // CORE_URLHANDLER_H_

View File

@ -91,9 +91,9 @@ QString PrettyTime(int seconds) {
QString ret;
if (hours)
ret.sprintf("%d:%02d:%02d", hours, minutes, seconds);
ret.sprintf("%d:%02d:%02d", hours, minutes, seconds); // NOLINT(runtime/printf)
else
ret.sprintf("%d:%02d", minutes, seconds);
ret.sprintf("%d:%02d", minutes, seconds); // NOLINT(runtime/printf)
return ret;
}
@ -105,7 +105,7 @@ QString PrettyTimeNanosec(qint64 nanoseconds) {
QString WordyTime(quint64 seconds) {
quint64 days = seconds / (60 * 60 * 24);
// TODO: Make the plural rules translatable
// TODO(David Sansome): Make the plural rules translatable
QStringList parts;
if (days) parts << (days == 1 ? tr("1 day") : tr("%1 days").arg(days));
@ -152,11 +152,11 @@ QString PrettySize(quint64 bytes) {
if (bytes <= 1000)
ret = QString::number(bytes) + " bytes";
else if (bytes <= 1000 * 1000)
ret.sprintf("%.1f KB", float(bytes) / 1000);
ret.sprintf("%.1f KB", static_cast<float>(bytes) / 1000); // NOLINT(runtime/printf)
else if (bytes <= 1000 * 1000 * 1000)
ret.sprintf("%.1f MB", float(bytes) / (1000 * 1000));
ret.sprintf("%.1f MB", static_cast<float>(bytes) / (1000 * 1000)); // NOLINT(runtime/printf)
else
ret.sprintf("%.1f GB", float(bytes) / (1000 * 1000 * 1000));
ret.sprintf("%.1f GB", static_cast<float>(bytes) / (1000 * 1000 * 1000)); // NOLINT(runtime/printf)
}
return ret;
}
@ -419,8 +419,8 @@ QByteArray Hmac(const QByteArray& key, const QByteArray& data,
const int kBlockSize = 64; // bytes
Q_ASSERT(key.length() <= kBlockSize);
QByteArray inner_padding(kBlockSize, char(0x36));
QByteArray outer_padding(kBlockSize, char(0x5c));
QByteArray inner_padding(kBlockSize, static_cast<char>(0x36));
QByteArray outer_padding(kBlockSize, static_cast<char>(0x5c));
for (int i = 0; i < key.length(); ++i) {
inner_padding[i] = inner_padding[i] ^ key[i];
@ -475,7 +475,7 @@ QByteArray Sha256(const QByteArray& data) {
}
// File must not be open and will be closed afterwards!
QByteArray Sha1File(QFile& file) {
QByteArray Sha1File(const QFile& file) {
file.open(QIODevice::ReadOnly);
QCryptographicHash hash(QCryptographicHash::Sha1);
QByteArray data;

View File

@ -15,8 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UTILITIES_H
#define UTILITIES_H
#ifndef CORE_UTILITIES_H_
#define CORE_UTILITIES_H_
#include <memory>
@ -64,7 +64,7 @@ QByteArray HmacMd5(const QByteArray& key, const QByteArray& data);
QByteArray HmacSha256(const QByteArray& key, const QByteArray& data);
QByteArray HmacSha1(const QByteArray& key, const QByteArray& data);
QByteArray Sha256(const QByteArray& data);
QByteArray Sha1File(QFile& file);
QByteArray Sha1File(const QFile& file);
QByteArray Sha1CoverHash(const QString& artist, const QString& album);
// Picks an unused ephemeral port number. Doesn't hold the port open so
@ -145,11 +145,11 @@ int GetThreadId();
bool IsLaptop();
QString SystemLanguageName();
}
} // namespace Utilities
class ScopedWCharArray {
public:
ScopedWCharArray(const QString& str);
explicit ScopedWCharArray(const QString& str);
QString ToString() const { return QString::fromWCharArray(data_.get()); }
@ -166,4 +166,4 @@ class ScopedWCharArray {
std::unique_ptr<wchar_t[]> data_;
};
#endif // UTILITIES_H
#endif // CORE_UTILITIES_H_