From 8424c18516d7036facaa42db3b0f50adc4710cf6 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 6 Feb 2014 14:48:00 +0100 Subject: [PATCH] Use c++11 instead of boost where possible. --- CMakeLists.txt | 18 ------ ext/libclementine-common/core/closure.h | 25 ++++---- ext/libclementine-common/core/concurrentrun.h | 21 ++++--- ext/libclementine-tagreader/fmpsparser.cpp | 11 +++- ext/libclementine-tagreader/tagreader.cpp | 18 +++--- src/CMakeLists.txt | 1 + src/config.h.in | 1 - src/core/deletefiles.cpp | 7 ++- src/core/deletefiles.h | 8 +-- src/core/mergedproxymodel.h | 3 + src/core/musicstorage.h | 10 ++-- src/core/organise.cpp | 19 ++++--- src/core/organise.h | 8 +-- src/core/player.cpp | 16 +++--- src/core/songloader.cpp | 12 ++-- src/core/songloader.h | 10 ++-- src/devices/devicemanager.cpp | 16 +++--- src/devices/devicemanager.h | 11 ++-- src/devices/deviceproperties.cpp | 22 +++---- src/devices/deviceview.cpp | 35 ++++++------ src/devices/giolister.cpp | 16 ++++-- src/engines/gstengine.cpp | 26 ++++----- src/engines/gstengine.h | 18 +++--- src/globalsearch/globalsearchview.cpp | 46 ++++++++------- src/library/groupbydialog.h | 5 ++ src/library/librarydirectorymodel.cpp | 2 +- src/library/librarydirectorymodel.h | 6 +- src/library/librarymodel.cpp | 26 +++++---- src/library/libraryview.cpp | 29 +++++----- src/main.cpp | 33 ++++++----- src/playlist/playlist.cpp | 54 +++++++++--------- src/playlist/playlistbackend.cpp | 42 ++++++++------ src/playlist/playlistbackend.h | 6 +- src/playlist/playlistitem.h | 8 +-- src/transcoder/transcoder.cpp | 8 +-- src/transcoder/transcoder.h | 7 +-- src/ui/mainwindow.cpp | 57 +++++++++---------- src/ui/organisedialog.cpp | 21 ++++--- src/widgets/fileview.h | 6 +- 39 files changed, 356 insertions(+), 332 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2122d7413..38c4cc1f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,24 +20,6 @@ if (APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") endif () -set(CMAKE_REQUIRED_FLAGS "-std=c++0x") -check_cxx_source_compiles( - "#include - int main() { - std::unordered_map m; - return 0; - } - " - USE_STD_UNORDERED_MAP) -check_cxx_source_compiles( - "int main() { - [](){}(); - } - " - HAVE_LAMBDAS) -unset(CMAKE_REQUIRED_FLAGS) - - if (UNIX AND NOT APPLE) set(LINUX 1) endif (UNIX AND NOT APPLE) diff --git a/ext/libclementine-common/core/closure.h b/ext/libclementine-common/core/closure.h index 2244a4a69..bb874d05f 100644 --- a/ext/libclementine-common/core/closure.h +++ b/ext/libclementine-common/core/closure.h @@ -19,22 +19,18 @@ #define CLOSURE_H #include +#include #include #include #include -#include -#include -#include -#include - namespace _detail { class ObjectHelper; // Interface for ObjectHelper to call on signal emission. -class ClosureBase : boost::noncopyable { +class ClosureBase { public: virtual ~ClosureBase(); virtual void Invoke() = 0; @@ -45,6 +41,9 @@ class ClosureBase : boost::noncopyable { protected: explicit ClosureBase(ObjectHelper*); ObjectHelper* helper_; + + private: + Q_DISABLE_COPY(ClosureBase); }; // QObject helper as templated QObjects do not work. @@ -62,7 +61,7 @@ class ObjectHelper : public QObject { void Invoked(); private: - boost::scoped_ptr closure_; + std::unique_ptr closure_; Q_DISABLE_COPY(ObjectHelper); }; @@ -92,8 +91,8 @@ class Closure : public ClosureBase { const char* slot, const Args&... args) : ClosureBase(new ObjectHelper(sender, signal, this)), - // boost::bind is the easiest way to store an argument list. - function_(boost::bind(&Closure::Call, this, args...)), + // std::bind is the easiest way to store an argument list. + function_(std::bind(&Closure::Call, this, args...)), receiver_(receiver) { const QMetaObject* meta_receiver = receiver->metaObject(); QByteArray normalised_slot = QMetaObject::normalizedSignature(slot + 1); @@ -126,7 +125,7 @@ class Closure : public ClosureBase { arg_list.size() > 9 ? arg_list[9] : QGenericArgument()); } - boost::function function_; + std::function function_; QObject* receiver_; QMetaMethod slot_; }; @@ -202,7 +201,7 @@ _detail::ClosureBase* NewClosure( const char* signal, std::function callback, const Args&... args) { - return NewClosure(sender, signal, boost::bind(callback, args...)); + return NewClosure(sender, signal, std::bind(callback, args...)); } template @@ -211,7 +210,7 @@ _detail::ClosureBase* NewClosure( const char* signal, void (*callback)(Args...), const Args&... args) { - return NewClosure(sender, signal, boost::bind(callback, args...)); + return NewClosure(sender, signal, std::bind(callback, args...)); } template @@ -220,7 +219,7 @@ _detail::ClosureBase* NewClosure( const char* signal, T* receiver, Unused (T::*callback)(Args...), const Args&... args) { - return NewClosure(sender, signal, boost::bind(callback, receiver, args...)); + return NewClosure(sender, signal, std::bind(callback, receiver, args...)); } diff --git a/ext/libclementine-common/core/concurrentrun.h b/ext/libclementine-common/core/concurrentrun.h index 119ee083a..58fc05577 100644 --- a/ext/libclementine-common/core/concurrentrun.h +++ b/ext/libclementine-common/core/concurrentrun.h @@ -18,8 +18,7 @@ #ifndef CONCURRENTRUN_H #define CONCURRENTRUN_H -#include -#include +#include #include #include @@ -69,9 +68,9 @@ class ThreadFunctorBase : public QFutureInterface, public QRunnable template class ThreadFunctor : public ThreadFunctorBase { public: - ThreadFunctor(boost::function function, + ThreadFunctor(std::function function, Args... args) - : function_(boost::bind(function, args...)) { + : function_(std::bind(function, args...)) { } virtual void run() { @@ -80,16 +79,16 @@ class ThreadFunctor : public ThreadFunctorBase { } private: - boost::function function_; + std::function function_; }; // Partial specialisation for void return type. template class ThreadFunctor : public ThreadFunctorBase { public: - ThreadFunctor(boost::function function, + ThreadFunctor(std::function function, Args... args) - : function_(boost::bind(function, args...)) { + : function_(std::bind(function, args...)) { } virtual void run() { @@ -98,7 +97,7 @@ class ThreadFunctor : public ThreadFunctorBase { } private: - boost::function function_; + std::function function_; }; @@ -111,7 +110,7 @@ namespace ConcurrentRun { template QFuture Run( QThreadPool* threadpool, - boost::function function) { + std::function function) { return (new ThreadFunctor(function))->Start(threadpool); } @@ -119,7 +118,7 @@ namespace ConcurrentRun { template QFuture Run( QThreadPool* threadpool, - boost::function function, + std::function function, const Args&... args) { return (new ThreadFunctor( function, args...))->Start(threadpool); @@ -132,7 +131,7 @@ namespace ConcurrentRun { ReturnType (*function) (Args...), const Args&... args) { return Run( - threadpool, boost::function(function), args...); + threadpool, std::function(function), args...); } } diff --git a/ext/libclementine-tagreader/fmpsparser.cpp b/ext/libclementine-tagreader/fmpsparser.cpp index 113f9f316..5eca59207 100644 --- a/ext/libclementine-tagreader/fmpsparser.cpp +++ b/ext/libclementine-tagreader/fmpsparser.cpp @@ -17,10 +17,13 @@ #include "fmpsparser.h" +#include + #include #include -#include +using std::placeholders::_1; +using std::placeholders::_2; FMPSParser::FMPSParser() : // The float regex ends with (?:$|(?=::|;;)) to ensure it matches all the way @@ -105,12 +108,14 @@ int FMPSParser::ParseValueRef(const QStringRef& data, QVariant* ret) const { // Parses an inner list - a list of values int FMPSParser::ParseListRef(const QStringRef& data, QVariantList* ret) const { - return ParseContainer<':'>(data, boost::bind(&FMPSParser::ParseValueRef, this, _1, _2), ret); + return ParseContainer<':'>( + data, std::bind(&FMPSParser::ParseValueRef, this, _1, _2), ret); } // Parses an outer list - a list of lists int FMPSParser::ParseListListRef(const QStringRef& data, Result* ret) const { - return ParseContainer<';'>(data, boost::bind(&FMPSParser::ParseListRef, this, _1, _2), ret); + return ParseContainer<';'>( + data, std::bind(&FMPSParser::ParseListRef, this, _1, _2), ret); } // Convenience functions that take QStrings instead of QStringRefs. Use the diff --git a/ext/libclementine-tagreader/tagreader.cpp b/ext/libclementine-tagreader/tagreader.cpp index 89ff08d3e..8e3009281 100644 --- a/ext/libclementine-tagreader/tagreader.cpp +++ b/ext/libclementine-tagreader/tagreader.cpp @@ -17,6 +17,8 @@ #include "tagreader.h" +#include + #include #include #include @@ -51,15 +53,11 @@ #include -#include - #include "fmpsparser.h" #include "core/logging.h" #include "core/messagehandler.h" #include "core/timeconstants.h" -using boost::scoped_ptr; - // Taglib added support for FLAC pictures in 1.7.0 #if (TAGLIB_MAJOR_VERSION > 1) || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 7) # define TAGLIB_HAS_FLAC_PICTURELIST @@ -123,7 +121,7 @@ void TagReader::ReadFile(const QString& filename, song->set_mtime(info.lastModified().toTime_t()); song->set_ctime(info.created().toTime_t()); - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if(fileref->isNull()) { qLog(Info) << "TagLib hasn't been able to read " << filename << " file"; return; @@ -528,7 +526,7 @@ bool TagReader::SaveFile(const QString& filename, qLog(Debug) << "Saving tags to" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if (!fileref || fileref->isNull()) // The file probably doesn't exist return false; @@ -589,7 +587,7 @@ bool TagReader::SaveSongStatisticsToFile(const QString& filename, qLog(Debug) << "Saving song statistics tags to" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if (!fileref || fileref->isNull()) // The file probably doesn't exist return false; @@ -645,7 +643,7 @@ bool TagReader::SaveSongRatingToFile(const QString& filename, qLog(Debug) << "Saving song rating tags to" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if (!fileref || fileref->isNull()) // The file probably doesn't exist return false; @@ -747,7 +745,7 @@ void TagReader::SetTextFrame(const char* id, const std::string& value, bool TagReader::IsMediaFile(const QString& filename) const { qLog(Debug) << "Checking for valid file" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); return !fileref->isNull() && fileref->tag(); } @@ -844,7 +842,7 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, CloudStream* stream = new CloudStream( download_url, title, size, authorisation_header, network_); stream->Precache(); - scoped_ptr tag; + std::unique_ptr tag; if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) { tag.reset(new TagLib::MPEG::File( stream, // Takes ownership. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1104542b7..93f825f81 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ if (QT_VERSION_MINOR GREATER 5) endif(QT_VERSION_MINOR GREATER 7) endif(QT_VERSION_MINOR GREATER 5) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) +add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS) include_directories(${CMAKE_BINARY_DIR}) include_directories(${GLIB_INCLUDE_DIRS}) diff --git a/src/config.h.in b/src/config.h.in index 6cac97ec7..218dafe80 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -47,7 +47,6 @@ #cmakedefine TAGLIB_HAS_OPUS #cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_SYSTEM_PROJECTM -#cmakedefine USE_STD_UNORDERED_MAP #cmakedefine HAVE_LAMBDAS #endif // CONFIG_H_IN diff --git a/src/core/deletefiles.cpp b/src/core/deletefiles.cpp index e881dc947..8a65e34ac 100644 --- a/src/core/deletefiles.cpp +++ b/src/core/deletefiles.cpp @@ -16,18 +16,19 @@ */ #include "deletefiles.h" -#include "musicstorage.h" -#include "taskmanager.h" #include #include #include #include +#include "musicstorage.h" +#include "taskmanager.h" + const int DeleteFiles::kBatchSize = 50; DeleteFiles::DeleteFiles(TaskManager* task_manager, - boost::shared_ptr storage) + std::shared_ptr storage) : thread_(NULL), task_manager_(task_manager), storage_(storage), diff --git a/src/core/deletefiles.h b/src/core/deletefiles.h index 38c995b67..142c5a7b5 100644 --- a/src/core/deletefiles.h +++ b/src/core/deletefiles.h @@ -18,9 +18,9 @@ #ifndef DELETEFILES_H #define DELETEFILES_H -#include +#include -#include +#include #include "song.h" @@ -31,7 +31,7 @@ class DeleteFiles : public QObject { Q_OBJECT public: - DeleteFiles(TaskManager* task_manager, boost::shared_ptr storage); + DeleteFiles(TaskManager* task_manager, std::shared_ptr storage); ~DeleteFiles(); static const int kBatchSize; @@ -49,7 +49,7 @@ private: QThread* thread_; QThread* original_thread_; TaskManager* task_manager_; - boost::shared_ptr storage_; + std::shared_ptr storage_; SongList songs_; diff --git a/src/core/mergedproxymodel.h b/src/core/mergedproxymodel.h index c8b04ec7c..92b4ee3f1 100644 --- a/src/core/mergedproxymodel.h +++ b/src/core/mergedproxymodel.h @@ -20,6 +20,9 @@ #include +using std::placeholders::_1; +using std::placeholders::_2; + #include #include #include diff --git a/src/core/musicstorage.h b/src/core/musicstorage.h index 4f7d0556f..4127c9304 100644 --- a/src/core/musicstorage.h +++ b/src/core/musicstorage.h @@ -20,10 +20,10 @@ #include "song.h" -#include +#include +#include -#include -#include +#include class MusicStorage { public: @@ -44,7 +44,7 @@ public: Transcode_Unsupported = 3, }; - typedef boost::function ProgressFunction; + typedef std::function ProgressFunction; struct CopyJob { QString source_; @@ -77,6 +77,6 @@ public: }; Q_DECLARE_METATYPE(MusicStorage*); -Q_DECLARE_METATYPE(boost::shared_ptr); +Q_DECLARE_METATYPE(std::shared_ptr); #endif // MUSICSTORAGE_H diff --git a/src/core/organise.cpp b/src/core/organise.cpp index 39de12916..dc87c1807 100644 --- a/src/core/organise.cpp +++ b/src/core/organise.cpp @@ -15,11 +15,9 @@ along with Clementine. If not, see . */ -#include "musicstorage.h" #include "organise.h" -#include "taskmanager.h" -#include "core/logging.h" -#include "core/tagreaderclient.h" + +#include #include #include @@ -27,13 +25,18 @@ #include #include -#include +#include "musicstorage.h" +#include "taskmanager.h" +#include "core/logging.h" +#include "core/tagreaderclient.h" + +using std::placeholders::_1; const int Organise::kBatchSize = 10; const int Organise::kTranscodeProgressInterval = 500; Organise::Organise(TaskManager* task_manager, - boost::shared_ptr destination, + std::shared_ptr destination, const OrganiseFormat &format, bool copy, bool overwrite, const QStringList& files, bool eject_after) : thread_(NULL), @@ -188,8 +191,8 @@ void Organise::ProcessSomeFiles() { job.metadata_ = song; job.overwrite_ = overwrite_; job.remove_original_ = !copy_; - job.progress_ = boost::bind(&Organise::SetSongProgress, - this, _1, !task.transcoded_filename_.isEmpty()); + job.progress_ = std::bind(&Organise::SetSongProgress, + this, _1, !task.transcoded_filename_.isEmpty()); if (!destination_->CopyToStorage(job)) { files_with_errors_ << task.filename_; diff --git a/src/core/organise.h b/src/core/organise.h index a45374c42..3f1639a1c 100644 --- a/src/core/organise.h +++ b/src/core/organise.h @@ -18,12 +18,12 @@ #ifndef ORGANISE_H #define ORGANISE_H +#include + #include #include #include -#include - #include "organiseformat.h" #include "transcoder/transcoder.h" @@ -35,7 +35,7 @@ class Organise : public QObject { public: Organise(TaskManager* task_manager, - boost::shared_ptr destination, + std::shared_ptr destination, const OrganiseFormat& format, bool copy, bool overwrite, const QStringList& files, bool eject_after); @@ -78,7 +78,7 @@ private: QThread* original_thread_; TaskManager* task_manager_; Transcoder* transcoder_; - boost::shared_ptr destination_; + std::shared_ptr destination_; QList supported_filetypes_; const OrganiseFormat format_; diff --git a/src/core/player.cpp b/src/core/player.cpp index 4cdf33f18..2814ba18b 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -15,8 +15,14 @@ along with Clementine. If not, see . */ -#include "config.h" #include "player.h" + +#include + +#include +#include + +#include "config.h" #include "core/application.h" #include "core/logging.h" #include "core/urlhandler.h" @@ -31,13 +37,7 @@ # include "internet/lastfmservice.h" #endif -#include -#include - -#include - -using boost::shared_ptr; - +using std::shared_ptr; Player::Player(Application* app, QObject* parent) : PlayerInterface(parent), diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 77ddd227d..c5a732dd5 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -17,7 +17,8 @@ #include "songloader.h" -#include +#include +#include #include #include @@ -48,6 +49,7 @@ #include "podcasts/podcastservice.h" #include "podcasts/podcasturlloader.h" +using std::placeholders::_1; QSet SongLoader::sRawUriSchemes; const int SongLoader::kDefaultTimeout = 5000; @@ -229,7 +231,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) { // inside right away. if (QFileInfo(filename).isDir()) { ConcurrentRun::Run(&thread_pool_, - boost::bind(&SongLoader::LoadLocalDirectoryAndEmit, this, filename)); + std::bind(&SongLoader::LoadLocalDirectoryAndEmit, this, filename)); return WillLoadAsync; } @@ -252,7 +254,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) { // It's a playlist! ConcurrentRun::Run(&thread_pool_, - boost::bind(&SongLoader::LoadPlaylistAndEmit, this, parser, filename)); + std::bind(&SongLoader::LoadPlaylistAndEmit, this, parser, filename)); return WillLoadAsync; } @@ -455,8 +457,8 @@ SongLoader::Result SongLoader::LoadRemote() { // rest of the file, parse the playlist and return success. // Create the pipeline - it gets unreffed if it goes out of scope - boost::shared_ptr pipeline( - gst_pipeline_new(NULL), boost::bind(&gst_object_unref, _1)); + std::shared_ptr pipeline( + gst_pipeline_new(NULL), std::bind(&gst_object_unref, _1)); // Create the source element automatically based on the URL GstElement* source = gst_element_make_from_uri( diff --git a/src/core/songloader.h b/src/core/songloader.h index 806e0378a..7e003f094 100644 --- a/src/core/songloader.h +++ b/src/core/songloader.h @@ -18,6 +18,10 @@ #ifndef SONGLOADER_H #define SONGLOADER_H +#include + +#include + #include #include #include @@ -26,10 +30,6 @@ #include "core/tagreaderclient.h" #include "musicbrainz/musicbrainzclient.h" -#include - -#include - class CueParser; class LibraryBackendInterface; class ParserBase; @@ -131,7 +131,7 @@ private: QByteArray buffer_; LibraryBackendInterface* library_; - boost::shared_ptr pipeline_; + std::shared_ptr pipeline_; QThreadPool thread_pool_; }; diff --git a/src/devices/devicemanager.cpp b/src/devices/devicemanager.cpp index eb2a1d351..e4e041755 100644 --- a/src/devices/devicemanager.cpp +++ b/src/devices/devicemanager.cpp @@ -17,7 +17,7 @@ #include "devicemanager.h" -#include +#include #include #include @@ -60,7 +60,7 @@ # include "mtpdevice.h" #endif -using boost::bind; +using std::bind; const int DeviceManager::kDeviceIconSize = 32; const int DeviceManager::kDeviceIconOverlaySize = 16; @@ -311,7 +311,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const { const_cast(this)->Connect(index.row()); if (!info.device_) return QVariant(); - return QVariant::fromValue >(info.device_); + return QVariant::fromValue>(info.device_); case MusicStorage::Role_StorageForceConnect: if (!info.device_) { @@ -319,7 +319,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const { !info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) { if (info.BestBackend()->lister_->AskForScan(info.BestBackend()->unique_id_)) { - boost::scoped_ptr dialog(new QMessageBox( + std::unique_ptr dialog(new QMessageBox( QMessageBox::Information, tr("Connect device"), tr("This is the first time you have connected this device. Clementine will now scan the device to find music files - this may take some time."), QMessageBox::Cancel)); @@ -336,7 +336,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const { } if (!info.device_) return QVariant(); - return QVariant::fromValue >(info.device_); + return QVariant::fromValue>(info.device_); case Role_MountPath: { if (!info.device_) @@ -520,12 +520,12 @@ void DeviceManager::PhysicalDeviceChanged(const QString &id) { // TODO } -boost::shared_ptr DeviceManager::Connect(int row) { +std::shared_ptr DeviceManager::Connect(int row) { DeviceInfo& info = devices_[row]; if (info.device_) // Already connected return info.device_; - boost::shared_ptr ret; + std::shared_ptr ret; if (!info.BestBackend()->lister_) // Not physically connected return ret; @@ -612,7 +612,7 @@ boost::shared_ptr DeviceManager::Connect(int row) { return ret; } -boost::shared_ptr DeviceManager::GetConnectedDevice(int row) const { +std::shared_ptr DeviceManager::GetConnectedDevice(int row) const { return devices_[row].device_; } diff --git a/src/devices/devicemanager.h b/src/devices/devicemanager.h index d165d17db..6f20b0159 100644 --- a/src/devices/devicemanager.h +++ b/src/devices/devicemanager.h @@ -19,13 +19,14 @@ #define DEVICEMANAGER_H #include "devicedatabasebackend.h" -#include "library/librarymodel.h" + +#include #include #include #include -#include +#include "library/librarymodel.h" class Application; class ConnectedDevice; @@ -72,13 +73,13 @@ public: // Get info about devices int GetDatabaseId(int row) const; DeviceLister* GetLister(int row) const; - boost::shared_ptr GetConnectedDevice(int row) const; + std::shared_ptr GetConnectedDevice(int row) const; int FindDeviceById(const QString& id) const; int FindDeviceByUrl(const QList& url) const; // Actions on devices - boost::shared_ptr Connect(int row); + std::shared_ptr Connect(int row); void Disconnect(int row); void Forget(int row); void UnmountAsync(int row); @@ -143,7 +144,7 @@ private: int database_id_; // -1 if not remembered in the database - boost::shared_ptr device_; // NULL if not connected to clementine + std::shared_ptr device_; // NULL if not connected to clementine QList backends_; QString friendly_name_; diff --git a/src/devices/deviceproperties.cpp b/src/devices/deviceproperties.cpp index 0f59f3c85..80bca6e9c 100644 --- a/src/devices/deviceproperties.cpp +++ b/src/devices/deviceproperties.cpp @@ -15,20 +15,22 @@ along with Clementine. If not, see . */ -#include "connecteddevice.h" -#include "devicelister.h" -#include "devicemanager.h" #include "deviceproperties.h" -#include "ui_deviceproperties.h" -#include "core/utilities.h" -#include "transcoder/transcoder.h" -#include "ui/iconloader.h" + +#include +#include #include #include #include -#include +#include "connecteddevice.h" +#include "devicelister.h" +#include "devicemanager.h" +#include "ui_deviceproperties.h" +#include "core/utilities.h" +#include "transcoder/transcoder.h" +#include "ui/iconloader.h" DeviceProperties::DeviceProperties(QWidget *parent) : QDialog(parent), @@ -178,7 +180,7 @@ void DeviceProperties::UpdateHardwareInfo() { void DeviceProperties::UpdateFormats() { QString id = index_.data(DeviceManager::Role_UniqueId).toString(); DeviceLister* lister = manager_->GetLister(index_.row()); - boost::shared_ptr device = + std::shared_ptr device = manager_->GetConnectedDevice(index_.row()); // Transcode mode @@ -219,7 +221,7 @@ void DeviceProperties::UpdateFormats() { // blocks, so do it in the background. supported_formats_.clear(); - QFuture future = QtConcurrent::run(boost::bind( + QFuture future = QtConcurrent::run(std::bind( &ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_)); QFutureWatcher* watcher = new QFutureWatcher(this); watcher->setFuture(future); diff --git a/src/devices/deviceview.cpp b/src/devices/deviceview.cpp index 2d561bb41..342ce936a 100644 --- a/src/devices/deviceview.cpp +++ b/src/devices/deviceview.cpp @@ -15,11 +15,22 @@ along with Clementine. If not, see . */ +#include "deviceview.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + #include "connecteddevice.h" #include "devicelister.h" #include "devicemanager.h" #include "deviceproperties.h" -#include "deviceview.h" #include "core/application.h" #include "core/deletefiles.h" #include "core/mergedproxymodel.h" @@ -31,16 +42,6 @@ #include "ui/organisedialog.h" #include "ui/organiseerrordialog.h" -#include -#include -#include -#include -#include -#include -#include - -#include - const int DeviceItemDelegate::kIconPadding = 6; DeviceItemDelegate::DeviceItemDelegate(QObject *parent) @@ -238,7 +239,8 @@ void DeviceView::contextMenuEvent(QContextMenuEvent* e) { bool is_filesystem_device = false; if (parent_device_index.isValid()) { - boost::shared_ptr device = app_->device_manager()->GetConnectedDevice(parent_device_index.row()); + std::shared_ptr device = + app_->device_manager()->GetConnectedDevice(parent_device_index.row()); if (device && !device->LocalPath().isEmpty()) is_filesystem_device = true; } @@ -281,7 +283,8 @@ void DeviceView::Connect() { } void DeviceView::DeviceConnected(int row) { - boost::shared_ptr device = app_->device_manager()->GetConnectedDevice(row); + std::shared_ptr device = + app_->device_manager()->GetConnectedDevice(row); if (!device) return; @@ -306,7 +309,7 @@ void DeviceView::Forget() { QString unique_id = app_->device_manager()->data(device_idx, DeviceManager::Role_UniqueId).toString(); if (app_->device_manager()->GetLister(device_idx.row()) && app_->device_manager()->GetLister(device_idx.row())->AskForScan(unique_id)) { - boost::scoped_ptr dialog(new QMessageBox( + std::unique_ptr dialog(new QMessageBox( QMessageBox::Question, tr("Forget device"), tr("Forgetting a device will remove it from this list and Clementine will have to rescan all the songs again next time you connect it."), QMessageBox::Cancel, this)); @@ -390,8 +393,8 @@ void DeviceView::Delete() { QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) return; - boost::shared_ptr storage = - device_index.data(MusicStorage::Role_Storage).value >(); + std::shared_ptr storage = + device_index.data(MusicStorage::Role_Storage).value>(); DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); diff --git a/src/devices/giolister.cpp b/src/devices/giolister.cpp index 625f05d66..504bbbc7c 100644 --- a/src/devices/giolister.cpp +++ b/src/devices/giolister.cpp @@ -17,16 +17,20 @@ #include "config.h" +#include + #include #include #include -#include - #include "giolister.h" #include "core/logging.h" #include "core/signalchecker.h" +using std::placeholders::_1; +using std::placeholders::_2; +using std::placeholders::_3; + QString GioLister::DeviceInfo::unique_id() const { if (mount) return QString("Gio/%1/%2/%3").arg(mount_uuid, filesystem_type).arg(filesystem_size); @@ -65,7 +69,7 @@ void OperationFinished(F f, GObject *object, GAsyncResult *result) { } void GioLister::VolumeMountFinished(GObject* object, GAsyncResult* result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_volume_mount_finish, _1, _2, _3), object, result); } @@ -456,17 +460,17 @@ QString GioLister::FindUniqueIdByVolume(GVolume* volume) const { } void GioLister::VolumeEjectFinished(GObject *object, GAsyncResult *result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_volume_eject_with_operation_finish, _1, _2, _3), object, result); } void GioLister::MountEjectFinished(GObject *object, GAsyncResult *result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_mount_eject_with_operation_finish, _1, _2, _3), object, result); } void GioLister::MountUnmountFinished(GObject *object, GAsyncResult *result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_mount_unmount_with_operation_finish, _1, _2, _3), object, result); } diff --git a/src/engines/gstengine.cpp b/src/engines/gstengine.cpp index 7131c8ce9..b6f185a8e 100644 --- a/src/engines/gstengine.cpp +++ b/src/engines/gstengine.cpp @@ -19,23 +19,14 @@ * 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "config.h" #include "gstengine.h" -#include "gstenginepipeline.h" -#include "core/logging.h" -#include "core/taskmanager.h" -#include "core/utilities.h" - -#ifdef HAVE_MOODBAR -# include "gst/moodbar/spectrum.h" -#endif #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -49,9 +40,18 @@ #include +#include "config.h" +#include "gstenginepipeline.h" +#include "core/logging.h" +#include "core/taskmanager.h" +#include "core/utilities.h" +#ifdef HAVE_MOODBAR +# include "gst/moodbar/spectrum.h" +#endif + +using std::shared_ptr; using std::vector; -using boost::shared_ptr; const char* GstEngine::kSettingsGroup = "GstEngine"; const char* GstEngine::kAutoSink = "autoaudiosink"; diff --git a/src/engines/gstengine.h b/src/engines/gstengine.h index 94c3a93bc..3f3a6c8bf 100644 --- a/src/engines/gstengine.h +++ b/src/engines/gstengine.h @@ -22,6 +22,8 @@ #ifndef AMAROK_GSTENGINE_H #define AMAROK_GSTENGINE_H +#include + #include "bufferconsumer.h" #include "enginebase.h" #include "core/boundfuturewatcher.h" @@ -35,7 +37,6 @@ #include #include -#include class QTimer; class QTimerEvent; @@ -146,12 +147,13 @@ class GstEngine : public Engine::Base, public BufferConsumer { void StartTimers(); void StopTimers(); - boost::shared_ptr CreatePipeline(); - boost::shared_ptr CreatePipeline(const QUrl& url, qint64 end_nanosec); + std::shared_ptr CreatePipeline(); + std::shared_ptr CreatePipeline( + const QUrl& url, qint64 end_nanosec); void UpdateScope(); - int AddBackgroundStream(boost::shared_ptr pipeline); + int AddBackgroundStream(std::shared_ptr pipeline); static QUrl FixupUrl(const QUrl& url); @@ -171,9 +173,9 @@ class GstEngine : public Engine::Base, public BufferConsumer { QString sink_; QString device_; - boost::shared_ptr current_pipeline_; - boost::shared_ptr fadeout_pipeline_; - boost::shared_ptr fadeout_pause_pipeline_; + std::shared_ptr current_pipeline_; + std::shared_ptr fadeout_pipeline_; + std::shared_ptr fadeout_pause_pipeline_; QUrl preloaded_url_; QList buffer_consumers_; @@ -205,7 +207,7 @@ class GstEngine : public Engine::Base, public BufferConsumer { int timer_id_; int next_element_id_; - QHash > background_streams_; + QHash > background_streams_; bool is_fading_out_to_pause_; bool has_faded_out_; diff --git a/src/globalsearch/globalsearchview.cpp b/src/globalsearch/globalsearchview.cpp index 67cc90bb2..9b38847aa 100644 --- a/src/globalsearch/globalsearchview.cpp +++ b/src/globalsearch/globalsearchview.cpp @@ -1,25 +1,33 @@ /* This file is part of Clementine. Copyright 2012, David Sansome - + 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 . */ +#include "globalsearchview.h" + +#include +#include +#include +#include + +#include + #include "globalsearch.h" #include "globalsearchitemdelegate.h" #include "globalsearchmodel.h" #include "globalsearchsortmodel.h" -#include "globalsearchview.h" #include "searchprovider.h" #include "searchproviderstatuswidget.h" #include "suggestionwidget.h" @@ -32,12 +40,8 @@ #include "library/librarymodel.h" #include "library/groupbydialog.h" -#include - -#include -#include -#include -#include +using std::placeholders::_1; +using std::placeholders::_2; const int GlobalSearchView::kSwapModelsTimeoutMsec = 250; const int GlobalSearchView::kMaxSuggestions = 10; @@ -176,14 +180,14 @@ namespace { void GlobalSearchView::ReloadSettings() { QSettings s; - + // Library settings s.beginGroup(LibraryView::kSettingsGroup); const bool pretty = s.value("pretty_covers", true).toBool(); front_model_->set_use_pretty_covers(pretty); back_model_->set_use_pretty_covers(pretty); s.endGroup(); - + // Global search settings s.beginGroup(GlobalSearch::kSettingsGroup); const QStringList provider_order = @@ -197,11 +201,11 @@ void GlobalSearchView::ReloadSettings() { LibraryModel::GroupBy(s.value("group_by2", int(LibraryModel::GroupBy_Album)).toInt()), LibraryModel::GroupBy(s.value("group_by3", int(LibraryModel::GroupBy_None)).toInt()))); s.endGroup(); - + // Delete any old status widgets qDeleteAll(provider_status_widgets_); provider_status_widgets_.clear(); - + // Toggle visibility of the providers group ui_->providers_group->setVisible(show_providers_); @@ -209,27 +213,27 @@ void GlobalSearchView::ReloadSettings() { // Sort the list of providers QList providers = engine_->providers(); qSort(providers.begin(), providers.end(), - boost::bind(&CompareProvider, boost::cref(provider_order), _1, _2)); - + std::bind(&CompareProvider, std::cref(provider_order), _1, _2)); + bool any_disabled = false; - + foreach (SearchProvider* provider, providers) { QWidget* parent = ui_->enabled_list; if (!engine_->is_provider_usable(provider)) { parent = ui_->disabled_list; any_disabled = true; } - + SearchProviderStatusWidget* widget = new SearchProviderStatusWidget(warning_icon_, engine_, provider); - + parent->layout()->addWidget(widget); provider_status_widgets_ << widget; } - + ui_->disabled_label->setVisible(any_disabled); } - + ui_->suggestions_group->setVisible(show_suggestions_); if (!show_suggestions_) { update_suggestions_timer_->stop(); diff --git a/src/library/groupbydialog.h b/src/library/groupbydialog.h index fa8976d27..718590286 100644 --- a/src/library/groupbydialog.h +++ b/src/library/groupbydialog.h @@ -20,6 +20,11 @@ #include +#include + +using std::placeholders::_1; +using std::placeholders::_2; + #include #include #include diff --git a/src/library/librarydirectorymodel.cpp b/src/library/librarydirectorymodel.cpp index 8376ffef4..79b140161 100644 --- a/src/library/librarydirectorymodel.cpp +++ b/src/library/librarydirectorymodel.cpp @@ -38,7 +38,7 @@ void LibraryDirectoryModel::DirectoryDiscovered(const Directory &dir) { QStandardItem* item = new QStandardItem(dir.path); item->setData(dir.id, kIdRole); item->setIcon(dir_icon_); - storage_ << boost::shared_ptr(new FilesystemMusicStorage(dir.path)); + storage_ << std::shared_ptr(new FilesystemMusicStorage(dir.path)); appendRow(item); } diff --git a/src/library/librarydirectorymodel.h b/src/library/librarydirectorymodel.h index eee72270b..5d7c4d482 100644 --- a/src/library/librarydirectorymodel.h +++ b/src/library/librarydirectorymodel.h @@ -18,11 +18,11 @@ #ifndef LIBRARYDIRECTORYMODEL_H #define LIBRARYDIRECTORYMODEL_H +#include + #include #include -#include - #include "directory.h" class LibraryBackend; @@ -51,7 +51,7 @@ class LibraryDirectoryModel : public QStandardItemModel { QIcon dir_icon_; LibraryBackend* backend_; - QList > storage_; + QList > storage_; }; #endif // LIBRARYDIRECTORYMODEL_H diff --git a/src/library/librarymodel.cpp b/src/library/librarymodel.cpp index 9bd919522..db3f95a3d 100644 --- a/src/library/librarymodel.cpp +++ b/src/library/librarymodel.cpp @@ -16,6 +16,18 @@ */ #include "librarymodel.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + #include "librarybackend.h" #include "libraryitem.h" #include "librarydirectorymodel.h" @@ -32,16 +44,8 @@ #include "smartplaylists/querygenerator.h" #include "ui/iconloader.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include +using std::placeholders::_1; +using std::placeholders::_2; using smart_playlists::Generator; using smart_playlists::GeneratorMimeData; @@ -1079,7 +1083,7 @@ void LibraryModel::GetChildSongs(LibraryItem* item, QList* urls, const_cast(this)->LazyPopulate(item); QList children = item->children; - qSort(children.begin(), children.end(), boost::bind( + qSort(children.begin(), children.end(), std::bind( &LibraryModel::CompareItems, this, _1, _2)); foreach (LibraryItem* child, children) diff --git a/src/library/libraryview.cpp b/src/library/libraryview.cpp index e807836d2..297212837 100644 --- a/src/library/libraryview.cpp +++ b/src/library/libraryview.cpp @@ -15,10 +15,22 @@ along with Clementine. If not, see . */ +#include "libraryview.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "librarydirectorymodel.h" #include "libraryfilterwidget.h" #include "librarymodel.h" -#include "libraryview.h" #include "libraryitem.h" #include "librarybackend.h" #include "core/application.h" @@ -34,17 +46,6 @@ #include "ui/organisedialog.h" #include "ui/organiseerrordialog.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - using smart_playlists::Wizard; const char* LibraryView::kSettingsGroup = "LibraryView"; @@ -613,9 +614,9 @@ void LibraryView::Delete() { // We can cheat and always take the storage of the first directory, since // they'll all be FilesystemMusicStorage in a library and deleting doesn't // check the actual directory. - boost::shared_ptr storage = + std::shared_ptr storage = app_->library_model()->directory_model()->index(0, 0).data(MusicStorage::Role_Storage) - .value >(); + .value>(); DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); diff --git a/src/main.cpp b/src/main.cpp index 8c0e9542d..2bf13f593 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,8 @@ along with Clementine. If not, see . */ +#include + #include #ifdef Q_OS_WIN32 @@ -23,6 +25,19 @@ # include #endif // Q_OS_WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "config.h" #include "core/application.h" #include "core/commandlineoptions.h" @@ -54,26 +69,10 @@ #include "qtsingleapplication.h" #include "qtsinglecoreapplication.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include -#include -using boost::scoped_ptr; - #include #ifdef HAVE_SPOTIFY_DOWNLOADER @@ -438,7 +437,7 @@ int main(int argc, char *argv[]) { #endif // Q_OS_LINUX // Create the tray icon and OSD - scoped_ptr tray_icon(SystemTrayIcon::CreateSystemTrayIcon()); + std::unique_ptr tray_icon(SystemTrayIcon::CreateSystemTrayIcon()); OSD osd(tray_icon.get(), &app); #ifdef HAVE_DBUS diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index ea07cca42..dfb11116f 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -16,6 +16,25 @@ */ #include "playlist.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "playlistbackend.h" #include "playlistfilter.h" #include "playlistitemmimedata.h" @@ -48,36 +67,15 @@ #include "smartplaylists/generatorinserter.h" #include "smartplaylists/generatormimedata.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef USE_STD_UNORDERED_MAP - #include - using std::unordered_map; -#else - #include - using std::tr1::unordered_map; -#endif +using std::placeholders::_1; +using std::placeholders::_2; +using std::shared_ptr; +using std::unordered_map; using smart_playlists::Generator; using smart_playlists::GeneratorInserter; using smart_playlists::GeneratorPtr; -using boost::shared_ptr; - const char* Playlist::kCddaMimeType = "x-content/audio-cdda"; const char* Playlist::kRowsMimetype = "application/x-clementine-playlist-rows"; const char* Playlist::kPlayNowMimetype = "application/x-clementine-play-now"; @@ -1264,7 +1262,7 @@ void Playlist::sort(int column, Qt::SortOrder order) { begin += current_item_index_.row() + 1; qStableSort(begin, new_items.end(), - boost::bind(&Playlist::CompareItems, column, order, _1, _2)); + std::bind(&Playlist::CompareItems, column, order, _1, _2)); undo_stack_->push(new PlaylistUndoCommands::SortItems(this, column, order, new_items)); } @@ -1811,8 +1809,8 @@ void Playlist::ReshuffleIndices() { // Sort the virtual items std::stable_sort(begin, end, - boost::bind(AlbumShuffleComparator, album_key_positions, - album_keys, _1, _2)); + std::bind(AlbumShuffleComparator, album_key_positions, + album_keys, _1, _2)); break; } diff --git a/src/playlist/playlistbackend.cpp b/src/playlist/playlistbackend.cpp index c248a2b3d..f8a604016 100644 --- a/src/playlist/playlistbackend.cpp +++ b/src/playlist/playlistbackend.cpp @@ -16,6 +16,17 @@ */ #include "playlistbackend.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + #include "core/application.h" #include "core/database.h" #include "core/scopedtransaction.h" @@ -26,19 +37,11 @@ #include "playlistparsers/cueparser.h" #include "smartplaylists/generator.h" -#include -#include -#include -#include -#include -#include - -#include +using std::placeholders::_1; +using std::shared_ptr; using smart_playlists::GeneratorPtr; -using boost::shared_ptr; - const int PlaylistBackend::kSongTableJoins = 4; PlaylistBackend::PlaylistBackend(Application* app, QObject* parent) @@ -174,8 +177,10 @@ QFuture PlaylistBackend::GetPlaylistItems(int playlist) { // it's probable that we'll have a few songs associated with the // same CUE so we're caching results of parsing CUEs - boost::shared_ptr state_ptr(new NewSongFromQueryState()); - return QtConcurrent::mapped(rows, boost::bind(&PlaylistBackend::NewPlaylistItemFromQuery, this, _1, state_ptr)); + std::shared_ptr state_ptr(new NewSongFromQueryState()); + return QtConcurrent::mapped( + rows, std::bind( + &PlaylistBackend::NewPlaylistItemFromQuery, this, _1, state_ptr)); } QFuture PlaylistBackend::GetPlaylistSongs(int playlist) { @@ -184,11 +189,12 @@ QFuture PlaylistBackend::GetPlaylistSongs(int playlist) { // it's probable that we'll have a few songs associated with the // same CUE so we're caching results of parsing CUEs - boost::shared_ptr state_ptr(new NewSongFromQueryState()); - return QtConcurrent::mapped(rows, boost::bind(&PlaylistBackend::NewSongFromQuery, this, _1, state_ptr)); + std::shared_ptr state_ptr(new NewSongFromQueryState()); + return QtConcurrent::mapped(rows, std::bind(&PlaylistBackend::NewSongFromQuery, this, _1, state_ptr)); } -PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(const SqlRow& row, boost::shared_ptr state) { +PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery( + const SqlRow& row, std::shared_ptr state) { // The song tables get joined first, plus one each for the song ROWIDs const int playlist_row = (Song::kColumns.count() + 1) * kSongTableJoins; @@ -201,13 +207,15 @@ PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(const SqlRow& row, boo } } -Song PlaylistBackend::NewSongFromQuery(const SqlRow& row, boost::shared_ptr state) { +Song PlaylistBackend::NewSongFromQuery( + const SqlRow& row, std::shared_ptr state) { return NewPlaylistItemFromQuery(row, state)->Metadata(); } // If song had a CUE and the CUE still exists, the metadata from it will // be applied here. -PlaylistItemPtr PlaylistBackend::RestoreCueData(PlaylistItemPtr item, boost::shared_ptr state) { +PlaylistItemPtr PlaylistBackend::RestoreCueData( + PlaylistItemPtr item, std::shared_ptr state) { // we need library to run a CueParser; also, this method applies only to // file-type PlaylistItems if(item->type() != "File") { diff --git a/src/playlist/playlistbackend.h b/src/playlist/playlistbackend.h index d9c4a071c..29fdf9142 100644 --- a/src/playlist/playlistbackend.h +++ b/src/playlist/playlistbackend.h @@ -90,9 +90,9 @@ class PlaylistBackend : public QObject { QList GetPlaylistRows(int playlist); - Song NewSongFromQuery(const SqlRow& row, boost::shared_ptr state); - PlaylistItemPtr NewPlaylistItemFromQuery(const SqlRow& row, boost::shared_ptr state); - PlaylistItemPtr RestoreCueData(PlaylistItemPtr item, boost::shared_ptr state); + Song NewSongFromQuery(const SqlRow& row, std::shared_ptr state); + PlaylistItemPtr NewPlaylistItemFromQuery(const SqlRow& row, std::shared_ptr state); + PlaylistItemPtr RestoreCueData(PlaylistItemPtr item, std::shared_ptr state); enum GetPlaylistsFlags { GetPlaylists_OpenInUi = 1, diff --git a/src/playlist/playlistitem.h b/src/playlist/playlistitem.h index 449a1f421..467d10c09 100644 --- a/src/playlist/playlistitem.h +++ b/src/playlist/playlistitem.h @@ -18,19 +18,19 @@ #ifndef PLAYLISTITEM_H #define PLAYLISTITEM_H +#include + #include #include #include #include -#include - #include "core/song.h" class QAction; class SqlRow; -class PlaylistItem : public boost::enable_shared_from_this { +class PlaylistItem : public std::enable_shared_from_this { public: PlaylistItem(const QString& type) : type_(type) {} @@ -109,7 +109,7 @@ class PlaylistItem : public boost::enable_shared_from_this { QMap background_colors_; QMap foreground_colors_; }; -typedef boost::shared_ptr PlaylistItemPtr; +typedef std::shared_ptr PlaylistItemPtr; typedef QList PlaylistItemList; Q_DECLARE_METATYPE(PlaylistItemPtr) diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index 487f975ff..e7e91b9b4 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -17,6 +17,8 @@ #include "transcoder.h" +#include + #include #include #include @@ -24,12 +26,10 @@ #include #include -#include - #include "core/logging.h" #include "core/signalchecker.h" -using boost::shared_ptr; +using std::shared_ptr; int Transcoder::JobFinishedEvent::sEventType = -1; @@ -541,7 +541,7 @@ void Transcoder::Cancel() { QMap Transcoder::GetProgress() const { QMap ret; - foreach (boost::shared_ptr state, current_jobs_) { + for (const auto& state : current_jobs_) { if (!state->pipeline_) continue; diff --git a/src/transcoder/transcoder.h b/src/transcoder/transcoder.h index 58c53288e..62f3149b4 100644 --- a/src/transcoder/transcoder.h +++ b/src/transcoder/transcoder.h @@ -18,6 +18,8 @@ #ifndef TRANSCODER_H #define TRANSCODER_H +#include + #include #include @@ -25,9 +27,6 @@ #include #include -#include -#include - #include "core/song.h" @@ -138,7 +137,7 @@ class Transcoder : public QObject { static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage* msg, gpointer data); private: - typedef QList > JobStateList; + typedef QList > JobStateList; int max_threads_; QList queued_jobs_; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 1aa3bc0a9..bc9a43f24 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -17,6 +17,33 @@ #include "mainwindow.h" #include "ui_mainwindow.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_WIN32 +# include +#endif + +#include + + #include "core/appearance.h" #include "core/application.h" #include "core/backgroundstreams.h" @@ -118,34 +145,6 @@ # include "moodbar/moodbarproxystyle.h" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_OS_WIN32 -# include -#endif - - -#include - -#include - -using boost::shared_ptr; -using boost::scoped_ptr; - #ifdef Q_OS_DARWIN // Non exported mac-specific function. void qt_mac_set_dock_menu(QMenu*); @@ -1909,7 +1908,7 @@ void MainWindow::PlaylistDelete() { QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) return; - boost::shared_ptr storage(new FilesystemMusicStorage("/")); + std::shared_ptr storage(new FilesystemMusicStorage("/")); // Get selected songs SongList selected_songs; diff --git a/src/ui/organisedialog.cpp b/src/ui/organisedialog.cpp index bb786115e..c3f7908f2 100644 --- a/src/ui/organisedialog.cpp +++ b/src/ui/organisedialog.cpp @@ -15,13 +15,10 @@ along with Clementine. If not, see . */ -#include "iconloader.h" #include "organisedialog.h" -#include "organiseerrordialog.h" #include "ui_organisedialog.h" -#include "core/musicstorage.h" -#include "core/organise.h" -#include "core/tagreaderclient.h" + +#include #include #include @@ -32,6 +29,12 @@ #include #include +#include "iconloader.h" +#include "organiseerrordialog.h" +#include "core/musicstorage.h" +#include "core/organise.h" +#include "core/tagreaderclient.h" + const int OrganiseDialog::kNumberOfPreviews = 10; const char* OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension"; @@ -192,12 +195,12 @@ void OrganiseDialog::InsertTag(const QString &tag) { void OrganiseDialog::UpdatePreviews() { const QModelIndex destination = ui_->destination->model()->index( ui_->destination->currentIndex(), 0); - boost::shared_ptr storage; + std::shared_ptr storage; bool has_local_destination = false; if (destination.isValid()) { storage = destination.data(MusicStorage::Role_Storage) - .value >(); + .value>(); if (storage) { has_local_destination = !storage->LocalPath().isEmpty(); } @@ -294,9 +297,9 @@ void OrganiseDialog::accept() { const QModelIndex destination = ui_->destination->model()->index( ui_->destination->currentIndex(), 0); - boost::shared_ptr storage = + std::shared_ptr storage = destination.data(MusicStorage::Role_StorageForceConnect) - .value >(); + .value>(); if (!storage) return; diff --git a/src/widgets/fileview.h b/src/widgets/fileview.h index 07e5d239f..db740bcb7 100644 --- a/src/widgets/fileview.h +++ b/src/widgets/fileview.h @@ -18,13 +18,13 @@ #ifndef FILEVIEW_H #define FILEVIEW_H +#include + #include #include #include #include -#include - #include "core/song.h" class FilesystemMusicStorage; @@ -102,7 +102,7 @@ class FileView : public QWidget { QUndoStack* undo_stack_; TaskManager* task_manager_; - boost::shared_ptr storage_; + std::shared_ptr storage_; QString lazy_set_path_;