Clean up src/core
This commit is contained in:
parent
978a91442c
commit
0af1470cce
@ -15,15 +15,15 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef APPEARANCE_H
|
#ifndef CORE_APPEARANCE_H_
|
||||||
#define APPEARANCE_H
|
#define CORE_APPEARANCE_H_
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
|
||||||
class Appearance : public QObject {
|
class Appearance : public QObject {
|
||||||
public:
|
public:
|
||||||
Appearance(QObject* parent = nullptr);
|
explicit Appearance(QObject* parent = nullptr);
|
||||||
// Load the user preferred theme, which could the default system theme or a
|
// Load the user preferred theme, which could the default system theme or a
|
||||||
// custom set of colors that user has chosen
|
// custom set of colors that user has chosen
|
||||||
void LoadUserTheme();
|
void LoadUserTheme();
|
||||||
@ -42,4 +42,4 @@ class Appearance : public QObject {
|
|||||||
QColor background_color_;
|
QColor background_color_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPEARANCE_H
|
#endif // CORE_APPEARANCE_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef APPLICATION_H
|
#ifndef CORE_APPLICATION_H_
|
||||||
#define APPLICATION_H
|
#define CORE_APPLICATION_H_
|
||||||
|
|
||||||
#include "ui/settingsdialog.h"
|
#include "ui/settingsdialog.h"
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class Application : public QObject {
|
|||||||
public:
|
public:
|
||||||
static bool kIsPortable;
|
static bool kIsPortable;
|
||||||
|
|
||||||
Application(QObject* parent = nullptr);
|
explicit Application(QObject* parent = nullptr);
|
||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
const QString& language_name() const { return language_name_; }
|
const QString& language_name() const { return language_name_; }
|
||||||
@ -100,7 +100,7 @@ class Application : public QObject {
|
|||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
|
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ErrorAdded(const QString& message);
|
void ErrorAdded(const QString& message);
|
||||||
void SettingsChanged();
|
void SettingsChanged();
|
||||||
void SettingsDialogRequested(SettingsDialog::Page page);
|
void SettingsDialogRequested(SettingsDialog::Page page);
|
||||||
@ -136,4 +136,4 @@ signals:
|
|||||||
QList<QThread*> threads_;
|
QList<QThread*> threads_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPLICATION_H
|
#endif // CORE_APPLICATION_H_
|
||||||
|
@ -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 "backgroundstreams.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
#ifndef BACKGROUNDSTREAMS_H
|
/* This file is part of Clementine.
|
||||||
#define BACKGROUNDSTREAMS_H
|
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 <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -12,8 +30,9 @@ class QAction;
|
|||||||
|
|
||||||
class BackgroundStreams : public QObject {
|
class BackgroundStreams : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BackgroundStreams(EngineBase* engine, QObject* parent = nullptr);
|
BackgroundStreams(EngineBase* engine, QObject* parent = nullptr);
|
||||||
~BackgroundStreams();
|
~BackgroundStreams();
|
||||||
|
|
||||||
void LoadStreams();
|
void LoadStreams();
|
||||||
@ -29,7 +48,7 @@ class BackgroundStreams : public QObject {
|
|||||||
|
|
||||||
void AddAction(const QString& name, QAction* action);
|
void AddAction(const QString& name, QAction* action);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StreamStarted(const QString& name);
|
void StreamStarted(const QString& name);
|
||||||
void StreamStopped(const QString& name);
|
void StreamStopped(const QString& name);
|
||||||
|
|
||||||
@ -65,4 +84,4 @@ signals:
|
|||||||
static const char* kEnterpriseUrl;
|
static const char* kEnterpriseUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_BACKGROUNDSTREAMS_H_
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
#ifndef BOUNDFUTUREWATCHER_H
|
/* This file is part of Clementine.
|
||||||
#define BOUNDFUTUREWATCHER_H
|
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>
|
#include <QFutureWatcher>
|
||||||
|
|
||||||
@ -19,4 +36,4 @@ class BoundFutureWatcher : public QFutureWatcher<T>, boost::noncopyable {
|
|||||||
D data_;
|
D data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_BOUNDFUTUREWATCHER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CACHEDLIST_H
|
#ifndef CORE_CACHEDLIST_H_
|
||||||
#define CACHEDLIST_H
|
#define CORE_CACHEDLIST_H_
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -98,4 +98,4 @@ class CachedList {
|
|||||||
ListType data_;
|
ListType data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CACHEDLIST_H
|
#endif // CORE_CACHEDLIST_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMMANDLINEOPTIONS_H
|
#ifndef CORE_COMMANDLINEOPTIONS_H_
|
||||||
#define COMMANDLINEOPTIONS_H
|
#define CORE_COMMANDLINEOPTIONS_H_
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@ -114,4 +114,4 @@ class CommandlineOptions {
|
|||||||
QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a);
|
QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a);
|
||||||
QDataStream& operator>>(QDataStream& s, CommandlineOptions& a);
|
QDataStream& operator>>(QDataStream& s, CommandlineOptions& a);
|
||||||
|
|
||||||
#endif // COMMANDLINEOPTIONS_H
|
#endif // CORE_COMMANDLINEOPTIONS_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CRASHREPORTING_H
|
#ifndef CORE_CRASHREPORTING_H_
|
||||||
#define CRASHREPORTING_H
|
#define CORE_CRASHREPORTING_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ class CrashSender : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CrashSender(const QString& path);
|
explicit CrashSender(const QString& path);
|
||||||
|
|
||||||
// Returns false if the user doesn't want to send the crash report (caller
|
// 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).
|
// should exit), or true if he does (caller should start the Qt event loop).
|
||||||
@ -90,4 +90,4 @@ class CrashSender : public QObject {
|
|||||||
QProgressDialog* progress_;
|
QProgressDialog* progress_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CRASHREPORTING_H
|
#endif // CORE_CRASHREPORTING_H_
|
||||||
|
@ -379,7 +379,7 @@ void Database::AttachDatabase(const QString& database_name,
|
|||||||
|
|
||||||
void Database::AttachDatabaseOnDbConnection(const QString& database_name,
|
void Database::AttachDatabaseOnDbConnection(const QString& database_name,
|
||||||
const AttachedDatabase& database,
|
const AttachedDatabase& database,
|
||||||
QSqlDatabase& db) {
|
const QSqlDatabase& db) {
|
||||||
AttachDatabase(database_name, database);
|
AttachDatabase(database_name, database);
|
||||||
|
|
||||||
// Attach the db
|
// Attach the db
|
||||||
@ -408,7 +408,7 @@ void Database::DetachDatabase(const QString& database_name) {
|
|||||||
attached_databases_.remove(database_name);
|
attached_databases_.remove(database_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::UpdateDatabaseSchema(int version, QSqlDatabase& db) {
|
void Database::UpdateDatabaseSchema(int version, const QSqlDatabase& db) {
|
||||||
QString filename;
|
QString filename;
|
||||||
if (version == 0)
|
if (version == 0)
|
||||||
filename = ":/schema/schema.sql";
|
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 select(QString("SELECT ROWID, filename FROM %1").arg(table), db);
|
||||||
QSqlQuery update(
|
QSqlQuery update(
|
||||||
QString("UPDATE %1 SET filename=:filename WHERE ROWID=:id").arg(table),
|
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,
|
const QString& filename,
|
||||||
int schema_version,
|
int schema_version,
|
||||||
bool in_transaction) {
|
bool in_transaction) {
|
||||||
@ -475,7 +475,7 @@ void Database::ExecSchemaCommandsFromFile(QSqlDatabase& db,
|
|||||||
schema_version, in_transaction);
|
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) {
|
int schema_version, bool in_transaction) {
|
||||||
// Run each command
|
// Run each command
|
||||||
const QStringList commands(schema.split(QRegExp("; *\n\n")));
|
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& song_tables,
|
||||||
const QStringList& commands) {
|
const QStringList& commands) {
|
||||||
for (const QString& command : 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;
|
QStringList ret;
|
||||||
|
|
||||||
// look for the tables in the main db
|
// look for the tables in the main db
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DATABASE_H
|
#ifndef CORE_DATABASE_H_
|
||||||
#define DATABASE_H
|
#define CORE_DATABASE_H_
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -30,7 +30,6 @@
|
|||||||
#include "gtest/gtest_prod.h"
|
#include "gtest/gtest_prod.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
struct sqlite3_tokenizer;
|
struct sqlite3_tokenizer;
|
||||||
struct sqlite3_tokenizer_cursor;
|
struct sqlite3_tokenizer_cursor;
|
||||||
struct sqlite3_tokenizer_module;
|
struct sqlite3_tokenizer_module;
|
||||||
@ -65,7 +64,7 @@ class Database : public QObject {
|
|||||||
QMutex* Mutex() { return &mutex_; }
|
QMutex* Mutex() { return &mutex_; }
|
||||||
|
|
||||||
void RecreateAttachedDb(const QString& database_name);
|
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 schema_version, bool in_transaction = false);
|
||||||
|
|
||||||
int startup_schema_version() const { return startup_schema_version_; }
|
int startup_schema_version() const { return startup_schema_version_; }
|
||||||
@ -75,10 +74,10 @@ class Database : public QObject {
|
|||||||
const AttachedDatabase& database);
|
const AttachedDatabase& database);
|
||||||
void AttachDatabaseOnDbConnection(const QString& database_name,
|
void AttachDatabaseOnDbConnection(const QString& database_name,
|
||||||
const AttachedDatabase& database,
|
const AttachedDatabase& database,
|
||||||
QSqlDatabase& db);
|
const QSqlDatabase& db);
|
||||||
void DetachDatabase(const QString& database_name);
|
void DetachDatabase(const QString& database_name);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Error(const QString& message);
|
void Error(const QString& message);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -87,16 +86,16 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void UpdateMainSchema(QSqlDatabase* db);
|
void UpdateMainSchema(QSqlDatabase* db);
|
||||||
|
|
||||||
void ExecSchemaCommandsFromFile(QSqlDatabase& db, const QString& filename,
|
void ExecSchemaCommandsFromFile(const QSqlDatabase& db, const QString& filename,
|
||||||
int schema_version,
|
int schema_version,
|
||||||
bool in_transaction = false);
|
bool in_transaction = false);
|
||||||
void ExecSongTablesCommands(QSqlDatabase& db, const QStringList& song_tables,
|
void ExecSongTablesCommands(const QSqlDatabase& db, const QStringList& song_tables,
|
||||||
const QStringList& commands);
|
const QStringList& commands);
|
||||||
|
|
||||||
void UpdateDatabaseSchema(int version, QSqlDatabase& db);
|
void UpdateDatabaseSchema(int version, const QSqlDatabase& db);
|
||||||
void UrlEncodeFilenameColumn(const QString& table, QSqlDatabase& db);
|
void UrlEncodeFilenameColumn(const QString& table, const QSqlDatabase& db);
|
||||||
QStringList SongsTables(QSqlDatabase& db, int schema_version) const;
|
QStringList SongsTables(const QSqlDatabase& db, int schema_version) const;
|
||||||
bool IntegrityCheck(QSqlDatabase db);
|
bool IntegrityCheck(const QSqlDatabase db);
|
||||||
void BackupFile(const QString& filename);
|
void BackupFile(const QString& filename);
|
||||||
bool OpenDatabase(const QString& filename, sqlite3** connection) const;
|
bool OpenDatabase(const QString& filename, sqlite3** connection) const;
|
||||||
|
|
||||||
@ -183,4 +182,4 @@ class MemoryDatabase : public Database {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATABASE_H
|
#endif // CORE_DATABASE_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DELETEFILES_H
|
#ifndef CORE_DELETEFILES_H_
|
||||||
#define DELETEFILES_H
|
#define CORE_DELETEFILES_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class DeleteFiles : public QObject {
|
|||||||
void Start(const SongList& songs);
|
void Start(const SongList& songs);
|
||||||
void Start(const QStringList& filenames);
|
void Start(const QStringList& filenames);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Finished(const SongList& songs_with_errors);
|
void Finished(const SongList& songs_with_errors);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -61,4 +61,4 @@ signals:
|
|||||||
SongList songs_with_errors_;
|
SongList songs_with_errors_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DELETEFILES_H
|
#endif // CORE_DELETEFILES_H_
|
||||||
|
@ -58,11 +58,11 @@ void FHT::makeCasTable(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float* FHT::copy(float* d, float* s) {
|
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) {
|
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) {
|
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;
|
int n = m_num / 2, i, j, k, *r;
|
||||||
if (!m_log) {
|
if (!m_log) {
|
||||||
m_log = new int[n];
|
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++) {
|
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;
|
*r = j >= n ? n - 1 : j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,9 +87,9 @@ void FHT::logSpectrum(float* out, float* p) {
|
|||||||
*out++ = *p = *p / 100;
|
*out++ = *p = *p / 100;
|
||||||
for (k = i = 1, r = m_log; i < n; i++) {
|
for (k = i = 1, r = m_log; i < n; i++) {
|
||||||
j = *r++;
|
j = *r++;
|
||||||
if (i == j)
|
if (i == j) {
|
||||||
*out++ = p[i];
|
*out++ = p[i];
|
||||||
else {
|
} else {
|
||||||
float base = p[k - 1];
|
float base = p[k - 1];
|
||||||
float step = (p[j] - base) / (j - (k - 1));
|
float step = (p[j] - base) / (j - (k - 1));
|
||||||
for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr;
|
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) {
|
void FHT::spectrum(float* p) {
|
||||||
power2(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) {
|
void FHT::power(float* p) {
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
#ifndef FHT_H
|
#ifndef CORE_FHT_H_
|
||||||
#define FHT_H
|
#define CORE_FHT_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Hartley Transform after Bracewell's discrete
|
* 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.
|
* should be at least 3. Values of more than 3 need a trigonometry table.
|
||||||
* @see makeCasTable()
|
* @see makeCasTable()
|
||||||
*/
|
*/
|
||||||
FHT(int);
|
explicit FHT(int);
|
||||||
|
|
||||||
~FHT();
|
~FHT();
|
||||||
inline int sizeExp() const { return m_exp2; }
|
inline int sizeExp() const { return m_exp2; }
|
||||||
@ -115,4 +115,4 @@ class FHT {
|
|||||||
void transform(float*);
|
void transform(float*);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_FHT_H_
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FILESYSTEMMUSICSTORAGE_H
|
#ifndef CORE_FILESYSTEMMUSICSTORAGE_H_
|
||||||
#define FILESYSTEMMUSICSTORAGE_H
|
#define CORE_FILESYSTEMMUSICSTORAGE_H_
|
||||||
|
|
||||||
#include "musicstorage.h"
|
#include "musicstorage.h"
|
||||||
|
|
||||||
class FilesystemMusicStorage : public virtual MusicStorage {
|
class FilesystemMusicStorage : public virtual MusicStorage {
|
||||||
public:
|
public:
|
||||||
FilesystemMusicStorage(const QString& root);
|
explicit FilesystemMusicStorage(const QString& root);
|
||||||
~FilesystemMusicStorage() {}
|
~FilesystemMusicStorage() {}
|
||||||
|
|
||||||
QString LocalPath() const { return root_; }
|
QString LocalPath() const { return root_; }
|
||||||
@ -34,4 +34,4 @@ class FilesystemMusicStorage : public virtual MusicStorage {
|
|||||||
QString root_;
|
QString root_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FILESYSTEMMUSICSTORAGE_H
|
#endif // CORE_FILESYSTEMMUSICSTORAGE_H_
|
||||||
|
@ -15,15 +15,15 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FILESYSTEMWATCHERINTERFACE_H
|
#ifndef CORE_FILESYSTEMWATCHERINTERFACE_H_
|
||||||
#define FILESYSTEMWATCHERINTERFACE_H
|
#define CORE_FILESYSTEMWATCHERINTERFACE_H_
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class FileSystemWatcherInterface : public QObject {
|
class FileSystemWatcherInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FileSystemWatcherInterface(QObject* parent = nullptr);
|
explicit FileSystemWatcherInterface(QObject* parent = nullptr);
|
||||||
virtual void Init() {}
|
virtual void Init() {}
|
||||||
virtual void AddPath(const QString& path) = 0;
|
virtual void AddPath(const QString& path) = 0;
|
||||||
virtual void RemovePath(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);
|
static FileSystemWatcherInterface* Create(QObject* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PathChanged(const QString& path);
|
void PathChanged(const QString& path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_FILESYSTEMWATCHERINTERFACE_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GLOBALSHORTCUTBACKEND_H
|
#ifndef CORE_GLOBALSHORTCUTBACKEND_H_
|
||||||
#define GLOBALSHORTCUTBACKEND_H
|
#define CORE_GLOBALSHORTCUTBACKEND_H_
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ class GlobalShortcutBackend : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
|
explicit GlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
|
||||||
virtual ~GlobalShortcutBackend() {}
|
virtual ~GlobalShortcutBackend() {}
|
||||||
|
|
||||||
bool is_active() const { return active_; }
|
bool is_active() const { return active_; }
|
||||||
@ -34,7 +34,7 @@ class GlobalShortcutBackend : public QObject {
|
|||||||
bool Register();
|
bool Register();
|
||||||
void Unregister();
|
void Unregister();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void RegisterFinished(bool success);
|
void RegisterFinished(bool success);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -45,4 +45,4 @@ signals:
|
|||||||
bool active_;
|
bool active_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLOBALSHORTCUTBACKEND_H
|
#endif // CORE_GLOBALSHORTCUTBACKEND_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GLOBALSHORTCUTS_H
|
#ifndef CORE_GLOBALSHORTCUTS_H_
|
||||||
#define GLOBALSHORTCUTS_H
|
#define CORE_GLOBALSHORTCUTS_H_
|
||||||
|
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
@ -33,7 +33,7 @@ class GlobalShortcuts : public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GlobalShortcuts(QWidget* parent = nullptr);
|
explicit GlobalShortcuts(QWidget* parent = nullptr);
|
||||||
|
|
||||||
static const char* kSettingsGroup;
|
static const char* kSettingsGroup;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class GlobalShortcuts : public QWidget {
|
|||||||
void Unregister();
|
void Unregister();
|
||||||
void Register();
|
void Register();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Play();
|
void Play();
|
||||||
void Pause();
|
void Pause();
|
||||||
void PlayPause();
|
void PlayPause();
|
||||||
@ -96,4 +96,4 @@ signals:
|
|||||||
QSignalMapper* rating_signals_mapper_;
|
QSignalMapper* rating_signals_mapper_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_GLOBALSHORTCUTS_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GNOMEGLOBALSHORTCUTBACKEND_H
|
#ifndef CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
|
||||||
#define GNOMEGLOBALSHORTCUTBACKEND_H
|
#define CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
|
||||||
|
|
||||||
#include "globalshortcutbackend.h"
|
#include "globalshortcutbackend.h"
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class GnomeGlobalShortcutBackend : public GlobalShortcutBackend {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GnomeGlobalShortcutBackend(GlobalShortcuts* parent);
|
explicit GnomeGlobalShortcutBackend(GlobalShortcuts* parent);
|
||||||
|
|
||||||
static const char* kGsdService;
|
static const char* kGsdService;
|
||||||
static const char* kGsdPath;
|
static const char* kGsdPath;
|
||||||
@ -49,4 +49,4 @@ class GnomeGlobalShortcutBackend : public GlobalShortcutBackend {
|
|||||||
bool is_connected_;
|
bool is_connected_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GNOMEGLOBALSHORTCUTBACKEND_H
|
#endif // CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
|
||||||
|
@ -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>
|
#import <AppKit/NSApplication.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -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
|
#ifndef MAC_STARTUP_H
|
||||||
#define MAC_STARTUP_H
|
#define MAC_STARTUP_H
|
||||||
|
|
||||||
@ -32,4 +50,4 @@ void EnableFullScreen(const QWidget& main_window);
|
|||||||
|
|
||||||
} // namespace mac
|
} // namespace mac
|
||||||
|
|
||||||
#endif
|
#endif // MAC_STARTUP_H
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MACFSLISTENER_H
|
#ifndef CORE_MACFSLISTENER_H_
|
||||||
#define MACFSLISTENER_H
|
#define CORE_MACFSLISTENER_H_
|
||||||
|
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class MacFSListener : public FileSystemWatcherInterface {
|
|||||||
void RemovePath(const QString& path);
|
void RemovePath(const QString& path);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PathChanged(const QString& path);
|
void PathChanged(const QString& path);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -57,4 +57,4 @@ signals:
|
|||||||
QTimer update_timer_;
|
QTimer update_timer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_MACFSLISTENER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MACGLOBALSHORTCUTBACKEND_H
|
#ifndef CORE_MACGLOBALSHORTCUTBACKEND_H_
|
||||||
#define MACGLOBALSHORTCUTBACKEND_H
|
#define CORE_MACGLOBALSHORTCUTBACKEND_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ class MacGlobalShortcutBackend : public GlobalShortcutBackend {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MacGlobalShortcutBackend(GlobalShortcuts* parent);
|
explicit MacGlobalShortcutBackend(GlobalShortcuts* parent);
|
||||||
virtual ~MacGlobalShortcutBackend();
|
virtual ~MacGlobalShortcutBackend();
|
||||||
|
|
||||||
bool IsAccessibilityEnabled() const;
|
bool IsAccessibilityEnabled() const;
|
||||||
@ -53,4 +53,4 @@ class MacGlobalShortcutBackend : public GlobalShortcutBackend {
|
|||||||
std::unique_ptr<MacGlobalShortcutBackendPrivate> p_;
|
std::unique_ptr<MacGlobalShortcutBackendPrivate> p_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MACGLOBALSHORTCUTBACKEND_H
|
#endif // CORE_MACGLOBALSHORTCUTBACKEND_H_
|
||||||
|
@ -44,7 +44,7 @@ std::size_t hash_value(const QModelIndex& index) { return qHash(index); }
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct Mapping {
|
struct Mapping {
|
||||||
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;
|
||||||
};
|
};
|
||||||
@ -190,7 +190,7 @@ void MergedProxyModel::SourceModelReset() {
|
|||||||
void MergedProxyModel::SubModelReset() {
|
void MergedProxyModel::SubModelReset() {
|
||||||
QAbstractItemModel* submodel = static_cast<QAbstractItemModel*>(sender());
|
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
|
// in LibraryModel and catch those here - that will let us do away with this
|
||||||
// std::numeric_limits<int>::max() hack.
|
// std::numeric_limits<int>::max() hack.
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MERGEDPROXYMODEL_H
|
#ifndef CORE_MERGEDPROXYMODEL_H_
|
||||||
#define MERGEDPROXYMODEL_H
|
#define CORE_MERGEDPROXYMODEL_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class MergedProxyModel : public QAbstractProxyModel {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MergedProxyModel(QObject* parent = nullptr);
|
explicit MergedProxyModel(QObject* parent = nullptr);
|
||||||
~MergedProxyModel();
|
~MergedProxyModel();
|
||||||
|
|
||||||
// Make another model appear as a child of the given item in the source model.
|
// 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 mapFromSource(const QModelIndexList& source_indexes) const;
|
||||||
QModelIndexList mapToSource(const QModelIndexList& proxy_indexes) const;
|
QModelIndexList mapToSource(const QModelIndexList& proxy_indexes) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SubModelReset(const QModelIndex& root, QAbstractItemModel* model);
|
void SubModelReset(const QModelIndex& root, QAbstractItemModel* model);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -107,4 +107,4 @@ signals:
|
|||||||
std::unique_ptr<MergedProxyModelPrivate> p_;
|
std::unique_ptr<MergedProxyModelPrivate> p_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MERGEDPROXYMODEL_H
|
#endif // CORE_MERGEDPROXYMODEL_H_
|
||||||
|
@ -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 "metatypes.h"
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
@ -1,6 +1,23 @@
|
|||||||
#ifndef METATYPES_H
|
/* This file is part of Clementine.
|
||||||
#define METATYPES_H
|
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();
|
void RegisterMetaTypes();
|
||||||
|
|
||||||
#endif
|
#endif // CORE_METATYPES_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MIMEDATA_H
|
#ifndef CORE_MIMEDATA_H_
|
||||||
#define MIMEDATA_H
|
#define CORE_MIMEDATA_H_
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
|
||||||
@ -72,4 +72,4 @@ class MimeData : public QMimeData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MIMEDATA_H
|
#endif // CORE_MIMEDATA_H_
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
#ifndef MODELFUTUREWATCHER_H
|
/* This file is part of Clementine.
|
||||||
#define MODELFUTUREWATCHER_H
|
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 <QFutureWatcher>
|
||||||
#include <QPersistentModelIndex>
|
#include <QPersistentModelIndex>
|
||||||
@ -18,4 +35,4 @@ class ModelFutureWatcher : public QFutureWatcher<T> {
|
|||||||
QPersistentModelIndex index_;
|
QPersistentModelIndex index_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_MODELFUTUREWATCHER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MPRIS_H
|
#ifndef CORE_MPRIS_H_
|
||||||
#define MPRIS_H
|
#define CORE_MPRIS_H_
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class Mpris : public QObject {
|
|||||||
public:
|
public:
|
||||||
Mpris(Application* app, QObject* parent = nullptr);
|
Mpris(Application* app, QObject* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void RaiseMainWindow();
|
void RaiseMainWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -43,4 +43,4 @@ signals:
|
|||||||
|
|
||||||
} // namespace mpris
|
} // namespace mpris
|
||||||
|
|
||||||
#endif // MPRIS_H
|
#endif // CORE_MPRIS_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MPRIS1_H
|
#ifndef CORE_MPRIS1_H_
|
||||||
#define MPRIS1_H
|
#define CORE_MPRIS1_H_
|
||||||
|
|
||||||
#include "core/player.h"
|
#include "core/player.h"
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ class Mpris1Player : public QObject {
|
|||||||
void CurrentSongChanged(const Song& song, const QString& art_uri,
|
void CurrentSongChanged(const Song& song, const QString& art_uri,
|
||||||
const QImage&);
|
const QImage&);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void CapsChange(int);
|
void CapsChange(int);
|
||||||
void TrackChange(const QVariantMap&);
|
void TrackChange(const QVariantMap&);
|
||||||
void StatusChange(DBusStatus);
|
void StatusChange(DBusStatus);
|
||||||
@ -184,7 +184,7 @@ class Mpris1TrackList : public QObject {
|
|||||||
// Amarok extension
|
// Amarok extension
|
||||||
void PlayTrack(int index);
|
void PlayTrack(int index);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void TrackListChange(int i);
|
void TrackListChange(int i);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -196,4 +196,4 @@ signals:
|
|||||||
|
|
||||||
} // namespace mpris
|
} // namespace mpris
|
||||||
|
|
||||||
#endif // MPRIS1_H
|
#endif // CORE_MPRIS1_H_
|
||||||
|
@ -345,7 +345,7 @@ void Mpris2::ArtLoaded(const Song& song, const QString& art_uri) {
|
|||||||
|
|
||||||
double Mpris2::Volume() const {
|
double Mpris2::Volume() const {
|
||||||
if (mpris1_->player()) {
|
if (mpris1_->player()) {
|
||||||
return double(mpris1_->player()->VolumeGet()) / 100;
|
return static_cast<double>(mpris1_->player()->VolumeGet()) / 100;
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
@ -458,28 +458,28 @@ void Mpris2::OpenUri(const QString& uri) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrackIds Mpris2::Tracks() const {
|
TrackIds Mpris2::Tracks() const {
|
||||||
// TODO
|
// TODO(John Maguire): ?
|
||||||
return TrackIds();
|
return TrackIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mpris2::CanEditTracks() const { return false; }
|
bool Mpris2::CanEditTracks() const { return false; }
|
||||||
|
|
||||||
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds& tracks) const {
|
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds& tracks) const {
|
||||||
// TODO
|
// TODO(John Maguire): ?
|
||||||
return TrackMetadata();
|
return TrackMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::AddTrack(const QString& uri, const QDBusObjectPath& afterTrack,
|
void Mpris2::AddTrack(const QString& uri, const QDBusObjectPath& afterTrack,
|
||||||
bool setAsCurrent) {
|
bool setAsCurrent) {
|
||||||
// TODO
|
// TODO(John Maguire): ?
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::RemoveTrack(const QDBusObjectPath& trackId) {
|
void Mpris2::RemoveTrack(const QDBusObjectPath& trackId) {
|
||||||
// TODO
|
// TODO(John Maguire): ?
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::GoTo(const QDBusObjectPath& trackId) {
|
void Mpris2::GoTo(const QDBusObjectPath& trackId) {
|
||||||
// TODO
|
// TODO(John Maguire): ?
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 Mpris2::PlaylistCount() const {
|
quint32 Mpris2::PlaylistCount() const {
|
||||||
@ -529,7 +529,7 @@ void Mpris2::ActivatePlaylist(const QDBusObjectPath& playlist_id) {
|
|||||||
app_->player()->Next();
|
app_->player()->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Support sort orders.
|
// TODO(John Maguire): Support sort orders.
|
||||||
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count,
|
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count,
|
||||||
const QString& order,
|
const QString& order,
|
||||||
bool reverse_order) {
|
bool reverse_order) {
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MPRIS2_H
|
#ifndef CORE_MPRIS2_H_
|
||||||
#define MPRIS2_H
|
#define CORE_MPRIS2_H_
|
||||||
|
|
||||||
#include "playlist/playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class Mpris2 : public QObject {
|
|||||||
QList<MprisPlaylist> GetPlaylists(quint32 index, quint32 max_count,
|
QList<MprisPlaylist> GetPlaylists(quint32 index, quint32 max_count,
|
||||||
const QString& order, bool reverse_order);
|
const QString& order, bool reverse_order);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Player
|
// Player
|
||||||
void Seeked(qlonglong position);
|
void Seeked(qlonglong position);
|
||||||
|
|
||||||
@ -228,4 +228,4 @@ signals:
|
|||||||
|
|
||||||
} // namespace mpris
|
} // namespace mpris
|
||||||
|
|
||||||
#endif
|
#endif // CORE_MPRIS2_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MPRIS_COMMON_H
|
#ifndef CORE_MPRIS_COMMON_H_
|
||||||
#define MPRIS_COMMON_H
|
#define CORE_MPRIS_COMMON_H_
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -58,4 +58,4 @@ inline QString AsMPRISDateTimeType(uint time) {
|
|||||||
|
|
||||||
} // namespace mpris
|
} // namespace mpris
|
||||||
|
|
||||||
#endif // MPRIS_COMMON_H
|
#endif // CORE_MPRIS_COMMON_H_
|
||||||
|
@ -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 "multisortfilterproxy.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
|
@ -1,11 +1,29 @@
|
|||||||
#ifndef MULTISORTFILTERPROXY_H
|
/* This file is part of Clementine.
|
||||||
#define MULTISORTFILTERPROXY_H
|
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>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
class MultiSortFilterProxy : public QSortFilterProxyModel {
|
class MultiSortFilterProxy : public QSortFilterProxyModel {
|
||||||
public:
|
public:
|
||||||
MultiSortFilterProxy(QObject* parent = nullptr);
|
explicit MultiSortFilterProxy(QObject* parent = nullptr);
|
||||||
|
|
||||||
void AddSortSpec(int role, Qt::SortOrder order = Qt::AscendingOrder);
|
void AddSortSpec(int role, Qt::SortOrder order = Qt::AscendingOrder);
|
||||||
|
|
||||||
@ -19,4 +37,4 @@ class MultiSortFilterProxy : public QSortFilterProxyModel {
|
|||||||
QList<SortSpec> sorting_;
|
QList<SortSpec> sorting_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MULTISORTFILTERPROXY_H
|
#endif // CORE_MULTISORTFILTERPROXY_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MUSICSTORAGE_H
|
#ifndef CORE_MUSICSTORAGE_H_
|
||||||
#define MUSICSTORAGE_H
|
#define CORE_MUSICSTORAGE_H_
|
||||||
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
|
||||||
@ -86,4 +86,4 @@ class MusicStorage {
|
|||||||
Q_DECLARE_METATYPE(MusicStorage*);
|
Q_DECLARE_METATYPE(MusicStorage*);
|
||||||
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
|
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
|
||||||
|
|
||||||
#endif // MUSICSTORAGE_H
|
#endif // CORE_MUSICSTORAGE_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NETWORK_H
|
#ifndef CORE_NETWORK_H_
|
||||||
#define NETWORK_H
|
#define CORE_NETWORK_H_
|
||||||
|
|
||||||
#include <QAbstractNetworkCache>
|
#include <QAbstractNetworkCache>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -27,7 +27,7 @@ class QNetworkDiskCache;
|
|||||||
|
|
||||||
class ThreadSafeNetworkDiskCache : public QAbstractNetworkCache {
|
class ThreadSafeNetworkDiskCache : public QAbstractNetworkCache {
|
||||||
public:
|
public:
|
||||||
ThreadSafeNetworkDiskCache(QObject* parent);
|
explicit ThreadSafeNetworkDiskCache(QObject* parent);
|
||||||
|
|
||||||
qint64 cacheSize() const;
|
qint64 cacheSize() const;
|
||||||
QIODevice* data(const QUrl& url);
|
QIODevice* data(const QUrl& url);
|
||||||
@ -48,7 +48,7 @@ class NetworkAccessManager : public QNetworkAccessManager {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkAccessManager(QObject* parent = nullptr);
|
explicit NetworkAccessManager(QObject* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QNetworkReply* createRequest(Operation op, const QNetworkRequest& request,
|
QNetworkReply* createRequest(Operation op, const QNetworkRequest& request,
|
||||||
@ -78,7 +78,7 @@ class RedirectFollower : public QObject {
|
|||||||
QByteArray readAll() { return current_reply_->readAll(); }
|
QByteArray readAll() { return current_reply_->readAll(); }
|
||||||
void abort() { current_reply_->abort(); }
|
void abort() { current_reply_->abort(); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// These are all forwarded from the current reply.
|
// These are all forwarded from the current reply.
|
||||||
void readyRead();
|
void readyRead();
|
||||||
void error(QNetworkReply::NetworkError);
|
void error(QNetworkReply::NetworkError);
|
||||||
@ -106,7 +106,7 @@ class NetworkTimeouts : public QObject {
|
|||||||
public:
|
public:
|
||||||
NetworkTimeouts(int timeout_msec, QObject* parent = nullptr);
|
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(QNetworkReply* reply);
|
||||||
void AddReply(RedirectFollower* reply);
|
void AddReply(RedirectFollower* reply);
|
||||||
void SetTimeout(int msec) { timeout_msec_ = msec; }
|
void SetTimeout(int msec) { timeout_msec_ = msec; }
|
||||||
@ -124,4 +124,4 @@ class NetworkTimeouts : public QObject {
|
|||||||
QMap<RedirectFollower*, int> redirect_timers_;
|
QMap<RedirectFollower*, int> redirect_timers_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETWORK_H
|
#endif // CORE_NETWORK_H_
|
||||||
|
@ -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 "networkproxyfactory.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
#ifndef NETWORKPROXYFACTORY_H
|
/* This file is part of Clementine.
|
||||||
#define NETWORKPROXYFACTORY_H
|
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 <QMutex>
|
||||||
#include <QNetworkProxyFactory>
|
#include <QNetworkProxyFactory>
|
||||||
@ -37,4 +55,4 @@ class NetworkProxyFactory : public QNetworkProxyFactory {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETWORKPROXYFACTORY_H
|
#endif // CORE_NETWORKPROXYFACTORY_H_
|
||||||
|
@ -189,9 +189,8 @@ void Organise::ProcessSomeFiles() {
|
|||||||
|
|
||||||
if (!destination_->CopyToStorage(job)) {
|
if (!destination_->CopyToStorage(job)) {
|
||||||
files_with_errors_ << task.song_info_.song_.basefilename();
|
files_with_errors_ << task.song_info_.song_.basefilename();
|
||||||
}
|
} else {
|
||||||
else {
|
if (job.mark_as_listened_) {
|
||||||
if(job.mark_as_listened_) {
|
|
||||||
emit FileCopied(job.metadata_.id());
|
emit FileCopied(job.metadata_.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ORGANISE_H
|
#ifndef CORE_ORGANISE_H_
|
||||||
#define ORGANISE_H
|
#define CORE_ORGANISE_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class Organise : public QObject {
|
|||||||
|
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Finished(const QStringList& files_with_errors);
|
void Finished(const QStringList& files_with_errors);
|
||||||
void FileCopied(int database_id);
|
void FileCopied(int database_id);
|
||||||
|
|
||||||
@ -111,4 +111,4 @@ signals:
|
|||||||
QStringList files_with_errors_;
|
QStringList files_with_errors_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ORGANISE_H
|
#endif // CORE_ORGANISE_H_
|
||||||
|
@ -232,7 +232,7 @@ QString OrganiseFormat::TagValue(const QString& tag, const Song& song) const {
|
|||||||
|
|
||||||
OrganiseFormat::Validator::Validator(QObject* parent) : QValidator(parent) {}
|
OrganiseFormat::Validator::Validator(QObject* parent) : QValidator(parent) {}
|
||||||
|
|
||||||
QValidator::State OrganiseFormat::Validator::validate(QString& input,
|
QValidator::State OrganiseFormat::Validator::validate(const QString& input,
|
||||||
int&) const {
|
int&) const {
|
||||||
QRegExp tag_regexp(kTagPattern);
|
QRegExp tag_regexp(kTagPattern);
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SRC_CORE_ORGANISEFORMAT_H_
|
#ifndef CORE_ORGANISEFORMAT_H_
|
||||||
#define SRC_CORE_ORGANISEFORMAT_H_
|
#define CORE_ORGANISEFORMAT_H_
|
||||||
|
|
||||||
#include <QSyntaxHighlighter>
|
#include <QSyntaxHighlighter>
|
||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
@ -51,7 +51,7 @@ class OrganiseFormat {
|
|||||||
class Validator : public QValidator {
|
class Validator : public QValidator {
|
||||||
public:
|
public:
|
||||||
explicit Validator(QObject* parent = nullptr);
|
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 {
|
class SyntaxHighlighter : public QSyntaxHighlighter {
|
||||||
@ -80,4 +80,4 @@ class OrganiseFormat {
|
|||||||
bool replace_the_;
|
bool replace_the_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SRC_CORE_ORGANISEFORMAT_H_
|
#endif // CORE_ORGANISEFORMAT_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PLAYER_H
|
#ifndef CORE_PLAYER_H_
|
||||||
#define PLAYER_H
|
#define CORE_PLAYER_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ class PlayerInterface : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayerInterface(QObject* parent = nullptr) : QObject(parent) {}
|
explicit PlayerInterface(QObject* parent = nullptr) : QObject(parent) {}
|
||||||
|
|
||||||
virtual EngineBase* engine() const = 0;
|
virtual EngineBase* engine() const = 0;
|
||||||
virtual Engine::State GetState() const = 0;
|
virtual Engine::State GetState() const = 0;
|
||||||
@ -82,7 +82,7 @@ class PlayerInterface : public QObject {
|
|||||||
virtual void Play() = 0;
|
virtual void Play() = 0;
|
||||||
virtual void ShowOSD() = 0;
|
virtual void ShowOSD() = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Playing();
|
void Playing();
|
||||||
void Paused();
|
void Paused();
|
||||||
void Stopped();
|
void Stopped();
|
||||||
@ -190,4 +190,4 @@ class Player : public PlayerInterface {
|
|||||||
int volume_before_mute_;
|
int volume_before_mute_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLAYER_H
|
#endif // CORE_PLAYER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POTRANSLATOR_H
|
#ifndef CORE_POTRANSLATOR_H_
|
||||||
#define POTRANSLATOR_H
|
#define CORE_POTRANSLATOR_H_
|
||||||
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
@ -34,4 +34,4 @@ class PoTranslator : public QTranslator {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // POTRANSLATOR_H
|
#endif // CORE_POTRANSLATOR_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QHASH_QURL_H
|
#ifndef CORE_QHASH_QURL_H_
|
||||||
#define QHASH_QURL_H
|
#define CORE_QHASH_QURL_H_
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
@ -24,4 +24,4 @@
|
|||||||
inline uint qHash(const QUrl& url) { return qHash(url.toEncoded()); }
|
inline uint qHash(const QUrl& url) { return qHash(url.toEncoded()); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // QHASH_QURL_H
|
#endif // CORE_QHASH_QURL_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QTFSLISTENER_H
|
#ifndef CORE_QTFSLISTENER_H_
|
||||||
#define QTFSLISTENER_H
|
#define CORE_QTFSLISTENER_H_
|
||||||
|
|
||||||
#include "filesystemwatcherinterface.h"
|
#include "filesystemwatcherinterface.h"
|
||||||
|
|
||||||
@ -25,7 +25,7 @@
|
|||||||
class QtFSListener : public FileSystemWatcherInterface {
|
class QtFSListener : public FileSystemWatcherInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QtFSListener(QObject* parent);
|
explicit QtFSListener(QObject* parent);
|
||||||
virtual void AddPath(const QString& path);
|
virtual void AddPath(const QString& path);
|
||||||
virtual void RemovePath(const QString& path);
|
virtual void RemovePath(const QString& path);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
@ -34,4 +34,4 @@ class QtFSListener : public FileSystemWatcherInterface {
|
|||||||
QFileSystemWatcher watcher_;
|
QFileSystemWatcher watcher_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // CORE_QTFSLISTENER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QXTGLOBALSHORTCUTBACKEND_H
|
#ifndef CORE_QXTGLOBALSHORTCUTBACKEND_H_
|
||||||
#define QXTGLOBALSHORTCUTBACKEND_H
|
#define CORE_QXTGLOBALSHORTCUTBACKEND_H_
|
||||||
|
|
||||||
#include "globalshortcutbackend.h"
|
#include "globalshortcutbackend.h"
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class QxtGlobalShortcut;
|
|||||||
|
|
||||||
class QxtGlobalShortcutBackend : public GlobalShortcutBackend {
|
class QxtGlobalShortcutBackend : public GlobalShortcutBackend {
|
||||||
public:
|
public:
|
||||||
QxtGlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
|
explicit QxtGlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool DoRegister();
|
bool DoRegister();
|
||||||
@ -35,4 +35,4 @@ class QxtGlobalShortcutBackend : public GlobalShortcutBackend {
|
|||||||
QList<QxtGlobalShortcut*> shortcuts_;
|
QList<QxtGlobalShortcut*> shortcuts_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QXTGLOBALSHORTCUTBACKEND_H
|
#endif // CORE_QXTGLOBALSHORTCUTBACKEND_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SETTINGSPROVIDER_H
|
#ifndef CORE_SETTINGSPROVIDER_H_
|
||||||
#define SETTINGSPROVIDER_H
|
#define CORE_SETTINGSPROVIDER_H_
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -55,4 +55,4 @@ class DefaultSettingsProvider : public SettingsProvider {
|
|||||||
QSettings backend_;
|
QSettings backend_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSPROVIDER_H
|
#endif // CORE_SETTINGSPROVIDER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIGNALCHECKER_H
|
#ifndef CORE_SIGNALCHECKER_H_
|
||||||
#define SIGNALCHECKER_H
|
#define CORE_SIGNALCHECKER_H_
|
||||||
|
|
||||||
#include <glib-object.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, \
|
CheckedGConnect(source, signal, G_CALLBACK(callback), data, \
|
||||||
FUNCTION_ARITY(callback));
|
FUNCTION_ARITY(callback));
|
||||||
|
|
||||||
#endif // SIGNALCHECKER_H
|
#endif // CORE_SIGNALCHECKER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIMPLETREEITEM_H
|
#ifndef CORE_SIMPLETREEITEM_H_
|
||||||
#define SIMPLETREEITEM_H
|
#define CORE_SIMPLETREEITEM_H_
|
||||||
|
|
||||||
#include "simpletreemodel.h"
|
#include "simpletreemodel.h"
|
||||||
|
|
||||||
@ -154,4 +154,4 @@ T* SimpleTreeItem<T>::ChildByKey(const QString& key) const {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SIMPLETREEITEM_H
|
#endif // CORE_SIMPLETREEITEM_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIMPLETREEMODEL_H
|
#ifndef CORE_SIMPLETREEMODEL_H_
|
||||||
#define SIMPLETREEMODEL_H
|
#define CORE_SIMPLETREEMODEL_H_
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
@ -148,4 +148,4 @@ void SimpleTreeModel<T>::EmitDataChanged(T* item) {
|
|||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SIMPLETREEMODEL_H
|
#endif // CORE_SIMPLETREEMODEL_H_
|
||||||
|
@ -614,7 +614,7 @@ void Song::InitFromQuery(const SqlRow& q, bool reliable_metadata, int col) {
|
|||||||
void Song::InitFromFilePartial(const QString& filename) {
|
void Song::InitFromFilePartial(const QString& filename) {
|
||||||
set_url(QUrl::fromLocalFile(filename));
|
set_url(QUrl::fromLocalFile(filename));
|
||||||
// We currently rely on filename suffix to know if it's a music file or not.
|
// 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
|
// which seems to have the behavior (filename checks). Someday, it would be
|
||||||
// nice to perform some magic tests everywhere.
|
// nice to perform some magic tests everywhere.
|
||||||
QFileInfo info(filename);
|
QFileInfo info(filename);
|
||||||
@ -680,7 +680,7 @@ void Song::InitFromItdb(const Itdb_Track* track, const QString& prefix) {
|
|||||||
d->ctime_ = track->time_added;
|
d->ctime_ = track->time_added;
|
||||||
d->filesize_ = track->size;
|
d->filesize_ = track->size;
|
||||||
d->filetype_ = track->type2 ? Type_Mpeg : Type_Mp4;
|
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->playcount_ = track->playcount;
|
||||||
d->skipcount_ = track->skipcount;
|
d->skipcount_ = track->skipcount;
|
||||||
d->lastplayed_ = track->time_played;
|
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->mtime_ = track->modificationdate;
|
||||||
d->ctime_ = track->modificationdate;
|
d->ctime_ = track->modificationdate;
|
||||||
|
|
||||||
d->rating_ = float(track->rating) / 100;
|
d->rating_ = static_cast<float>(track->rating) / 100;
|
||||||
d->playcount_ = track->usecount;
|
d->playcount_ = track->usecount;
|
||||||
|
|
||||||
switch (track->filetype) {
|
switch (track->filetype) {
|
||||||
@ -1043,7 +1043,7 @@ bool Song::IsEditable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Song::operator==(const Song& other) 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() &&
|
return url() == other.url() &&
|
||||||
beginning_nanosec() == other.beginning_nanosec();
|
beginning_nanosec() == other.beginning_nanosec();
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SONG_H
|
#ifndef CORE_SONG_H_
|
||||||
#define SONG_H
|
#define CORE_SONG_H_
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
@ -301,4 +301,4 @@ uint qHash(const Song& song);
|
|||||||
// Hash function using field checked in IsSimilar function
|
// Hash function using field checked in IsSimilar function
|
||||||
uint HashSimilar(const Song& song);
|
uint HashSimilar(const Song& song);
|
||||||
|
|
||||||
#endif // SONG_H
|
#endif // CORE_SONG_H_
|
||||||
|
@ -162,7 +162,7 @@ void SongLoader::AudioCDTracksTagsLoaded(const SongList& songs) {
|
|||||||
songs_ = songs;
|
songs_ = songs;
|
||||||
emit LoadAudioCDFinished(true);
|
emit LoadAudioCDFinished(true);
|
||||||
}
|
}
|
||||||
#endif // HAVE_AUDIOCD
|
#endif // HAVE_AUDIOCD
|
||||||
|
|
||||||
SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
|
SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
|
||||||
qLog(Debug) << "Loading local file" << filename;
|
qLog(Debug) << "Loading local file" << filename;
|
||||||
@ -195,7 +195,6 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SongLoader::LoadLocalAsync(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
|
// First check to see if it's a directory - if so we will load all the songs
|
||||||
// inside right away.
|
// inside right away.
|
||||||
if (QFileInfo(filename).isDir()) {
|
if (QFileInfo(filename).isDir()) {
|
||||||
@ -233,7 +232,7 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
|
|||||||
|
|
||||||
SongList song_list = cue_parser_->Load(&cue, matching_cue,
|
SongList song_list = cue_parser_->Load(&cue, matching_cue,
|
||||||
QDir(filename.section('/', 0, -2)));
|
QDir(filename.section('/', 0, -2)));
|
||||||
for (Song song: song_list){
|
for (Song song : song_list) {
|
||||||
if (song.is_valid()) songs_ << song;
|
if (song.is_valid()) songs_ << song;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -242,7 +241,9 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
|
|||||||
// Assume it's just a normal file
|
// Assume it's just a normal file
|
||||||
Song song;
|
Song song;
|
||||||
song.InitFromFilePartial(filename);
|
song.InitFromFilePartial(filename);
|
||||||
if (song.is_valid()) songs_ << song;
|
if (song.is_valid()) {
|
||||||
|
songs_ << song;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongLoader::LoadMetadataBlocking() {
|
void SongLoader::LoadMetadataBlocking() {
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SONGLOADER_H
|
#ifndef CORE_SONGLOADER_H_
|
||||||
#define SONGLOADER_H
|
#define CORE_SONGLOADER_H_
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -41,6 +41,7 @@ class CddaSongLoader;
|
|||||||
|
|
||||||
class SongLoader : public QObject {
|
class SongLoader : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SongLoader(LibraryBackendInterface* library, const Player* player,
|
SongLoader(LibraryBackendInterface* library, const Player* player,
|
||||||
QObject* parent = nullptr);
|
QObject* parent = nullptr);
|
||||||
@ -73,7 +74,7 @@ class SongLoader : public QObject {
|
|||||||
void LoadMetadataBlocking();
|
void LoadMetadataBlocking();
|
||||||
Result LoadAudioCD();
|
Result LoadAudioCD();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void AudioCDTracksLoaded();
|
void AudioCDTracksLoaded();
|
||||||
void LoadAudioCDFinished(bool success);
|
void LoadAudioCDFinished(bool success);
|
||||||
void LoadRemoteFinished();
|
void LoadRemoteFinished();
|
||||||
@ -84,7 +85,7 @@ signals:
|
|||||||
#ifdef HAVE_AUDIOCD
|
#ifdef HAVE_AUDIOCD
|
||||||
void AudioCDTracksLoadedSlot(const SongList& songs);
|
void AudioCDTracksLoadedSlot(const SongList& songs);
|
||||||
void AudioCDTracksTagsLoaded(const SongList& songs);
|
void AudioCDTracksTagsLoaded(const SongList& songs);
|
||||||
#endif // HAVE_AUDIOCD
|
#endif // HAVE_AUDIOCD
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum State { WaitingForType, WaitingForMagic, WaitingForData, Finished, };
|
enum State { WaitingForType, WaitingForMagic, WaitingForData, Finished, };
|
||||||
@ -142,4 +143,4 @@ signals:
|
|||||||
QThreadPool thread_pool_;
|
QThreadPool thread_pool_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SONGLOADER_H
|
#endif // CORE_SONGLOADER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef STYLESHEETLOADER_H
|
#ifndef CORE_STYLESHEETLOADER_H_
|
||||||
#define STYLESHEETLOADER_H
|
#define CORE_STYLESHEETLOADER_H_
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class StyleSheetLoader : public QObject {
|
class StyleSheetLoader : public QObject {
|
||||||
public:
|
public:
|
||||||
StyleSheetLoader(QObject* parent = nullptr);
|
explicit StyleSheetLoader(QObject* parent = nullptr);
|
||||||
|
|
||||||
// Sets the given stylesheet on the given widget.
|
// Sets the given stylesheet on the given widget.
|
||||||
// If the stylesheet contains strings like %palette-[role], these get replaced
|
// If the stylesheet contains strings like %palette-[role], these get replaced
|
||||||
@ -45,4 +45,4 @@ class StyleSheetLoader : public QObject {
|
|||||||
QMap<QWidget*, QString> filenames_;
|
QMap<QWidget*, QString> filenames_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STYLESHEETLOADER_H
|
#endif // CORE_STYLESHEETLOADER_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TAGREADERCLIENT_H
|
#ifndef CORE_TAGREADERCLIENT_H_
|
||||||
#define TAGREADERCLIENT_H
|
#define CORE_TAGREADERCLIENT_H_
|
||||||
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "tagreadermessages.pb.h"
|
#include "tagreadermessages.pb.h"
|
||||||
@ -32,7 +32,7 @@ class TagReaderClient : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TagReaderClient(QObject* parent = nullptr);
|
explicit TagReaderClient(QObject* parent = nullptr);
|
||||||
|
|
||||||
typedef AbstractMessageHandler<pb::tagreader::Message> HandlerType;
|
typedef AbstractMessageHandler<pb::tagreader::Message> HandlerType;
|
||||||
typedef HandlerType::ReplyType ReplyType;
|
typedef HandlerType::ReplyType ReplyType;
|
||||||
@ -61,7 +61,7 @@ class TagReaderClient : public QObject {
|
|||||||
bool IsMediaFileBlocking(const QString& filename);
|
bool IsMediaFileBlocking(const QString& filename);
|
||||||
QImage LoadEmbeddedArtBlocking(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; }
|
static TagReaderClient* Instance() { return sInstance; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -80,4 +80,4 @@ class TagReaderClient : public QObject {
|
|||||||
|
|
||||||
typedef TagReaderClient::ReplyType TagReaderReply;
|
typedef TagReaderClient::ReplyType TagReaderReply;
|
||||||
|
|
||||||
#endif // TAGREADERCLIENT_H
|
#endif // CORE_TAGREADERCLIENT_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TASKMANAGER_H
|
#ifndef CORE_TASKMANAGER_H_
|
||||||
#define TASKMANAGER_H
|
#define CORE_TASKMANAGER_H_
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -26,7 +26,7 @@ class TaskManager : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskManager(QObject* parent = nullptr);
|
explicit TaskManager(QObject* parent = nullptr);
|
||||||
|
|
||||||
struct Task {
|
struct Task {
|
||||||
int id;
|
int id;
|
||||||
@ -60,7 +60,7 @@ class TaskManager : public QObject {
|
|||||||
void SetTaskFinished(int id);
|
void SetTaskFinished(int id);
|
||||||
int GetTaskProgress(int id);
|
int GetTaskProgress(int id);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void TasksChanged();
|
void TasksChanged();
|
||||||
|
|
||||||
void PauseLibraryWatchers();
|
void PauseLibraryWatchers();
|
||||||
@ -74,4 +74,4 @@ signals:
|
|||||||
Q_DISABLE_COPY(TaskManager);
|
Q_DISABLE_COPY(TaskManager);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TASKMANAGER_H
|
#endif // CORE_TASKMANAGER_H_
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
// it is used by the Spotify blob which links against libspotify and is not GPL
|
// it is used by the Spotify blob which links against libspotify and is not GPL
|
||||||
// compatible.
|
// compatible.
|
||||||
|
|
||||||
#ifndef TIMECONSTANTS_H
|
#ifndef CORE_TIMECONSTANTS_H_
|
||||||
#define TIMECONSTANTS_H
|
#define CORE_TIMECONSTANTS_H_
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
@ -33,4 +33,4 @@ const qint64 kNsecPerSec = 1000000000ll;
|
|||||||
|
|
||||||
const qint64 kSecsPerDay = 24 * 60 * 60;
|
const qint64 kSecsPerDay = 24 * 60 * 60;
|
||||||
|
|
||||||
#endif // TIMECONSTANTS_H
|
#endif // CORE_TIMECONSTANTS_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UBUNTUUNITYHACK_H
|
#ifndef CORE_UBUNTUUNITYHACK_H_
|
||||||
#define UBUNTUUNITYHACK_H
|
#define CORE_UBUNTUUNITYHACK_H_
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class QProcess;
|
|||||||
class UbuntuUnityHack : public QObject {
|
class UbuntuUnityHack : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UbuntuUnityHack(QObject* parent = nullptr);
|
explicit UbuntuUnityHack(QObject* parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void GetFinished(int exit_code);
|
void GetFinished(int exit_code);
|
||||||
@ -37,4 +37,4 @@ class UbuntuUnityHack : public QObject {
|
|||||||
static const char* kUnitySystrayWhitelist;
|
static const char* kUnitySystrayWhitelist;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UBUNTUUNITYHACK_H
|
#endif // CORE_UBUNTUUNITYHACK_H_
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef URLHANDLER_H
|
#ifndef CORE_URLHANDLER_H_
|
||||||
#define URLHANDLER_H
|
#define CORE_URLHANDLER_H_
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -26,7 +26,7 @@ class UrlHandler : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UrlHandler(QObject* parent = nullptr);
|
explicit UrlHandler(QObject* parent = nullptr);
|
||||||
|
|
||||||
// The URL scheme that this handler handles.
|
// The URL scheme that this handler handles.
|
||||||
virtual QString scheme() const = 0;
|
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
|
// Functions to be warned when something happen to a track handled by
|
||||||
// UrlHandler.
|
// UrlHandler.
|
||||||
virtual void TrackAboutToEnd() {};
|
virtual void TrackAboutToEnd() {}
|
||||||
virtual void TrackSkipped() {};
|
virtual void TrackSkipped() {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void AsyncLoadComplete(const UrlHandler::LoadResult& result);
|
void AsyncLoadComplete(const UrlHandler::LoadResult& result);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // URLHANDLER_H
|
#endif // CORE_URLHANDLER_H_
|
||||||
|
@ -91,9 +91,9 @@ QString PrettyTime(int seconds) {
|
|||||||
|
|
||||||
QString ret;
|
QString ret;
|
||||||
if (hours)
|
if (hours)
|
||||||
ret.sprintf("%d:%02d:%02d", hours, minutes, seconds);
|
ret.sprintf("%d:%02d:%02d", hours, minutes, seconds); // NOLINT(runtime/printf)
|
||||||
else
|
else
|
||||||
ret.sprintf("%d:%02d", minutes, seconds);
|
ret.sprintf("%d:%02d", minutes, seconds); // NOLINT(runtime/printf)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ QString PrettyTimeNanosec(qint64 nanoseconds) {
|
|||||||
QString WordyTime(quint64 seconds) {
|
QString WordyTime(quint64 seconds) {
|
||||||
quint64 days = seconds / (60 * 60 * 24);
|
quint64 days = seconds / (60 * 60 * 24);
|
||||||
|
|
||||||
// TODO: Make the plural rules translatable
|
// TODO(David Sansome): Make the plural rules translatable
|
||||||
QStringList parts;
|
QStringList parts;
|
||||||
|
|
||||||
if (days) parts << (days == 1 ? tr("1 day") : tr("%1 days").arg(days));
|
if (days) parts << (days == 1 ? tr("1 day") : tr("%1 days").arg(days));
|
||||||
@ -152,11 +152,11 @@ QString PrettySize(quint64 bytes) {
|
|||||||
if (bytes <= 1000)
|
if (bytes <= 1000)
|
||||||
ret = QString::number(bytes) + " bytes";
|
ret = QString::number(bytes) + " bytes";
|
||||||
else if (bytes <= 1000 * 1000)
|
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)
|
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
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -419,8 +419,8 @@ QByteArray Hmac(const QByteArray& key, const QByteArray& data,
|
|||||||
const int kBlockSize = 64; // bytes
|
const int kBlockSize = 64; // bytes
|
||||||
Q_ASSERT(key.length() <= kBlockSize);
|
Q_ASSERT(key.length() <= kBlockSize);
|
||||||
|
|
||||||
QByteArray inner_padding(kBlockSize, char(0x36));
|
QByteArray inner_padding(kBlockSize, static_cast<char>(0x36));
|
||||||
QByteArray outer_padding(kBlockSize, char(0x5c));
|
QByteArray outer_padding(kBlockSize, static_cast<char>(0x5c));
|
||||||
|
|
||||||
for (int i = 0; i < key.length(); ++i) {
|
for (int i = 0; i < key.length(); ++i) {
|
||||||
inner_padding[i] = inner_padding[i] ^ key[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!
|
// File must not be open and will be closed afterwards!
|
||||||
QByteArray Sha1File(QFile& file) {
|
QByteArray Sha1File(const QFile& file) {
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UTILITIES_H
|
#ifndef CORE_UTILITIES_H_
|
||||||
#define UTILITIES_H
|
#define CORE_UTILITIES_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ QByteArray HmacMd5(const QByteArray& key, const QByteArray& data);
|
|||||||
QByteArray HmacSha256(const QByteArray& key, const QByteArray& data);
|
QByteArray HmacSha256(const QByteArray& key, const QByteArray& data);
|
||||||
QByteArray HmacSha1(const QByteArray& key, const QByteArray& data);
|
QByteArray HmacSha1(const QByteArray& key, const QByteArray& data);
|
||||||
QByteArray Sha256(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);
|
QByteArray Sha1CoverHash(const QString& artist, const QString& album);
|
||||||
|
|
||||||
// Picks an unused ephemeral port number. Doesn't hold the port open so
|
// Picks an unused ephemeral port number. Doesn't hold the port open so
|
||||||
@ -145,11 +145,11 @@ int GetThreadId();
|
|||||||
bool IsLaptop();
|
bool IsLaptop();
|
||||||
|
|
||||||
QString SystemLanguageName();
|
QString SystemLanguageName();
|
||||||
}
|
} // namespace Utilities
|
||||||
|
|
||||||
class ScopedWCharArray {
|
class ScopedWCharArray {
|
||||||
public:
|
public:
|
||||||
ScopedWCharArray(const QString& str);
|
explicit ScopedWCharArray(const QString& str);
|
||||||
|
|
||||||
QString ToString() const { return QString::fromWCharArray(data_.get()); }
|
QString ToString() const { return QString::fromWCharArray(data_.get()); }
|
||||||
|
|
||||||
@ -166,4 +166,4 @@ class ScopedWCharArray {
|
|||||||
std::unique_ptr<wchar_t[]> data_;
|
std::unique_ptr<wchar_t[]> data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UTILITIES_H
|
#endif // CORE_UTILITIES_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user