diff --git a/CMakeLists.txt b/CMakeLists.txt index 9764981ca..267670e6b 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.cpp b/ext/libclementine-common/core/closure.cpp index ad14c9413..e2c27c13f 100644 --- a/ext/libclementine-common/core/closure.cpp +++ b/ext/libclementine-common/core/closure.cpp @@ -33,7 +33,7 @@ ClosureBase::~ClosureBase() { CallbackClosure::CallbackClosure( QObject* sender, const char* signal, - boost::function callback) + std::function callback) : ClosureBase(new ObjectHelper(sender, signal, this)), callback_(callback) { } @@ -67,7 +67,7 @@ void Unpack(QList*) {} _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - boost::function callback) { + std::function callback) { return new _detail::CallbackClosure( sender, signal, callback); } diff --git a/ext/libclementine-common/core/closure.h b/ext/libclementine-common/core/closure.h index 155df38bd..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_; }; @@ -158,12 +157,12 @@ class CallbackClosure : public ClosureBase { CallbackClosure( QObject* sender, const char* signal, - boost::function callback); + std::function callback); virtual void Invoke(); private: - boost::function callback_; + std::function callback_; }; } // namespace _detail @@ -194,15 +193,15 @@ _detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - boost::function callback); + std::function callback); template _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - boost::function callback, + 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 b94a64214..62e5f631f 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; @@ -530,7 +528,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; @@ -591,7 +589,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; @@ -647,7 +645,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; @@ -749,7 +747,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(); } @@ -865,7 +863,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 63f004be2..af0874480 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 56a9bcee8..6fb4afcc0 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -46,7 +46,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/crashreporting.h b/src/core/crashreporting.h index 54d30558a..a627d0bb0 100644 --- a/src/core/crashreporting.h +++ b/src/core/crashreporting.h @@ -18,9 +18,9 @@ #ifndef CRASHREPORTING_H #define CRASHREPORTING_H -#include +#include -#include +#include class QFile; class QNetworkAccessManager; @@ -64,7 +64,7 @@ private: static const char* kSendCrashReportOption; static char* sPath; - boost::scoped_ptr handler_; + std::unique_ptr handler_; }; 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/macglobalshortcutbackend.h b/src/core/macglobalshortcutbackend.h index 4e42be366..9abcf8e98 100644 --- a/src/core/macglobalshortcutbackend.h +++ b/src/core/macglobalshortcutbackend.h @@ -18,13 +18,13 @@ #ifndef MACGLOBALSHORTCUTBACKEND_H #define MACGLOBALSHORTCUTBACKEND_H +#include + #include "globalshortcutbackend.h" #include #include -#include - class MacGlobalShortcutBackendPrivate; class QAction; @@ -50,7 +50,7 @@ private: QMap shortcuts_; friend class MacGlobalShortcutBackendPrivate; - boost::scoped_ptr p_; + std::unique_ptr p_; }; #endif // MACGLOBALSHORTCUTBACKEND_H 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/mpris2.h b/src/core/mpris2.h index 06402646e..259ee5e06 100644 --- a/src/core/mpris2.h +++ b/src/core/mpris2.h @@ -24,8 +24,6 @@ #include #include -#include - class Application; class MainWindow; class Playlist; 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 b9efc0dab..0d03c2e2a 100644 --- a/src/core/organise.cpp +++ b/src/core/organise.cpp @@ -15,12 +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 "core/utilities.h" + +#include #include #include @@ -28,13 +25,19 @@ #include #include -#include +#include "musicstorage.h" +#include "taskmanager.h" +#include "core/logging.h" +#include "core/tagreaderclient.h" +#include "core/utilities.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 NewSongInfoList& songs_info, bool eject_after) : thread_(NULL), @@ -177,8 +180,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.song_info_.song_.basefilename(); diff --git a/src/core/organise.h b/src/core/organise.h index b40bf8cb9..eba134750 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" @@ -44,7 +44,7 @@ public: typedef QList NewSongInfoList; Organise(TaskManager* task_manager, - boost::shared_ptr destination, + std::shared_ptr destination, const OrganiseFormat& format, bool copy, bool overwrite, const NewSongInfoList& songs, bool eject_after); @@ -85,7 +85,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 994ebd3f1..915f7f95f 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -15,8 +15,15 @@ along with Clementine. If not, see . */ -#include "config.h" #include "player.h" + +#include + +#include +#include +#include + +#include "config.h" #include "core/application.h" #include "core/logging.h" #include "core/urlhandler.h" @@ -31,13 +38,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/player.h b/src/core/player.h index 20a02d4dc..c8df58c98 100644 --- a/src/core/player.h +++ b/src/core/player.h @@ -18,11 +18,11 @@ #ifndef PLAYER_H #define PLAYER_H +#include + #include #include -#include - #include "config.h" #include "core/song.h" #include "core/urlhandler.h" @@ -176,7 +176,7 @@ public slots: PlaylistItemPtr current_item_; - boost::scoped_ptr engine_; + std::unique_ptr engine_; Engine::TrackChangeFlags stream_change_type_; Engine::State last_state_; int nb_errors_received_; diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 34a50b7f9..83433e568 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -17,7 +17,8 @@ #include "songloader.h" -#include +#include +#include #include #include @@ -49,6 +50,7 @@ #include "podcasts/podcastservice.h" #include "podcasts/podcasturlloader.h" +using std::placeholders::_1; QSet SongLoader::sRawUriSchemes; const int SongLoader::kDefaultTimeout = 5000; @@ -234,7 +236,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; } @@ -257,7 +259,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; } @@ -460,8 +462,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 4f335eb31..7b4753fc5 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; @@ -134,7 +134,7 @@ private: LibraryBackendInterface* library_; const Player* player_; - boost::shared_ptr pipeline_; + std::shared_ptr pipeline_; QThreadPool thread_pool_; }; diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 6ebfe849b..2fb9afcfa 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -19,7 +19,7 @@ #include -#include +#include #include #include @@ -267,7 +267,7 @@ bool Copy(QIODevice* source, QIODevice* destination) { return false; const qint64 bytes = source->size(); - boost::scoped_array data(new char[bytes]); + std::unique_ptr data(new char[bytes]); qint64 pos = 0; qint64 bytes_read; diff --git a/src/core/utilities.h b/src/core/utilities.h index b71225bf0..a926e154d 100644 --- a/src/core/utilities.h +++ b/src/core/utilities.h @@ -18,6 +18,8 @@ #ifndef UTILITIES_H #define UTILITIES_H +#include + #include #include #include @@ -26,8 +28,6 @@ #include #include -#include - class QIODevice; class QMouseEvent; class QXmlStreamReader; @@ -171,7 +171,7 @@ private: Q_DISABLE_COPY(ScopedWCharArray); int chars_; - boost::scoped_array data_; + std::unique_ptr data_; }; #endif // UTILITIES_H diff --git a/src/covers/albumcoverfetcher.h b/src/covers/albumcoverfetcher.h index a8a8dcc2f..034ddddfb 100644 --- a/src/covers/albumcoverfetcher.h +++ b/src/covers/albumcoverfetcher.h @@ -29,8 +29,6 @@ #include #include -#include - class QNetworkReply; class QString; diff --git a/src/covers/currentartloader.h b/src/covers/currentartloader.h index 05e1a7db7..5b24e71fd 100644 --- a/src/covers/currentartloader.h +++ b/src/covers/currentartloader.h @@ -18,12 +18,12 @@ #ifndef CURRENTARTLOADER_H #define CURRENTARTLOADER_H -#include "core/song.h" -#include "covers/albumcoverloaderoptions.h" +#include #include -#include +#include "core/song.h" +#include "covers/albumcoverloaderoptions.h" class Application; @@ -56,8 +56,8 @@ private: QString temp_file_pattern_; - boost::scoped_ptr temp_art_; - boost::scoped_ptr temp_art_thumbnail_; + std::unique_ptr temp_art_; + std::unique_ptr temp_art_thumbnail_; quint64 id_; Song last_song_; diff --git a/src/devices/connecteddevice.h b/src/devices/connecteddevice.h index 3eb468a39..663e5253d 100644 --- a/src/devices/connecteddevice.h +++ b/src/devices/connecteddevice.h @@ -18,14 +18,14 @@ #ifndef CONNECTEDDEVICE_H #define CONNECTEDDEVICE_H -#include "core/musicstorage.h" -#include "core/song.h" +#include #include #include #include -#include +#include "core/musicstorage.h" +#include "core/song.h" class Application; class Database; @@ -35,7 +35,7 @@ class LibraryBackend; class LibraryModel; class ConnectedDevice : public QObject, public virtual MusicStorage, - public boost::enable_shared_from_this { + public std::enable_shared_from_this { Q_OBJECT public: diff --git a/src/devices/devicekitlister.h b/src/devices/devicekitlister.h index c91bdb437..201e9b74b 100644 --- a/src/devices/devicekitlister.h +++ b/src/devices/devicekitlister.h @@ -18,12 +18,12 @@ #ifndef DEVICEKITLISTER_H #define DEVICEKITLISTER_H -#include "devicelister.h" +#include #include #include -#include +#include "devicelister.h" class OrgFreedesktopUDisksInterface; @@ -88,7 +88,7 @@ private: T LockAndGetDeviceInfo(const QString& id, T DeviceData::*field); private: - boost::scoped_ptr interface_; + std::unique_ptr interface_; QMutex mutex_; QMap device_data_; diff --git a/src/devices/devicelister.h b/src/devices/devicelister.h index 4003fb8fc..5791968ab 100644 --- a/src/devices/devicelister.h +++ b/src/devices/devicelister.h @@ -21,8 +21,6 @@ #include #include -#include - class ConnectedDevice; class DeviceManager; 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/deviceview.h b/src/devices/deviceview.h index 6bb81c440..f64592e6e 100644 --- a/src/devices/deviceview.h +++ b/src/devices/deviceview.h @@ -18,6 +18,8 @@ #ifndef DEVICEVIEW_H #define DEVICEVIEW_H +#include + #include "core/song.h" #include "library/libraryview.h" #include "widgets/autoexpandingtreeview.h" @@ -88,8 +90,8 @@ private: MergedProxyModel* merged_model_; QSortFilterProxyModel* sort_model_; - boost::scoped_ptr properties_dialog_; - boost::scoped_ptr organise_dialog_; + std::unique_ptr properties_dialog_; + std::unique_ptr organise_dialog_; QMenu* device_menu_; QAction* eject_action_; 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/devices/gpodloader.cpp b/src/devices/gpodloader.cpp index 730cff5b8..9faa44be5 100644 --- a/src/devices/gpodloader.cpp +++ b/src/devices/gpodloader.cpp @@ -27,8 +27,9 @@ #include #include -GPodLoader::GPodLoader(const QString& mount_point, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device) +GPodLoader::GPodLoader( + const QString& mount_point, TaskManager* task_manager, + LibraryBackend* backend, std::shared_ptr device) : QObject(NULL), device_(device), mount_point_(mount_point), diff --git a/src/devices/gpodloader.h b/src/devices/gpodloader.h index c24fd8a7a..e3c2f74f6 100644 --- a/src/devices/gpodloader.h +++ b/src/devices/gpodloader.h @@ -18,9 +18,10 @@ #ifndef GPODLOADER_H #define GPODLOADER_H +#include + #include -#include #include #include "core/song.h" @@ -34,7 +35,7 @@ class GPodLoader : public QObject { public: GPodLoader(const QString& mount_point, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device); + LibraryBackend* backend, std::shared_ptr device); ~GPodLoader(); void set_music_path_prefix(const QString& prefix) { path_prefix_ = prefix; } @@ -49,7 +50,7 @@ signals: void LoadFinished(Itdb_iTunesDB* db); private: - boost::shared_ptr device_; + std::shared_ptr device_; QThread* original_thread_; QString mount_point_; diff --git a/src/devices/mtpdevice.h b/src/devices/mtpdevice.h index 6bc45f5ba..7317ea5e6 100644 --- a/src/devices/mtpdevice.h +++ b/src/devices/mtpdevice.h @@ -18,12 +18,12 @@ #ifndef MTPDEVICE_H #define MTPDEVICE_H -#include "connecteddevice.h" +#include #include #include -#include +#include "connecteddevice.h" struct LIBMTP_mtpdevice_struct; @@ -74,7 +74,7 @@ private: SongList songs_to_add_; SongList songs_to_remove_; - boost::scoped_ptr connection_; + std::unique_ptr connection_; }; #endif // MTPDEVICE_H diff --git a/src/devices/mtploader.cpp b/src/devices/mtploader.cpp index 17015f18a..abb4329b4 100644 --- a/src/devices/mtploader.cpp +++ b/src/devices/mtploader.cpp @@ -15,17 +15,19 @@ along with Clementine. If not, see . */ +#include "mtploader.h" + +#include + #include "connecteddevice.h" #include "mtpconnection.h" -#include "mtploader.h" #include "core/song.h" #include "core/taskmanager.h" #include "library/librarybackend.h" -#include - -MtpLoader::MtpLoader(const QUrl& url, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device) +MtpLoader::MtpLoader( + const QUrl& url, TaskManager* task_manager, + LibraryBackend* backend, std::shared_ptr device) : QObject(NULL), device_(device), url_(url), diff --git a/src/devices/mtploader.h b/src/devices/mtploader.h index c38401f89..357597d41 100644 --- a/src/devices/mtploader.h +++ b/src/devices/mtploader.h @@ -18,11 +18,11 @@ #ifndef MTPLOADER_H #define MTPLOADER_H +#include + #include #include -#include - class ConnectedDevice; class LibraryBackend; class TaskManager; @@ -32,7 +32,7 @@ class MtpLoader : public QObject { public: MtpLoader(const QUrl& url, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device); + LibraryBackend* backend, std::shared_ptr device); ~MtpLoader(); public slots: @@ -47,7 +47,7 @@ private: bool TryLoad(); private: - boost::shared_ptr device_; + std::shared_ptr device_; QThread* original_thread_; QUrl url_; diff --git a/src/engines/enginebase.h b/src/engines/enginebase.h index c3e75b0d5..d998639e1 100644 --- a/src/engines/enginebase.h +++ b/src/engines/enginebase.h @@ -27,8 +27,6 @@ #include -#include - #include #include #include @@ -39,7 +37,7 @@ namespace Engine { typedef std::vector Scope; -class Base : public QObject, boost::noncopyable { +class Base : public QObject { Q_OBJECT public: @@ -153,6 +151,7 @@ class Base : public QObject, boost::noncopyable { private: bool about_to_end_emitted_; + Q_DISABLE_COPY(Base); }; diff --git a/src/engines/gstengine.cpp b/src/engines/gstengine.cpp index 0f1add714..e1eb46944 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 @@ -48,9 +39,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/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index 94f77a357..21eb614b7 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -41,11 +41,11 @@ const int GstEnginePipeline::kEqBandFrequencies[] = { 60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000}; int GstEnginePipeline::sId = 1; -GstElementDeleter* GstEnginePipeline::sElementDeleter = NULL; +GstElementDeleter* GstEnginePipeline::sElementDeleter = nullptr; GstEnginePipeline::GstEnginePipeline(GstEngine* engine) - : QObject(NULL), + : QObject(nullptr), engine_(engine), id_(sId++), valid_(false), @@ -75,20 +75,19 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine) pending_seek_nanosec_(-1), volume_percent_(100), volume_modifier_(1.0), - fader_(NULL), - pipeline_(NULL), - uridecodebin_(NULL), - audiobin_(NULL), - queue_(NULL), - audioconvert_(NULL), - rgvolume_(NULL), - rglimiter_(NULL), - audioconvert2_(NULL), - equalizer_(NULL), - stereo_panorama_(NULL), - volume_(NULL), - audioscale_(NULL), - audiosink_(NULL) + pipeline_(nullptr), + uridecodebin_(nullptr), + audiobin_(nullptr), + queue_(nullptr), + audioconvert_(nullptr), + rgvolume_(nullptr), + rglimiter_(nullptr), + audioconvert2_(nullptr), + equalizer_(nullptr), + stereo_panorama_(nullptr), + volume_(nullptr), + audioscale_(nullptr), + audiosink_(nullptr) { if (!sElementDeleter) { sElementDeleter = new GstElementDeleter; diff --git a/src/engines/gstenginepipeline.h b/src/engines/gstenginepipeline.h index a1b8c9efb..65e23003f 100644 --- a/src/engines/gstenginepipeline.h +++ b/src/engines/gstenginepipeline.h @@ -18,6 +18,8 @@ #ifndef GSTENGINEPIPELINE_H #define GSTENGINEPIPELINE_H +#include + #include #include #include @@ -27,7 +29,6 @@ #include #include -#include #include "engine_fwd.h" @@ -253,7 +254,7 @@ class GstEnginePipeline : public QObject { int volume_percent_; qreal volume_modifier_; - boost::scoped_ptr fader_; + std::unique_ptr fader_; QBasicTimer fader_fudge_timer_; bool use_fudge_timer_; 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/globalsearch/spotifysearchprovider.cpp b/src/globalsearch/spotifysearchprovider.cpp index 0dfc6bdd4..5f955c27b 100644 --- a/src/globalsearch/spotifysearchprovider.cpp +++ b/src/globalsearch/spotifysearchprovider.cpp @@ -18,9 +18,7 @@ #include "spotifysearchprovider.h" #include - -#include -#include +#include #include "core/logging.h" #include "internet/internetmodel.h" @@ -219,8 +217,8 @@ QStringList SpotifySearchProvider::GetSuggestions(int count) { QStringList all_suggestions = suggestions_.toList(); - boost::mt19937 gen(std::time(0)); - boost::uniform_int<> random(0, all_suggestions.size() - 1); + std::mt19937 gen(std::time(0)); + std::uniform_int_distribution<> random(0, all_suggestions.size() - 1); QSet candidates; diff --git a/src/internet/digitallyimportedservicebase.h b/src/internet/digitallyimportedservicebase.h index 6380cb9a3..d58f3c614 100644 --- a/src/internet/digitallyimportedservicebase.h +++ b/src/internet/digitallyimportedservicebase.h @@ -18,7 +18,7 @@ #ifndef DIGITALLYIMPORTEDSERVICEBASE_H #define DIGITALLYIMPORTEDSERVICEBASE_H -#include +#include #include "digitallyimportedclient.h" #include "internetservice.h" @@ -104,7 +104,7 @@ private: QStandardItem* root_; - boost::scoped_ptr context_menu_; + std::unique_ptr context_menu_; QStandardItem* context_item_; CachedList saved_channels_; diff --git a/src/internet/groovesharkservice.cpp b/src/internet/groovesharkservice.cpp index af19640c4..ba5234c44 100644 --- a/src/internet/groovesharkservice.cpp +++ b/src/internet/groovesharkservice.cpp @@ -17,7 +17,7 @@ #include "groovesharkservice.h" -#include +#include #include #include @@ -1286,8 +1286,8 @@ void GroovesharkService::DeletePlaylist(int playlist_id) { if (!playlists_.contains(playlist_id)) { return; } - - boost::scoped_ptr confirmation_dialog(new QMessageBox( + + std::unique_ptr confirmation_dialog(new QMessageBox( QMessageBox::Question, tr("Delete Grooveshark playlist"), tr("Are you sure you want to delete this playlist?"), QMessageBox::Yes | QMessageBox::Cancel)); diff --git a/src/internet/lastfmservice.cpp b/src/internet/lastfmservice.cpp index 2636524fe..b8c2c6730 100644 --- a/src/internet/lastfmservice.cpp +++ b/src/internet/lastfmservice.cpp @@ -32,8 +32,6 @@ #include "lastfmservice.h" -#include - #include #include @@ -61,7 +59,6 @@ #include "ui/iconloader.h" #include "ui/settingsdialog.h" -using boost::scoped_ptr; using lastfm::XmlQuery; uint qHash(const lastfm::Track& track) { diff --git a/src/internet/lastfmservice.h b/src/internet/lastfmservice.h index a25b21f33..9b832ea7a 100644 --- a/src/internet/lastfmservice.h +++ b/src/internet/lastfmservice.h @@ -18,6 +18,8 @@ #ifndef LASTFMSERVICE_H #define LASTFMSERVICE_H +#include + namespace lastfm { class RadioStation; class Track; @@ -40,8 +42,6 @@ uint qHash(const lastfm::Track& track); #include #include -#include - class LastFMUrlHandler; class QAction; @@ -198,9 +198,9 @@ class LastFMService : public InternetService { QQueue playlist_; bool already_scrobbled_; - boost::scoped_ptr station_dialog_; + std::unique_ptr station_dialog_; - boost::scoped_ptr context_menu_; + std::unique_ptr context_menu_; QAction* remove_action_; QAction* add_artist_action_; QAction* add_tag_action_; diff --git a/src/internet/magnatunedownloaddialog.cpp b/src/internet/magnatunedownloaddialog.cpp index 91afc8f4d..edf645223 100644 --- a/src/internet/magnatunedownloaddialog.cpp +++ b/src/internet/magnatunedownloaddialog.cpp @@ -16,13 +16,8 @@ */ #include "magnatunedownloaddialog.h" -#include "magnatuneservice.h" -#include "internetmodel.h" -#include "ui_magnatunedownloaddialog.h" -#include "core/logging.h" -#include "core/network.h" -#include "core/utilities.h" -#include "widgets/progressitemdelegate.h" + +#include #include #include @@ -35,6 +30,14 @@ #include #include +#include "magnatuneservice.h" +#include "internetmodel.h" +#include "ui_magnatunedownloaddialog.h" +#include "core/logging.h" +#include "core/network.h" +#include "core/utilities.h" +#include "widgets/progressitemdelegate.h" + MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service, QWidget *parent) : QDialog(parent), @@ -275,7 +278,7 @@ QString MagnatuneDownloadDialog::GetOutputFilename() { void MagnatuneDownloadDialog::closeEvent(QCloseEvent* e) { if (current_reply_ && current_reply_->isRunning()) { - boost::scoped_ptr message_box(new QMessageBox( + std::unique_ptr message_box(new QMessageBox( QMessageBox::Question, tr("Really cancel?"), tr("Closing this window will cancel the download."), QMessageBox::Abort, this)); diff --git a/src/internet/magnatunedownloaddialog.h b/src/internet/magnatunedownloaddialog.h index 397a91705..7c0ffb438 100644 --- a/src/internet/magnatunedownloaddialog.h +++ b/src/internet/magnatunedownloaddialog.h @@ -18,12 +18,12 @@ #ifndef MAGNATUNEDOWNLOADDIALOG_H #define MAGNATUNEDOWNLOADDIALOG_H +#include + #include #include #include -#include - #include "core/song.h" class MagnatuneService; @@ -71,7 +71,7 @@ private: QNetworkAccessManager* network_; QNetworkReply* current_reply_; - boost::scoped_ptr download_file_; + std::unique_ptr download_file_; int next_row_; }; diff --git a/src/internet/magnatuneservice.cpp b/src/internet/magnatuneservice.cpp index 7b00a0fa2..78c343bd4 100644 --- a/src/internet/magnatuneservice.cpp +++ b/src/internet/magnatuneservice.cpp @@ -51,8 +51,6 @@ #include -using boost::shared_ptr; - const char* MagnatuneService::kServiceName = "Magnatune"; const char* MagnatuneService::kSettingsGroup = "Magnatune"; const char* MagnatuneService::kSongsTable = "magnatune_songs"; diff --git a/src/internet/savedradio.h b/src/internet/savedradio.h index d3a1d9ec6..619aeec66 100644 --- a/src/internet/savedradio.h +++ b/src/internet/savedradio.h @@ -18,9 +18,9 @@ #ifndef SAVEDRADIO_H #define SAVEDRADIO_H -#include "internetservice.h" +#include -#include +#include "internetservice.h" class QMenu; @@ -83,7 +83,7 @@ class SavedRadio : public InternetService { StreamList streams_; - boost::scoped_ptr edit_dialog_; + std::unique_ptr edit_dialog_; }; #endif // SAVEDRADIO_H diff --git a/src/internet/skydriveservice.cpp b/src/internet/skydriveservice.cpp index 0de877394..e3023f5c1 100644 --- a/src/internet/skydriveservice.cpp +++ b/src/internet/skydriveservice.cpp @@ -1,7 +1,6 @@ #include "skydriveservice.h" -#include -using boost::scoped_ptr; +#include #include @@ -158,7 +157,7 @@ QUrl SkydriveService::GetStreamingUrlFromSongId(const QString& file_id) { QUrl url(QString(kSkydriveBase) + file_id); QNetworkRequest request(url); AddAuthorizationHeader(&request); - scoped_ptr reply(network_->get(request)); + std::unique_ptr reply(network_->get(request)); WaitForSignal(reply.get(), SIGNAL(finished())); QJson::Parser parser; diff --git a/src/internet/spotifyservice.h b/src/internet/spotifyservice.h index 338114067..530aa0a5d 100644 --- a/src/internet/spotifyservice.h +++ b/src/internet/spotifyservice.h @@ -8,8 +8,6 @@ #include #include -#include - class Playlist; class SearchBoxWidget; class SpotifyServer; 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/library.h b/src/library/library.h index f174845ea..70681cda6 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -21,8 +21,6 @@ #include #include -#include - class Application; class Database; class LibraryBackend; diff --git a/src/library/librarydirectorymodel.cpp b/src/library/librarydirectorymodel.cpp index 2f2394332..06596f242 100644 --- a/src/library/librarydirectorymodel.cpp +++ b/src/library/librarydirectorymodel.cpp @@ -46,7 +46,7 @@ void LibraryDirectoryModel::DirectoryDiscovered(const Directory &dir) { } 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/libraryfilterwidget.h b/src/library/libraryfilterwidget.h index 255e35685..74620ba20 100644 --- a/src/library/libraryfilterwidget.h +++ b/src/library/libraryfilterwidget.h @@ -18,9 +18,9 @@ #ifndef LIBRARYFILTERWIDGET_H #define LIBRARYFILTERWIDGET_H -#include +#include -#include +#include #include "librarymodel.h" @@ -92,7 +92,7 @@ class LibraryFilterWidget : public QWidget { Ui_LibraryFilterWidget* ui_; LibraryModel* model_; - boost::scoped_ptr group_by_dialog_; + std::unique_ptr group_by_dialog_; SettingsDialog* settings_dialog_; QMenu* filter_age_menu_; diff --git a/src/library/librarymodel.cpp b/src/library/librarymodel.cpp index 6db78f4db..011a4466d 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; @@ -1114,7 +1118,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/librarymodel.h b/src/library/librarymodel.h index 79a105327..efd2812e1 100644 --- a/src/library/librarymodel.h +++ b/src/library/librarymodel.h @@ -32,8 +32,6 @@ #include "playlist/playlistmanager.h" #include "smartplaylists/generator_fwd.h" -#include - class Application; class AlbumCoverLoader; class LibraryDirectoryModel; 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/library/libraryview.h b/src/library/libraryview.h index 85afe7e8a..fb096fa2d 100644 --- a/src/library/libraryview.h +++ b/src/library/libraryview.h @@ -18,13 +18,13 @@ #ifndef LIBRARYVIEW_H #define LIBRARYVIEW_H -#include "core/song.h" -#include "ui/edittagdialog.h" -#include "widgets/autoexpandingtreeview.h" +#include #include -#include +#include "core/song.h" +#include "ui/edittagdialog.h" +#include "widgets/autoexpandingtreeview.h" class Application; class LibraryFilterWidget; @@ -140,8 +140,8 @@ class LibraryView : public AutoExpandingTreeView { QAction* edit_smart_playlist_; QAction* delete_smart_playlist_; - boost::scoped_ptr organise_dialog_; - boost::scoped_ptr edit_tag_dialog_; + std::unique_ptr organise_dialog_; + std::unique_ptr edit_tag_dialog_; bool is_in_keyboard_search_; diff --git a/src/main.cpp b/src/main.cpp index 050d335d9..cd7bcc2f1 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 @@ -449,7 +448,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/moodbar/moodbarloader.cpp b/src/moodbar/moodbarloader.cpp index dacbe1e0e..2bface572 100644 --- a/src/moodbar/moodbarloader.cpp +++ b/src/moodbar/moodbarloader.cpp @@ -17,7 +17,7 @@ #include "moodbarloader.h" -#include +#include #include #include @@ -101,7 +101,7 @@ MoodbarLoader::Result MoodbarLoader::Load( } // Maybe it exists in the cache? - boost::scoped_ptr cache_device(cache_->data(url)); + std::unique_ptr cache_device(cache_->data(url)); if (cache_device) { qLog(Info) << "Loading cached moodbar data for" << filename; *data = cache_device->readAll(); diff --git a/src/networkremote/networkremote.h b/src/networkremote/networkremote.h index 5de164eb3..716538251 100644 --- a/src/networkremote/networkremote.h +++ b/src/networkremote/networkremote.h @@ -1,7 +1,7 @@ #ifndef NETWORKREMOTE_H #define NETWORKREMOTE_H -#include +#include #include #include @@ -30,10 +30,10 @@ public slots: void SendKitten(quint64 id, const QImage& kitten); private: - boost::scoped_ptr server_; - boost::scoped_ptr server_ipv6_; - boost::scoped_ptr incoming_data_parser_; - boost::scoped_ptr outgoing_data_creator_; + std::unique_ptr server_; + std::unique_ptr server_ipv6_; + std::unique_ptr incoming_data_parser_; + std::unique_ptr outgoing_data_creator_; quint16 port_; bool use_remote_; diff --git a/src/networkremote/outgoingdatacreator.h b/src/networkremote/outgoingdatacreator.h index 264da2add..fb243a3db 100644 --- a/src/networkremote/outgoingdatacreator.h +++ b/src/networkremote/outgoingdatacreator.h @@ -1,6 +1,8 @@ #ifndef OUTGOINGDATACREATOR_H #define OUTGOINGDATACREATOR_H +#include + #include #include #include @@ -24,7 +26,6 @@ #include "songinfo/ultimatelyricsreader.h" #include "remotecontrolmessages.pb.h" #include "remoteclient.h" -#include typedef QList ProviderList; @@ -91,7 +92,7 @@ private: int last_track_position_; bool aww_; - boost::scoped_ptr ultimate_reader_; + std::unique_ptr ultimate_reader_; ProviderList provider_list_; QMap results_; SongInfoFetcher* fetcher_; diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index ed2cd6938..e5525bd28 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" @@ -49,36 +68,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"; @@ -1267,7 +1265,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)); } @@ -1814,8 +1812,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/playlist.h b/src/playlist/playlist.h index 8a24ce7f8..cf7721dee 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -21,8 +21,6 @@ #include #include -#include - #include "playlistitem.h" #include "playlistsequence.h" #include "core/tagreaderclient.h" 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 c908a3a84..eebf07303 100644 --- a/src/playlist/playlistbackend.h +++ b/src/playlist/playlistbackend.h @@ -92,9 +92,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/playlist/playlistsequence.h b/src/playlist/playlistsequence.h index cfdae520d..0141b09cf 100644 --- a/src/playlist/playlistsequence.h +++ b/src/playlist/playlistsequence.h @@ -18,12 +18,12 @@ #ifndef PLAYLISTSEQUENCE_H #define PLAYLISTSEQUENCE_H +#include + #include #include "core/settingsprovider.h" -#include - class QMenu; class Ui_PlaylistSequence; @@ -79,7 +79,7 @@ class PlaylistSequence : public QWidget { private: Ui_PlaylistSequence* ui_; - boost::scoped_ptr settings_; + std::unique_ptr settings_; QMenu* repeat_menu_; QMenu* shuffle_menu_; diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index 8fdc1a6c8..8ce39747c 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -18,13 +18,13 @@ #ifndef PLAYLISTVIEW_H #define PLAYLISTVIEW_H -#include "playlist.h" +#include #include #include #include -#include +#include "playlist.h" class QCleanlooksStyle; @@ -52,7 +52,7 @@ public: QPainter* painter, const QWidget* widget) const; private: - boost::scoped_ptr cleanlooks_; + std::unique_ptr cleanlooks_; }; diff --git a/src/playlistparsers/xmlparser.h b/src/playlistparsers/xmlparser.h index ee1081f85..33750b028 100644 --- a/src/playlistparsers/xmlparser.h +++ b/src/playlistparsers/xmlparser.h @@ -23,8 +23,6 @@ #include #include -#include - class QDomDocument; class QDomNode; @@ -32,7 +30,7 @@ class XMLParser : public ParserBase { protected: XMLParser(LibraryBackendInterface* library, QObject* parent); - class StreamElement : public boost::noncopyable { + class StreamElement { public: StreamElement(const QString& name, QXmlStreamWriter* stream) : stream_(stream) { stream->writeStartElement(name); @@ -44,6 +42,7 @@ class XMLParser : public ParserBase { private: QXmlStreamWriter* stream_; + Q_DISABLE_COPY(StreamElement); }; }; diff --git a/src/smartplaylists/generator.h b/src/smartplaylists/generator.h index 7046e87ec..561e3b8f5 100644 --- a/src/smartplaylists/generator.h +++ b/src/smartplaylists/generator.h @@ -20,14 +20,13 @@ #include "playlist/playlistitem.h" -#include -#include +#include class LibraryBackend; namespace smart_playlists { -class Generator : public QObject, public boost::enable_shared_from_this { +class Generator : public QObject, public std::enable_shared_from_this { Q_OBJECT public: @@ -38,7 +37,7 @@ public: static const int kDefaultDynamicFuture; // Creates a new Generator of the given type - static boost::shared_ptr Create(const QString& type); + static std::shared_ptr Create(const QString& type); // Should be called before Load on a new Generator void set_library(LibraryBackend* backend) { backend_ = backend; } diff --git a/src/smartplaylists/generator_fwd.h b/src/smartplaylists/generator_fwd.h index db110b0bd..4f46aa135 100644 --- a/src/smartplaylists/generator_fwd.h +++ b/src/smartplaylists/generator_fwd.h @@ -18,13 +18,13 @@ #ifndef PLAYLISTGENERATOR_FWD_H #define PLAYLISTGENERATOR_FWD_H -#include +#include namespace smart_playlists { class Generator; -typedef boost::shared_ptr GeneratorPtr; +typedef std::shared_ptr GeneratorPtr; } // namespace diff --git a/src/smartplaylists/querywizardplugin.cpp b/src/smartplaylists/querywizardplugin.cpp index e0991a582..2bc4f5b6d 100644 --- a/src/smartplaylists/querywizardplugin.cpp +++ b/src/smartplaylists/querywizardplugin.cpp @@ -55,7 +55,7 @@ public: SearchPreview* preview_; - boost::scoped_ptr ui_; + std::unique_ptr ui_; }; class QueryWizardPlugin::SortPage : public QWizardPage { @@ -161,8 +161,8 @@ int QueryWizardPlugin::CreatePages(QWizard* wizard, int finish_page_id) { } void QueryWizardPlugin::SetGenerator(GeneratorPtr g) { - boost::shared_ptr gen = - boost::dynamic_pointer_cast(g); + std::shared_ptr gen = + std::dynamic_pointer_cast(g); if (!gen) return; Search search = gen->search(); @@ -198,10 +198,10 @@ void QueryWizardPlugin::SetGenerator(GeneratorPtr g) { } GeneratorPtr QueryWizardPlugin::CreateGenerator() const { - boost::shared_ptr gen(new QueryGenerator); + std::shared_ptr gen(new QueryGenerator); gen->Load(MakeSearch()); - return boost::static_pointer_cast(gen); + return std::static_pointer_cast(gen); } void QueryWizardPlugin::UpdateSortOrder() { diff --git a/src/smartplaylists/querywizardplugin.h b/src/smartplaylists/querywizardplugin.h index 8213d945b..8dded7c32 100644 --- a/src/smartplaylists/querywizardplugin.h +++ b/src/smartplaylists/querywizardplugin.h @@ -18,12 +18,13 @@ #ifndef QUERYWIZARDPLUGIN_H #define QUERYWIZARDPLUGIN_H -#include "search.h" #include "wizardplugin.h" +#include + #include -#include +#include "search.h" class Ui_SmartPlaylistQuerySearchPage; class Ui_SmartPlaylistQuerySortPage; @@ -70,7 +71,7 @@ private: Search MakeSearch() const; SearchPage* search_page_; - boost::scoped_ptr sort_ui_; + std::unique_ptr sort_ui_; int previous_scrollarea_max_; }; diff --git a/src/smartplaylists/searchpreview.cpp b/src/smartplaylists/searchpreview.cpp index 08c6065f0..d16db4c25 100644 --- a/src/smartplaylists/searchpreview.cpp +++ b/src/smartplaylists/searchpreview.cpp @@ -15,14 +15,17 @@ along with Clementine. If not, see . */ -#include "querygenerator.h" #include "searchpreview.h" #include "ui_searchpreview.h" -#include "playlist/playlist.h" + +#include #include #include +#include "querygenerator.h" +#include "playlist/playlist.h" + namespace smart_playlists { typedef QFuture Future; @@ -94,7 +97,7 @@ PlaylistItemList DoRunSearch(GeneratorPtr gen) { void SearchPreview::RunSearch(const Search& search) { generator_.reset(new QueryGenerator); generator_->set_library(backend_); - boost::dynamic_pointer_cast(generator_)->Load(search); + std::dynamic_pointer_cast(generator_)->Load(search); ui_->busy_container->show(); ui_->count_label->hide(); @@ -109,7 +112,7 @@ void SearchPreview::SearchFinished() { FutureWatcher* watcher = static_cast(sender()); watcher->deleteLater(); - last_search_ = boost::dynamic_pointer_cast(generator_)->search(); + last_search_ = std::dynamic_pointer_cast(generator_)->search(); generator_.reset(); if (pending_search_.is_valid() && pending_search_ != last_search_) { diff --git a/src/songinfo/echonestbiographies.cpp b/src/songinfo/echonestbiographies.cpp index 0ac9f69a1..923fb4bb9 100644 --- a/src/songinfo/echonestbiographies.cpp +++ b/src/songinfo/echonestbiographies.cpp @@ -16,18 +16,19 @@ */ #include "echonestbiographies.h" -#include "songinfotextview.h" -#include "core/logging.h" + +#include #include -#include +#include "songinfotextview.h" +#include "core/logging.h" struct EchoNestBiographies::Request { Request(int id) : id_(id), artist_(new Echonest::Artist) {} int id_; - boost::scoped_ptr artist_; + std::unique_ptr artist_; }; EchoNestBiographies::EchoNestBiographies() { @@ -46,7 +47,7 @@ EchoNestBiographies::EchoNestBiographies() { } void EchoNestBiographies::FetchInfo(int id, const Song& metadata) { - boost::shared_ptr request(new Request(id)); + std::shared_ptr request(new Request(id)); request->artist_->setName(metadata.artist()); QNetworkReply* reply = request->artist_->fetchBiographies(); @@ -70,7 +71,7 @@ void EchoNestBiographies::RequestFinished() { QSet already_seen; - foreach (const Echonest::Biography& bio, request->artist_->biographies()) { + for (const Echonest::Biography& bio : request->artist_->biographies()) { QString canonical_site = bio.site().toLower(); canonical_site.replace(QRegExp("[^a-z]"),""); diff --git a/src/songinfo/echonestbiographies.h b/src/songinfo/echonestbiographies.h index 5223fa114..8e8175fd1 100644 --- a/src/songinfo/echonestbiographies.h +++ b/src/songinfo/echonestbiographies.h @@ -18,9 +18,9 @@ #ifndef ECHONESTBIOGRAPHIES_H #define ECHONESTBIOGRAPHIES_H -#include "songinfoprovider.h" +#include -#include +#include "songinfoprovider.h" class QNetworkReply; @@ -40,7 +40,7 @@ private: QMap site_icons_; struct Request; - typedef boost::shared_ptr RequestPtr; + typedef std::shared_ptr RequestPtr; QMap requests_; }; diff --git a/src/songinfo/echonestimages.cpp b/src/songinfo/echonestimages.cpp index 87a5c8559..b16e9c20c 100644 --- a/src/songinfo/echonestimages.cpp +++ b/src/songinfo/echonestimages.cpp @@ -16,21 +16,22 @@ */ #include "echonestimages.h" -#include "core/logging.h" + +#include #include -#include +#include "core/logging.h" struct EchoNestImages::Request { Request(int id) : id_(id), artist_(new Echonest::Artist) {} int id_; - boost::scoped_ptr artist_; + std::unique_ptr artist_; }; void EchoNestImages::FetchInfo(int id, const Song& metadata) { - boost::shared_ptr request(new Request(id)); + std::shared_ptr request(new Request(id)); request->artist_->setName(metadata.artist()); QNetworkReply* reply = request->artist_->fetchImages(); diff --git a/src/songinfo/echonestimages.h b/src/songinfo/echonestimages.h index ddd3f66e5..25585b9bb 100644 --- a/src/songinfo/echonestimages.h +++ b/src/songinfo/echonestimages.h @@ -18,9 +18,9 @@ #ifndef ECHONESTIMAGES_H #define ECHONESTIMAGES_H -#include "songinfoprovider.h" +#include -#include +#include "songinfoprovider.h" class QNetworkReply; @@ -35,7 +35,7 @@ private slots: private: struct Request; - typedef boost::shared_ptr RequestPtr; + typedef std::shared_ptr RequestPtr; QMap requests_; }; diff --git a/src/songinfo/echonesttags.cpp b/src/songinfo/echonesttags.cpp index 5e4c902ab..6ed53afe2 100644 --- a/src/songinfo/echonesttags.cpp +++ b/src/songinfo/echonesttags.cpp @@ -16,22 +16,23 @@ */ #include "echonesttags.h" -#include "tagwidget.h" -#include "core/logging.h" + +#include #include -#include +#include "tagwidget.h" +#include "core/logging.h" struct EchoNestTags::Request { Request(int id) : id_(id), artist_(new Echonest::Artist) {} int id_; - boost::scoped_ptr artist_; + std::unique_ptr artist_; }; void EchoNestTags::FetchInfo(int id, const Song& metadata) { - boost::shared_ptr request(new Request(id)); + std::shared_ptr request(new Request(id)); request->artist_->setName(metadata.artist()); QNetworkReply* reply = request->artist_->fetchTerms(); @@ -65,7 +66,7 @@ void EchoNestTags::RequestFinished() { widget->SetIcon(data.icon_); - foreach (const Echonest::Term& term, request->artist_->terms()) { + for (const Echonest::Term& term : request->artist_->terms()) { widget->AddTag(term.name()); if (widget->count() >= 10) break; diff --git a/src/songinfo/echonesttags.h b/src/songinfo/echonesttags.h index 7ef9284b3..96bddd86d 100644 --- a/src/songinfo/echonesttags.h +++ b/src/songinfo/echonesttags.h @@ -18,9 +18,9 @@ #ifndef ECHONESTTAGS_H #define ECHONESTTAGS_H -#include "songinfoprovider.h" +#include -#include +#include "songinfoprovider.h" class QNetworkReply; @@ -35,7 +35,7 @@ private slots: private: struct Request; - typedef boost::shared_ptr RequestPtr; + typedef std::shared_ptr RequestPtr; QMap requests_; }; diff --git a/src/songinfo/songinfoview.h b/src/songinfo/songinfoview.h index 887e31242..82b869dfc 100644 --- a/src/songinfo/songinfoview.h +++ b/src/songinfo/songinfoview.h @@ -18,9 +18,9 @@ #ifndef SONGINFOVIEW_H #define SONGINFOVIEW_H -#include "songinfobase.h" +#include -#include +#include "songinfobase.h" class UltimateLyricsProvider; class UltimateLyricsReader; @@ -53,7 +53,7 @@ private slots: void UltimateLyricsParsed(); private: - boost::scoped_ptr ultimate_reader_; + std::unique_ptr ultimate_reader_; }; #endif // SONGINFOVIEW_H diff --git a/src/songinfo/ultimatelyricsprovider.cpp b/src/songinfo/ultimatelyricsprovider.cpp index 349733593..98f798b99 100644 --- a/src/songinfo/ultimatelyricsprovider.cpp +++ b/src/songinfo/ultimatelyricsprovider.cpp @@ -26,8 +26,6 @@ #include #include -#include - const int UltimateLyricsProvider::kRedirectLimit = 5; diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index 9ce4c46ec..478190a22 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; @@ -543,7 +543,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 303009525..ab3e3efcf 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" @@ -139,7 +138,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/albumcovermanager.cpp b/src/ui/albumcovermanager.cpp index ab98af032..43112cca3 100644 --- a/src/ui/albumcovermanager.cpp +++ b/src/ui/albumcovermanager.cpp @@ -211,7 +211,7 @@ void AlbumCoverManager::showEvent(QShowEvent *) { void AlbumCoverManager::closeEvent(QCloseEvent* e) { if (!cover_fetching_tasks_.isEmpty()) { - boost::scoped_ptr message_box(new QMessageBox( + std::unique_ptr message_box(new QMessageBox( QMessageBox::Question, tr("Really cancel?"), tr("Closing this window will stop searching for album covers."), QMessageBox::Abort, this)); diff --git a/src/ui/albumcovermanagerlist.cpp b/src/ui/albumcovermanagerlist.cpp index a73cb9f5a..faa671f51 100644 --- a/src/ui/albumcovermanagerlist.cpp +++ b/src/ui/albumcovermanagerlist.cpp @@ -15,16 +15,17 @@ along with Clementine. If not, see . */ -#include "albumcovermanager.h" #include "albumcovermanagerlist.h" -#include "library/librarybackend.h" -#include "playlist/songmimedata.h" -#include +#include #include #include +#include "albumcovermanager.h" +#include "library/librarybackend.h" +#include "playlist/songmimedata.h" + AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent) : QListWidget(parent), manager_(NULL) @@ -48,7 +49,7 @@ QMimeData* AlbumCoverManagerList::mimeData(const QList items) } // Get the QAbstractItemModel data so the picture works - boost::scoped_ptr orig_data(QListWidget::mimeData(items)); + std::unique_ptr orig_data(QListWidget::mimeData(items)); SongMimeData* mime_data = new SongMimeData; mime_data->backend = manager_->backend(); diff --git a/src/ui/albumcoversearcher.h b/src/ui/albumcoversearcher.h index 710e9ce8a..f028cce40 100644 --- a/src/ui/albumcoversearcher.h +++ b/src/ui/albumcoversearcher.h @@ -18,14 +18,12 @@ #ifndef ALBUMCOVERSEARCHER_H #define ALBUMCOVERSEARCHER_H -#include "covers/albumcoverfetcher.h" -#include "covers/albumcoverloaderoptions.h" - #include #include #include -#include +#include "covers/albumcoverfetcher.h" +#include "covers/albumcoverloaderoptions.h" class AlbumCoverLoader; class Application; @@ -35,7 +33,6 @@ class QModelIndex; class QStandardItem; class QStandardItemModel; - class SizeOverlayDelegate : public QStyledItemDelegate { public: static const int kMargin; diff --git a/src/ui/globalshortcutgrabber.mm b/src/ui/globalshortcutgrabber.mm index 0fe26dd45..873bf9ac7 100644 --- a/src/ui/globalshortcutgrabber.mm +++ b/src/ui/globalshortcutgrabber.mm @@ -24,11 +24,9 @@ #include -#include - #import "core/mac_utilities.h" -class MacMonitorWrapper : boost::noncopyable { +class MacMonitorWrapper { public: explicit MacMonitorWrapper(id monitor) : local_monitor_(monitor) {} @@ -36,6 +34,7 @@ class MacMonitorWrapper : boost::noncopyable { private: id local_monitor_; + Q_DISABLE_COPY(MacMonitorWrapper); }; bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) { diff --git a/src/ui/globalshortcutssettingspage.h b/src/ui/globalshortcutssettingspage.h index dd830ee74..593b14a5c 100644 --- a/src/ui/globalshortcutssettingspage.h +++ b/src/ui/globalshortcutssettingspage.h @@ -18,11 +18,11 @@ #ifndef GLOBALSHORTCUTSSETTINGSPAGE_H #define GLOBALSHORTCUTSSETTINGSPAGE_H +#include + #include #include -#include - #include "core/globalshortcuts.h" #include "ui/settingspage.h" @@ -64,7 +64,7 @@ private: Ui_GlobalShortcutsSettingsPage* ui_; bool initialised_; - boost::scoped_ptr grabber_; + std::unique_ptr grabber_; QSettings settings_; QMap shortcuts_; diff --git a/src/ui/macsystemtrayicon.h b/src/ui/macsystemtrayicon.h index 154473bd7..1cfa5f6ab 100644 --- a/src/ui/macsystemtrayicon.h +++ b/src/ui/macsystemtrayicon.h @@ -18,14 +18,13 @@ #ifndef MACSYSTEMTRAYICON_H #define MACSYSTEMTRAYICON_H -#include "systemtrayicon.h" +#include -#include -#include +#include "systemtrayicon.h" class MacSystemTrayIconPrivate; -class MacSystemTrayIcon : public SystemTrayIcon, boost::noncopyable { +class MacSystemTrayIcon : public SystemTrayIcon { Q_OBJECT public: @@ -52,8 +51,8 @@ protected: private: QPixmap orange_icon_; QPixmap grey_icon_; - - boost::scoped_ptr p_; + std::unique_ptr p_; + Q_DISABLE_COPY(MacSystemTrayIcon); }; #endif // MACSYSTEMTRAYICON_H diff --git a/src/ui/macsystemtrayicon.mm b/src/ui/macsystemtrayicon.mm index cc4695e1a..5ff661ab1 100644 --- a/src/ui/macsystemtrayicon.mm +++ b/src/ui/macsystemtrayicon.mm @@ -56,7 +56,7 @@ } @end -class MacSystemTrayIconPrivate : boost::noncopyable { +class MacSystemTrayIconPrivate { public: MacSystemTrayIconPrivate() { dock_menu_ = [[NSMenu alloc] initWithTitle:@"DockMenu"]; @@ -159,6 +159,8 @@ class MacSystemTrayIconPrivate : boost::noncopyable { NSMenuItem* now_playing_; NSMenuItem* now_playing_artist_; NSMenuItem* now_playing_title_; + + Q_DISABLE_COPY(MacSystemTrayIconPrivate); }; MacSystemTrayIcon::MacSystemTrayIcon(QObject* parent) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 327471255..e7063e0fb 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" @@ -122,34 +149,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*); @@ -180,18 +179,8 @@ MainWindow::MainWindow(Application* app, device_view_(device_view_container_->view()), song_info_view_(new SongInfoView(this)), artist_info_view_(new ArtistInfoView(this)), - settings_dialog_(NULL), - cover_manager_(NULL), equalizer_(new Equalizer), - error_dialog_(NULL), organise_dialog_(new OrganiseDialog(app_->task_manager())), - queue_manager_(NULL), -#ifdef ENABLE_VISUALISATIONS - visualisation_(NULL), -#endif -#ifdef HAVE_WIIMOTEDEV - wiimotedev_shortcuts_(NULL), -#endif playlist_menu_(new QMenu(this)), playlist_add_to_another_(NULL), playlistitem_actions_separator_(NULL), @@ -1962,7 +1951,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/mainwindow.h b/src/ui/mainwindow.h index 8f11c8bdc..4ab78948f 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -18,7 +18,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include #include #include @@ -287,8 +287,8 @@ class MainWindow : public QMainWindow, public PlatformInterface { Application* app_; SystemTrayIcon* tray_icon_; OSD* osd_; - boost::scoped_ptr edit_tag_dialog_; - boost::scoped_ptr about_dialog_; + std::unique_ptr edit_tag_dialog_; + std::unique_ptr about_dialog_; GlobalShortcuts* global_shortcuts_; Remote* remote_; @@ -297,7 +297,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { LibraryViewContainer* library_view_; FileView* file_view_; #ifdef HAVE_AUDIOCD - boost::scoped_ptr rip_cd_; + std::unique_ptr rip_cd_; #endif PlaylistListContainer* playlist_list_; InternetViewContainer* internet_view_; @@ -306,25 +306,25 @@ class MainWindow : public QMainWindow, public PlatformInterface { SongInfoView* song_info_view_; ArtistInfoView* artist_info_view_; - boost::scoped_ptr settings_dialog_; - boost::scoped_ptr add_stream_dialog_; - boost::scoped_ptr cover_manager_; - boost::scoped_ptr equalizer_; - boost::scoped_ptr transcode_dialog_; - boost::scoped_ptr error_dialog_; - boost::scoped_ptr organise_dialog_; - boost::scoped_ptr queue_manager_; + std::unique_ptr settings_dialog_; + std::unique_ptr add_stream_dialog_; + std::unique_ptr cover_manager_; + std::unique_ptr equalizer_; + std::unique_ptr transcode_dialog_; + std::unique_ptr error_dialog_; + std::unique_ptr organise_dialog_; + std::unique_ptr queue_manager_; - boost::scoped_ptr tag_fetcher_; - boost::scoped_ptr track_selection_dialog_; + std::unique_ptr tag_fetcher_; + std::unique_ptr track_selection_dialog_; PlaylistItemList autocomplete_tag_items_; #ifdef ENABLE_VISUALISATIONS - boost::scoped_ptr visualisation_; + std::unique_ptr visualisation_; #endif #ifdef HAVE_WIIMOTEDEV - boost::scoped_ptr wiimotedev_shortcuts_; + std::unique_ptr wiimotedev_shortcuts_; #endif QAction* library_show_all_; diff --git a/src/ui/organisedialog.cpp b/src/ui/organisedialog.cpp index 45bea8f6e..51749fa74 100644 --- a/src/ui/organisedialog.cpp +++ b/src/ui/organisedialog.cpp @@ -15,14 +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 "core/utilities.h" + +#include #include #include @@ -34,6 +30,13 @@ #include #include +#include "iconloader.h" +#include "organiseerrordialog.h" +#include "core/musicstorage.h" +#include "core/organise.h" +#include "core/tagreaderclient.h" +#include "core/utilities.h" + const char* OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension"; const char* OrganiseDialog::kSettingsGroup = "OrganiseDialog"; @@ -190,12 +193,12 @@ Organise::NewSongInfoList OrganiseDialog::ComputeNewSongsFilenames( 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/ui/organisedialog.h b/src/ui/organisedialog.h index a9a2ce0b8..4466e0307 100644 --- a/src/ui/organisedialog.h +++ b/src/ui/organisedialog.h @@ -19,6 +19,7 @@ #define ORGANISEDIALOG_H #include + #include #include #include diff --git a/src/visualisations/projectmvisualisation.cpp b/src/visualisations/projectmvisualisation.cpp index d16baf36d..49ecf7452 100644 --- a/src/visualisations/projectmvisualisation.cpp +++ b/src/visualisations/projectmvisualisation.cpp @@ -48,15 +48,13 @@ ProjectMVisualisation::ProjectMVisualisation(QObject *parent) : QGraphicsScene(parent), - projectm_(NULL), - preset_model_(NULL), + preset_model_(nullptr), mode_(Random), duration_(15), - texture_size_(512) -{ + texture_size_(512) { connect(this, SIGNAL(sceneRectChanged(QRectF)), SLOT(SceneRectChanged(QRectF))); - for (int i=0 ; i + #include #include #include -#include - #include "engines/bufferconsumer.h" class projectM; @@ -78,12 +78,12 @@ private: int IndexOfPreset(const QString& path) const; private: - boost::scoped_ptr projectm_; + std::unique_ptr projectm_; ProjectMPresetModel* preset_model_; Mode mode_; int duration_; - boost::scoped_ptr temporary_font_; + std::unique_ptr temporary_font_; std::vector default_rating_list_; diff --git a/src/widgets/fancytabwidget.h b/src/widgets/fancytabwidget.h index cbdbb2167..5d9d412fa 100644 --- a/src/widgets/fancytabwidget.h +++ b/src/widgets/fancytabwidget.h @@ -30,6 +30,8 @@ #ifndef FANCYTABWIDGET_H #define FANCYTABWIDGET_H +#include + #include #include #include @@ -37,8 +39,6 @@ #include #include -#include - class QActionGroup; class QMenu; class QPainter; @@ -219,7 +219,7 @@ private: QMenu* menu_; - boost::scoped_ptr proxy_style_; + std::unique_ptr proxy_style_; }; } // namespace Internal 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_; diff --git a/src/widgets/nowplayingwidget.h b/src/widgets/nowplayingwidget.h index b7dd4da1d..fee7f8efe 100644 --- a/src/widgets/nowplayingwidget.h +++ b/src/widgets/nowplayingwidget.h @@ -18,12 +18,12 @@ #ifndef NOWPLAYINGWIDGET_H #define NOWPLAYINGWIDGET_H -#include "core/song.h" -#include "covers/albumcoverloaderoptions.h" +#include #include -#include +#include "core/song.h" +#include "covers/albumcoverloaderoptions.h" class AlbumCoverChoiceController; class Application; @@ -145,10 +145,10 @@ private: static const char* kHypnotoadPath; QAction* bask_in_his_glory_action_; - boost::scoped_ptr hypnotoad_; - boost::scoped_ptr big_hypnotoad_; + std::unique_ptr hypnotoad_; + std::unique_ptr big_hypnotoad_; - boost::scoped_ptr spinner_animation_; + std::unique_ptr spinner_animation_; bool downloading_covers_; bool aww_; diff --git a/src/widgets/osd.h b/src/widgets/osd.h index d7783e88a..158bc0d9b 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -18,6 +18,8 @@ #ifndef OSD_H #define OSD_H +#include + #include #include #include @@ -36,7 +38,6 @@ class QDBusPendingCallWatcher; #ifdef HAVE_DBUS # include -# include QDBusArgument& operator<< (QDBusArgument& arg, const QImage& image); const QDBusArgument& operator>> (const QDBusArgument& arg, QImage& image); @@ -137,7 +138,7 @@ class OSD : public QObject { #endif // Q_OS_DARWIN #ifdef HAVE_DBUS - boost::scoped_ptr interface_; + std::unique_ptr interface_; uint notification_id_; QDateTime last_notification_time_; #endif diff --git a/src/widgets/osd_x11.cpp b/src/widgets/osd_x11.cpp index afe8e0db1..831b9761a 100644 --- a/src/widgets/osd_x11.cpp +++ b/src/widgets/osd_x11.cpp @@ -15,19 +15,20 @@ along with Clementine. If not, see . */ -#include "config.h" #include "osd.h" -#include "core/logging.h" + +#include #include +#include "config.h" +#include "core/logging.h" + #ifdef HAVE_DBUS #include "dbus/notification.h" #include #include -using boost::scoped_ptr; - QDBusArgument& operator<< (QDBusArgument& arg, const QImage& image) { if (image.isNull()) { // Sometimes this gets called with a null QImage for no obvious reason. @@ -142,7 +143,7 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message, #ifdef HAVE_DBUS void OSD::CallFinished(QDBusPendingCallWatcher* watcher) { - scoped_ptr w(watcher); + std::unique_ptr w(watcher); QDBusPendingReply reply = *watcher; if (reply.isError()) { diff --git a/src/wiimotedev/shortcuts.cpp b/src/wiimotedev/shortcuts.cpp index c01e4f4f8..6379a5ab1 100644 --- a/src/wiimotedev/shortcuts.cpp +++ b/src/wiimotedev/shortcuts.cpp @@ -36,7 +36,6 @@ WiimotedevShortcuts::WiimotedevShortcuts(OSD* osd, QWidget* window, QObject* par wiimotedev_device_(1), wiimotedev_enable_(true), wiimotedev_focus_(false), - wiimotedev_iface_(NULL), wiimotedev_notification_(true) { connect(this, SIGNAL(WiiremoteActived(int)), osd_, SLOT(WiiremoteActived(int))); diff --git a/src/wiimotedev/shortcuts.h b/src/wiimotedev/shortcuts.h index 046a5829b..be0206789 100644 --- a/src/wiimotedev/shortcuts.h +++ b/src/wiimotedev/shortcuts.h @@ -18,8 +18,9 @@ #ifndef WIIMOTEDEV_SHORTCUTS_H #define WIIMOTEDEV_SHORTCUTS_H +#include + #include -#include #include "dbus/wiimotedev.h" #include "core/player.h" @@ -77,7 +78,7 @@ private: quint32 wiimotedev_device_; bool wiimotedev_enable_; bool wiimotedev_focus_; - boost::scoped_ptr wiimotedev_iface_; + std::unique_ptr wiimotedev_iface_; bool wiimotedev_notification_; QHash actions_; diff --git a/src/wiimotedev/wiimoteshortcutgrabber.h b/src/wiimotedev/wiimoteshortcutgrabber.h index 130e167e8..d02c9fc8e 100644 --- a/src/wiimotedev/wiimoteshortcutgrabber.h +++ b/src/wiimotedev/wiimoteshortcutgrabber.h @@ -18,11 +18,11 @@ #ifndef WIIMOTESHORTCUTGRABBER_H #define WIIMOTESHORTCUTGRABBER_H +#include + #include #include -#include - #include "wiimotesettingspage.h" #include "dbus/wiimotedev.h" @@ -47,7 +47,7 @@ private: Ui_WiimoteShortcutGrabber* ui_; WiimoteSettingsPage* config_; - boost::scoped_ptr wiimotedev_iface_; + std::unique_ptr wiimotedev_iface_; quint32 wiimotedev_device_; quint64 wiimotedev_buttons_;