Use c++11 instead of boost where possible.

This commit is contained in:
John Maguire 2014-02-06 14:48:00 +01:00
parent 7c102ace45
commit d309d4ab27
113 changed files with 616 additions and 612 deletions

View File

@ -20,24 +20,6 @@ if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++")
endif () endif ()
set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
check_cxx_source_compiles(
"#include <unordered_map>
int main() {
std::unordered_map<int, int> m;
return 0;
}
"
USE_STD_UNORDERED_MAP)
check_cxx_source_compiles(
"int main() {
[](){}();
}
"
HAVE_LAMBDAS)
unset(CMAKE_REQUIRED_FLAGS)
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
set(LINUX 1) set(LINUX 1)
endif (UNIX AND NOT APPLE) endif (UNIX AND NOT APPLE)

View File

@ -33,7 +33,7 @@ ClosureBase::~ClosureBase() {
CallbackClosure::CallbackClosure( CallbackClosure::CallbackClosure(
QObject* sender, QObject* sender,
const char* signal, const char* signal,
boost::function<void()> callback) std::function<void()> callback)
: ClosureBase(new ObjectHelper(sender, signal, this)), : ClosureBase(new ObjectHelper(sender, signal, this)),
callback_(callback) { callback_(callback) {
} }
@ -67,7 +67,7 @@ void Unpack(QList<QGenericArgument>*) {}
_detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure(
QObject* sender, QObject* sender,
const char* signal, const char* signal,
boost::function<void()> callback) { std::function<void()> callback) {
return new _detail::CallbackClosure( return new _detail::CallbackClosure(
sender, signal, callback); sender, signal, callback);
} }

View File

@ -19,22 +19,18 @@
#define CLOSURE_H #define CLOSURE_H
#include <functional> #include <functional>
#include <memory>
#include <QMetaMethod> #include <QMetaMethod>
#include <QObject> #include <QObject>
#include <QSharedPointer> #include <QSharedPointer>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
namespace _detail { namespace _detail {
class ObjectHelper; class ObjectHelper;
// Interface for ObjectHelper to call on signal emission. // Interface for ObjectHelper to call on signal emission.
class ClosureBase : boost::noncopyable { class ClosureBase {
public: public:
virtual ~ClosureBase(); virtual ~ClosureBase();
virtual void Invoke() = 0; virtual void Invoke() = 0;
@ -45,6 +41,9 @@ class ClosureBase : boost::noncopyable {
protected: protected:
explicit ClosureBase(ObjectHelper*); explicit ClosureBase(ObjectHelper*);
ObjectHelper* helper_; ObjectHelper* helper_;
private:
Q_DISABLE_COPY(ClosureBase);
}; };
// QObject helper as templated QObjects do not work. // QObject helper as templated QObjects do not work.
@ -62,7 +61,7 @@ class ObjectHelper : public QObject {
void Invoked(); void Invoked();
private: private:
boost::scoped_ptr<ClosureBase> closure_; std::unique_ptr<ClosureBase> closure_;
Q_DISABLE_COPY(ObjectHelper); Q_DISABLE_COPY(ObjectHelper);
}; };
@ -92,8 +91,8 @@ class Closure : public ClosureBase {
const char* slot, const char* slot,
const Args&... args) const Args&... args)
: ClosureBase(new ObjectHelper(sender, signal, this)), : ClosureBase(new ObjectHelper(sender, signal, this)),
// boost::bind is the easiest way to store an argument list. // std::bind is the easiest way to store an argument list.
function_(boost::bind(&Closure<Args...>::Call, this, args...)), function_(std::bind(&Closure<Args...>::Call, this, args...)),
receiver_(receiver) { receiver_(receiver) {
const QMetaObject* meta_receiver = receiver->metaObject(); const QMetaObject* meta_receiver = receiver->metaObject();
QByteArray normalised_slot = QMetaObject::normalizedSignature(slot + 1); QByteArray normalised_slot = QMetaObject::normalizedSignature(slot + 1);
@ -126,7 +125,7 @@ class Closure : public ClosureBase {
arg_list.size() > 9 ? arg_list[9] : QGenericArgument()); arg_list.size() > 9 ? arg_list[9] : QGenericArgument());
} }
boost::function<void()> function_; std::function<void()> function_;
QObject* receiver_; QObject* receiver_;
QMetaMethod slot_; QMetaMethod slot_;
}; };
@ -158,12 +157,12 @@ class CallbackClosure : public ClosureBase {
CallbackClosure( CallbackClosure(
QObject* sender, QObject* sender,
const char* signal, const char* signal,
boost::function<void()> callback); std::function<void()> callback);
virtual void Invoke(); virtual void Invoke();
private: private:
boost::function<void()> callback_; std::function<void()> callback_;
}; };
} // namespace _detail } // namespace _detail
@ -194,15 +193,15 @@ _detail::ClosureBase* NewClosure(
_detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure(
QObject* sender, QObject* sender,
const char* signal, const char* signal,
boost::function<void()> callback); std::function<void()> callback);
template <typename... Args> template <typename... Args>
_detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure(
QObject* sender, QObject* sender,
const char* signal, const char* signal,
boost::function<void(Args...)> callback, std::function<void(Args...)> callback,
const Args&... args) { const Args&... args) {
return NewClosure(sender, signal, boost::bind(callback, args...)); return NewClosure(sender, signal, std::bind(callback, args...));
} }
template <typename... Args> template <typename... Args>
@ -211,7 +210,7 @@ _detail::ClosureBase* NewClosure(
const char* signal, const char* signal,
void (*callback)(Args...), void (*callback)(Args...),
const Args&... args) { const Args&... args) {
return NewClosure(sender, signal, boost::bind(callback, args...)); return NewClosure(sender, signal, std::bind(callback, args...));
} }
template <typename T, typename Unused, typename... Args> template <typename T, typename Unused, typename... Args>
@ -220,7 +219,7 @@ _detail::ClosureBase* NewClosure(
const char* signal, const char* signal,
T* receiver, Unused (T::*callback)(Args...), T* receiver, Unused (T::*callback)(Args...),
const Args&... args) { const Args&... args) {
return NewClosure(sender, signal, boost::bind(callback, receiver, args...)); return NewClosure(sender, signal, std::bind(callback, receiver, args...));
} }

View File

@ -18,8 +18,7 @@
#ifndef CONCURRENTRUN_H #ifndef CONCURRENTRUN_H
#define CONCURRENTRUN_H #define CONCURRENTRUN_H
#include <boost/bind.hpp> #include <functional>
#include <boost/function.hpp>
#include <QFuture> #include <QFuture>
#include <QRunnable> #include <QRunnable>
@ -69,9 +68,9 @@ class ThreadFunctorBase : public QFutureInterface<ReturnType>, public QRunnable
template <typename ReturnType, typename... Args> template <typename ReturnType, typename... Args>
class ThreadFunctor : public ThreadFunctorBase<ReturnType> { class ThreadFunctor : public ThreadFunctorBase<ReturnType> {
public: public:
ThreadFunctor(boost::function<ReturnType (Args...)> function, ThreadFunctor(std::function<ReturnType (Args...)> function,
Args... args) Args... args)
: function_(boost::bind(function, args...)) { : function_(std::bind(function, args...)) {
} }
virtual void run() { virtual void run() {
@ -80,16 +79,16 @@ class ThreadFunctor : public ThreadFunctorBase<ReturnType> {
} }
private: private:
boost::function<ReturnType()> function_; std::function<ReturnType()> function_;
}; };
// Partial specialisation for void return type. // Partial specialisation for void return type.
template <typename... Args> template <typename... Args>
class ThreadFunctor <void, Args...> : public ThreadFunctorBase<void> { class ThreadFunctor <void, Args...> : public ThreadFunctorBase<void> {
public: public:
ThreadFunctor(boost::function<void (Args...)> function, ThreadFunctor(std::function<void (Args...)> function,
Args... args) Args... args)
: function_(boost::bind(function, args...)) { : function_(std::bind(function, args...)) {
} }
virtual void run() { virtual void run() {
@ -98,7 +97,7 @@ class ThreadFunctor <void, Args...> : public ThreadFunctorBase<void> {
} }
private: private:
boost::function<void()> function_; std::function<void()> function_;
}; };
@ -111,7 +110,7 @@ namespace ConcurrentRun {
template <typename ReturnType> template <typename ReturnType>
QFuture<ReturnType> Run( QFuture<ReturnType> Run(
QThreadPool* threadpool, QThreadPool* threadpool,
boost::function<ReturnType ()> function) { std::function<ReturnType ()> function) {
return (new ThreadFunctor<ReturnType>(function))->Start(threadpool); return (new ThreadFunctor<ReturnType>(function))->Start(threadpool);
} }
@ -119,7 +118,7 @@ namespace ConcurrentRun {
template <typename ReturnType, typename... Args> template <typename ReturnType, typename... Args>
QFuture<ReturnType> Run( QFuture<ReturnType> Run(
QThreadPool* threadpool, QThreadPool* threadpool,
boost::function<ReturnType (Args...)> function, std::function<ReturnType (Args...)> function,
const Args&... args) { const Args&... args) {
return (new ThreadFunctor<ReturnType, Args...>( return (new ThreadFunctor<ReturnType, Args...>(
function, args...))->Start(threadpool); function, args...))->Start(threadpool);
@ -132,7 +131,7 @@ namespace ConcurrentRun {
ReturnType (*function) (Args...), ReturnType (*function) (Args...),
const Args&... args) { const Args&... args) {
return Run( return Run(
threadpool, boost::function<ReturnType (Args...)>(function), args...); threadpool, std::function<ReturnType (Args...)>(function), args...);
} }
} }

View File

@ -17,10 +17,13 @@
#include "fmpsparser.h" #include "fmpsparser.h"
#include <functional>
#include <QStringList> #include <QStringList>
#include <QtDebug> #include <QtDebug>
#include <boost/bind.hpp> using std::placeholders::_1;
using std::placeholders::_2;
FMPSParser::FMPSParser() : FMPSParser::FMPSParser() :
// The float regex ends with (?:$|(?=::|;;)) to ensure it matches all the way // 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 // Parses an inner list - a list of values
int FMPSParser::ParseListRef(const QStringRef& data, QVariantList* ret) const { 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 // Parses an outer list - a list of lists
int FMPSParser::ParseListListRef(const QStringRef& data, Result* ret) const { 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 // Convenience functions that take QStrings instead of QStringRefs. Use the

View File

@ -17,6 +17,8 @@
#include "tagreader.h" #include "tagreader.h"
#include <memory>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDateTime> #include <QDateTime>
#include <QFileInfo> #include <QFileInfo>
@ -51,15 +53,11 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <boost/scoped_ptr.hpp>
#include "fmpsparser.h" #include "fmpsparser.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/messagehandler.h" #include "core/messagehandler.h"
#include "core/timeconstants.h" #include "core/timeconstants.h"
using boost::scoped_ptr;
// Taglib added support for FLAC pictures in 1.7.0 // Taglib added support for FLAC pictures in 1.7.0
#if (TAGLIB_MAJOR_VERSION > 1) || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 7) #if (TAGLIB_MAJOR_VERSION > 1) || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 7)
# define TAGLIB_HAS_FLAC_PICTURELIST # define TAGLIB_HAS_FLAC_PICTURELIST
@ -123,7 +121,7 @@ void TagReader::ReadFile(const QString& filename,
song->set_mtime(info.lastModified().toTime_t()); song->set_mtime(info.lastModified().toTime_t());
song->set_ctime(info.created().toTime_t()); song->set_ctime(info.created().toTime_t());
scoped_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename)); std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
if(fileref->isNull()) { if(fileref->isNull()) {
qLog(Info) << "TagLib hasn't been able to read " << filename << " file"; qLog(Info) << "TagLib hasn't been able to read " << filename << " file";
return; return;
@ -530,7 +528,7 @@ bool TagReader::SaveFile(const QString& filename,
qLog(Debug) << "Saving tags to" << filename; qLog(Debug) << "Saving tags to" << filename;
scoped_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename)); std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
if (!fileref || fileref->isNull()) // The file probably doesn't exist if (!fileref || fileref->isNull()) // The file probably doesn't exist
return false; return false;
@ -591,7 +589,7 @@ bool TagReader::SaveSongStatisticsToFile(const QString& filename,
qLog(Debug) << "Saving song statistics tags to" << filename; qLog(Debug) << "Saving song statistics tags to" << filename;
scoped_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename)); std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
if (!fileref || fileref->isNull()) // The file probably doesn't exist if (!fileref || fileref->isNull()) // The file probably doesn't exist
return false; return false;
@ -647,7 +645,7 @@ bool TagReader::SaveSongRatingToFile(const QString& filename,
qLog(Debug) << "Saving song rating tags to" << filename; qLog(Debug) << "Saving song rating tags to" << filename;
scoped_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename)); std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
if (!fileref || fileref->isNull()) // The file probably doesn't exist if (!fileref || fileref->isNull()) // The file probably doesn't exist
return false; return false;
@ -749,7 +747,7 @@ void TagReader::SetTextFrame(const char* id, const std::string& value,
bool TagReader::IsMediaFile(const QString& filename) const { bool TagReader::IsMediaFile(const QString& filename) const {
qLog(Debug) << "Checking for valid file" << filename; qLog(Debug) << "Checking for valid file" << filename;
scoped_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename)); std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
return !fileref->isNull() && fileref->tag(); return !fileref->isNull() && fileref->tag();
} }
@ -865,7 +863,7 @@ bool TagReader::ReadCloudFile(const QUrl& download_url,
CloudStream* stream = new CloudStream( CloudStream* stream = new CloudStream(
download_url, title, size, authorisation_header, network_); download_url, title, size, authorisation_header, network_);
stream->Precache(); stream->Precache();
scoped_ptr<TagLib::File> tag; std::unique_ptr<TagLib::File> tag;
if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) { if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) {
tag.reset(new TagLib::MPEG::File( tag.reset(new TagLib::MPEG::File(
stream, // Takes ownership. stream, // Takes ownership.

View File

@ -25,6 +25,7 @@ if (QT_VERSION_MINOR GREATER 5)
endif(QT_VERSION_MINOR GREATER 7) endif(QT_VERSION_MINOR GREATER 7)
endif(QT_VERSION_MINOR GREATER 5) endif(QT_VERSION_MINOR GREATER 5)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING) add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS)
include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR})
include_directories(${GLIB_INCLUDE_DIRS}) include_directories(${GLIB_INCLUDE_DIRS})

View File

@ -46,7 +46,6 @@
#cmakedefine TAGLIB_HAS_OPUS #cmakedefine TAGLIB_HAS_OPUS
#cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_INSTALL_PREFIX
#cmakedefine USE_SYSTEM_PROJECTM #cmakedefine USE_SYSTEM_PROJECTM
#cmakedefine USE_STD_UNORDERED_MAP
#cmakedefine HAVE_LAMBDAS #cmakedefine HAVE_LAMBDAS
#endif // CONFIG_H_IN #endif // CONFIG_H_IN

View File

@ -18,9 +18,9 @@
#ifndef CRASHREPORTING_H #ifndef CRASHREPORTING_H
#define CRASHREPORTING_H #define CRASHREPORTING_H
#include <QObject> #include <memory>
#include <boost/scoped_ptr.hpp> #include <QObject>
class QFile; class QFile;
class QNetworkAccessManager; class QNetworkAccessManager;
@ -64,7 +64,7 @@ private:
static const char* kSendCrashReportOption; static const char* kSendCrashReportOption;
static char* sPath; static char* sPath;
boost::scoped_ptr<google_breakpad::ExceptionHandler> handler_; std::unique_ptr<google_breakpad::ExceptionHandler> handler_;
}; };

View File

@ -16,18 +16,19 @@
*/ */
#include "deletefiles.h" #include "deletefiles.h"
#include "musicstorage.h"
#include "taskmanager.h"
#include <QStringList> #include <QStringList>
#include <QTimer> #include <QTimer>
#include <QThread> #include <QThread>
#include <QUrl> #include <QUrl>
#include "musicstorage.h"
#include "taskmanager.h"
const int DeleteFiles::kBatchSize = 50; const int DeleteFiles::kBatchSize = 50;
DeleteFiles::DeleteFiles(TaskManager* task_manager, DeleteFiles::DeleteFiles(TaskManager* task_manager,
boost::shared_ptr<MusicStorage> storage) std::shared_ptr<MusicStorage> storage)
: thread_(NULL), : thread_(NULL),
task_manager_(task_manager), task_manager_(task_manager),
storage_(storage), storage_(storage),

View File

@ -18,9 +18,9 @@
#ifndef DELETEFILES_H #ifndef DELETEFILES_H
#define DELETEFILES_H #define DELETEFILES_H
#include <QObject> #include <memory>
#include <boost/shared_ptr.hpp> #include <QObject>
#include "song.h" #include "song.h"
@ -31,7 +31,7 @@ class DeleteFiles : public QObject {
Q_OBJECT Q_OBJECT
public: public:
DeleteFiles(TaskManager* task_manager, boost::shared_ptr<MusicStorage> storage); DeleteFiles(TaskManager* task_manager, std::shared_ptr<MusicStorage> storage);
~DeleteFiles(); ~DeleteFiles();
static const int kBatchSize; static const int kBatchSize;
@ -49,7 +49,7 @@ private:
QThread* thread_; QThread* thread_;
QThread* original_thread_; QThread* original_thread_;
TaskManager* task_manager_; TaskManager* task_manager_;
boost::shared_ptr<MusicStorage> storage_; std::shared_ptr<MusicStorage> storage_;
SongList songs_; SongList songs_;

View File

@ -18,13 +18,13 @@
#ifndef MACGLOBALSHORTCUTBACKEND_H #ifndef MACGLOBALSHORTCUTBACKEND_H
#define MACGLOBALSHORTCUTBACKEND_H #define MACGLOBALSHORTCUTBACKEND_H
#include <memory>
#include "globalshortcutbackend.h" #include "globalshortcutbackend.h"
#include <QKeySequence> #include <QKeySequence>
#include <QMap> #include <QMap>
#include <boost/scoped_ptr.hpp>
class MacGlobalShortcutBackendPrivate; class MacGlobalShortcutBackendPrivate;
class QAction; class QAction;
@ -50,7 +50,7 @@ private:
QMap<QKeySequence, QAction*> shortcuts_; QMap<QKeySequence, QAction*> shortcuts_;
friend class MacGlobalShortcutBackendPrivate; friend class MacGlobalShortcutBackendPrivate;
boost::scoped_ptr<MacGlobalShortcutBackendPrivate> p_; std::unique_ptr<MacGlobalShortcutBackendPrivate> p_;
}; };
#endif // MACGLOBALSHORTCUTBACKEND_H #endif // MACGLOBALSHORTCUTBACKEND_H

View File

@ -20,6 +20,9 @@
#include <QAbstractProxyModel> #include <QAbstractProxyModel>
using std::placeholders::_1;
using std::placeholders::_2;
#include <boost/multi_index_container.hpp> #include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp> #include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/ordered_index.hpp>

View File

@ -24,8 +24,6 @@
#include <QObject> #include <QObject>
#include <QtDBus> #include <QtDBus>
#include <boost/scoped_ptr.hpp>
class Application; class Application;
class MainWindow; class MainWindow;
class Playlist; class Playlist;

View File

@ -20,10 +20,10 @@
#include "song.h" #include "song.h"
#include <QMetaType> #include <functional>
#include <memory>
#include <boost/function.hpp> #include <QMetaType>
#include <boost/shared_ptr.hpp>
class MusicStorage { class MusicStorage {
public: public:
@ -44,7 +44,7 @@ public:
Transcode_Unsupported = 3, Transcode_Unsupported = 3,
}; };
typedef boost::function<void (float progress)> ProgressFunction; typedef std::function<void (float progress)> ProgressFunction;
struct CopyJob { struct CopyJob {
QString source_; QString source_;
@ -77,6 +77,6 @@ public:
}; };
Q_DECLARE_METATYPE(MusicStorage*); Q_DECLARE_METATYPE(MusicStorage*);
Q_DECLARE_METATYPE(boost::shared_ptr<MusicStorage>); Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
#endif // MUSICSTORAGE_H #endif // MUSICSTORAGE_H

View File

@ -15,12 +15,9 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "musicstorage.h"
#include "organise.h" #include "organise.h"
#include "taskmanager.h"
#include "core/logging.h" #include <functional>
#include "core/tagreaderclient.h"
#include "core/utilities.h"
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@ -28,13 +25,19 @@
#include <QThread> #include <QThread>
#include <QUrl> #include <QUrl>
#include <boost/bind.hpp> #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::kBatchSize = 10;
const int Organise::kTranscodeProgressInterval = 500; const int Organise::kTranscodeProgressInterval = 500;
Organise::Organise(TaskManager* task_manager, Organise::Organise(TaskManager* task_manager,
boost::shared_ptr<MusicStorage> destination, std::shared_ptr<MusicStorage> destination,
const OrganiseFormat &format, bool copy, bool overwrite, const OrganiseFormat &format, bool copy, bool overwrite,
const NewSongInfoList& songs_info, bool eject_after) const NewSongInfoList& songs_info, bool eject_after)
: thread_(NULL), : thread_(NULL),
@ -177,8 +180,8 @@ void Organise::ProcessSomeFiles() {
job.metadata_ = song; job.metadata_ = song;
job.overwrite_ = overwrite_; job.overwrite_ = overwrite_;
job.remove_original_ = !copy_; job.remove_original_ = !copy_;
job.progress_ = boost::bind(&Organise::SetSongProgress, job.progress_ = std::bind(&Organise::SetSongProgress,
this, _1, !task.transcoded_filename_.isEmpty()); this, _1, !task.transcoded_filename_.isEmpty());
if (!destination_->CopyToStorage(job)) { if (!destination_->CopyToStorage(job)) {
files_with_errors_ << task.song_info_.song_.basefilename(); files_with_errors_ << task.song_info_.song_.basefilename();

View File

@ -18,12 +18,12 @@
#ifndef ORGANISE_H #ifndef ORGANISE_H
#define ORGANISE_H #define ORGANISE_H
#include <memory>
#include <QBasicTimer> #include <QBasicTimer>
#include <QObject> #include <QObject>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <boost/shared_ptr.hpp>
#include "organiseformat.h" #include "organiseformat.h"
#include "transcoder/transcoder.h" #include "transcoder/transcoder.h"
@ -44,7 +44,7 @@ public:
typedef QList<NewSongInfo> NewSongInfoList; typedef QList<NewSongInfo> NewSongInfoList;
Organise(TaskManager* task_manager, Organise(TaskManager* task_manager,
boost::shared_ptr<MusicStorage> destination, std::shared_ptr<MusicStorage> destination,
const OrganiseFormat& format, bool copy, bool overwrite, const OrganiseFormat& format, bool copy, bool overwrite,
const NewSongInfoList& songs, bool eject_after); const NewSongInfoList& songs, bool eject_after);
@ -85,7 +85,7 @@ private:
QThread* original_thread_; QThread* original_thread_;
TaskManager* task_manager_; TaskManager* task_manager_;
Transcoder* transcoder_; Transcoder* transcoder_;
boost::shared_ptr<MusicStorage> destination_; std::shared_ptr<MusicStorage> destination_;
QList<Song::FileType> supported_filetypes_; QList<Song::FileType> supported_filetypes_;
const OrganiseFormat format_; const OrganiseFormat format_;

View File

@ -15,8 +15,15 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include "player.h" #include "player.h"
#include <memory>
#include <QSortFilterProxyModel>
#include <QtDebug>
#include <QtConcurrentRun>
#include "config.h"
#include "core/application.h" #include "core/application.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/urlhandler.h" #include "core/urlhandler.h"
@ -31,13 +38,7 @@
# include "internet/lastfmservice.h" # include "internet/lastfmservice.h"
#endif #endif
#include <QSortFilterProxyModel> using std::shared_ptr;
#include <QtConcurrentRun>
#include <boost/bind.hpp>
using boost::shared_ptr;
Player::Player(Application* app, QObject* parent) Player::Player(Application* app, QObject* parent)
: PlayerInterface(parent), : PlayerInterface(parent),

View File

@ -18,11 +18,11 @@
#ifndef PLAYER_H #ifndef PLAYER_H
#define PLAYER_H #define PLAYER_H
#include <memory>
#include <QObject> #include <QObject>
#include <QSettings> #include <QSettings>
#include <boost/scoped_ptr.hpp>
#include "config.h" #include "config.h"
#include "core/song.h" #include "core/song.h"
#include "core/urlhandler.h" #include "core/urlhandler.h"
@ -176,7 +176,7 @@ public slots:
PlaylistItemPtr current_item_; PlaylistItemPtr current_item_;
boost::scoped_ptr<EngineBase> engine_; std::unique_ptr<EngineBase> engine_;
Engine::TrackChangeFlags stream_change_type_; Engine::TrackChangeFlags stream_change_type_;
Engine::State last_state_; Engine::State last_state_;
int nb_errors_received_; int nb_errors_received_;

View File

@ -17,7 +17,8 @@
#include "songloader.h" #include "songloader.h"
#include <boost/bind.hpp> #include <functional>
#include <memory>
#include <QBuffer> #include <QBuffer>
#include <QDirIterator> #include <QDirIterator>
@ -49,6 +50,7 @@
#include "podcasts/podcastservice.h" #include "podcasts/podcastservice.h"
#include "podcasts/podcasturlloader.h" #include "podcasts/podcasturlloader.h"
using std::placeholders::_1;
QSet<QString> SongLoader::sRawUriSchemes; QSet<QString> SongLoader::sRawUriSchemes;
const int SongLoader::kDefaultTimeout = 5000; const int SongLoader::kDefaultTimeout = 5000;
@ -234,7 +236,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
// inside right away. // inside right away.
if (QFileInfo(filename).isDir()) { if (QFileInfo(filename).isDir()) {
ConcurrentRun::Run<void>(&thread_pool_, ConcurrentRun::Run<void>(&thread_pool_,
boost::bind(&SongLoader::LoadLocalDirectoryAndEmit, this, filename)); std::bind(&SongLoader::LoadLocalDirectoryAndEmit, this, filename));
return WillLoadAsync; return WillLoadAsync;
} }
@ -257,7 +259,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
// It's a playlist! // It's a playlist!
ConcurrentRun::Run<void>(&thread_pool_, ConcurrentRun::Run<void>(&thread_pool_,
boost::bind(&SongLoader::LoadPlaylistAndEmit, this, parser, filename)); std::bind(&SongLoader::LoadPlaylistAndEmit, this, parser, filename));
return WillLoadAsync; return WillLoadAsync;
} }
@ -460,8 +462,8 @@ SongLoader::Result SongLoader::LoadRemote() {
// rest of the file, parse the playlist and return success. // rest of the file, parse the playlist and return success.
// Create the pipeline - it gets unreffed if it goes out of scope // Create the pipeline - it gets unreffed if it goes out of scope
boost::shared_ptr<GstElement> pipeline( std::shared_ptr<GstElement> pipeline(
gst_pipeline_new(NULL), boost::bind(&gst_object_unref, _1)); gst_pipeline_new(NULL), std::bind(&gst_object_unref, _1));
// Create the source element automatically based on the URL // Create the source element automatically based on the URL
GstElement* source = gst_element_make_from_uri( GstElement* source = gst_element_make_from_uri(

View File

@ -18,6 +18,10 @@
#ifndef SONGLOADER_H #ifndef SONGLOADER_H
#define SONGLOADER_H #define SONGLOADER_H
#include <memory>
#include <gst/gst.h>
#include <QObject> #include <QObject>
#include <QThreadPool> #include <QThreadPool>
#include <QUrl> #include <QUrl>
@ -26,10 +30,6 @@
#include "core/tagreaderclient.h" #include "core/tagreaderclient.h"
#include "musicbrainz/musicbrainzclient.h" #include "musicbrainz/musicbrainzclient.h"
#include <boost/shared_ptr.hpp>
#include <gst/gst.h>
class CueParser; class CueParser;
class LibraryBackendInterface; class LibraryBackendInterface;
class ParserBase; class ParserBase;
@ -134,7 +134,7 @@ private:
LibraryBackendInterface* library_; LibraryBackendInterface* library_;
const Player* player_; const Player* player_;
boost::shared_ptr<GstElement> pipeline_; std::shared_ptr<GstElement> pipeline_;
QThreadPool thread_pool_; QThreadPool thread_pool_;
}; };

View File

@ -19,7 +19,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <boost/scoped_array.hpp> #include <memory>
#include <QApplication> #include <QApplication>
#include <QDateTime> #include <QDateTime>
@ -267,7 +267,7 @@ bool Copy(QIODevice* source, QIODevice* destination) {
return false; return false;
const qint64 bytes = source->size(); const qint64 bytes = source->size();
boost::scoped_array<char> data(new char[bytes]); std::unique_ptr<char[]> data(new char[bytes]);
qint64 pos = 0; qint64 pos = 0;
qint64 bytes_read; qint64 bytes_read;

View File

@ -18,6 +18,8 @@
#ifndef UTILITIES_H #ifndef UTILITIES_H
#define UTILITIES_H #define UTILITIES_H
#include <memory>
#include <QColor> #include <QColor>
#include <QFile> #include <QFile>
#include <QLocale> #include <QLocale>
@ -26,8 +28,6 @@
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <boost/scoped_array.hpp>
class QIODevice; class QIODevice;
class QMouseEvent; class QMouseEvent;
class QXmlStreamReader; class QXmlStreamReader;
@ -171,7 +171,7 @@ private:
Q_DISABLE_COPY(ScopedWCharArray); Q_DISABLE_COPY(ScopedWCharArray);
int chars_; int chars_;
boost::scoped_array<wchar_t> data_; std::unique_ptr<wchar_t[]> data_;
}; };
#endif // UTILITIES_H #endif // UTILITIES_H

View File

@ -29,8 +29,6 @@
#include <QQueue> #include <QQueue>
#include <QUrl> #include <QUrl>
#include <boost/scoped_ptr.hpp>
class QNetworkReply; class QNetworkReply;
class QString; class QString;

View File

@ -18,12 +18,12 @@
#ifndef CURRENTARTLOADER_H #ifndef CURRENTARTLOADER_H
#define CURRENTARTLOADER_H #define CURRENTARTLOADER_H
#include "core/song.h" #include <memory>
#include "covers/albumcoverloaderoptions.h"
#include <QObject> #include <QObject>
#include <boost/scoped_ptr.hpp> #include "core/song.h"
#include "covers/albumcoverloaderoptions.h"
class Application; class Application;
@ -56,8 +56,8 @@ private:
QString temp_file_pattern_; QString temp_file_pattern_;
boost::scoped_ptr<QTemporaryFile> temp_art_; std::unique_ptr<QTemporaryFile> temp_art_;
boost::scoped_ptr<QTemporaryFile> temp_art_thumbnail_; std::unique_ptr<QTemporaryFile> temp_art_thumbnail_;
quint64 id_; quint64 id_;
Song last_song_; Song last_song_;

View File

@ -18,14 +18,14 @@
#ifndef CONNECTEDDEVICE_H #ifndef CONNECTEDDEVICE_H
#define CONNECTEDDEVICE_H #define CONNECTEDDEVICE_H
#include "core/musicstorage.h" #include <memory>
#include "core/song.h"
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
#include <QUrl> #include <QUrl>
#include <boost/enable_shared_from_this.hpp> #include "core/musicstorage.h"
#include "core/song.h"
class Application; class Application;
class Database; class Database;
@ -35,7 +35,7 @@ class LibraryBackend;
class LibraryModel; class LibraryModel;
class ConnectedDevice : public QObject, public virtual MusicStorage, class ConnectedDevice : public QObject, public virtual MusicStorage,
public boost::enable_shared_from_this<ConnectedDevice> { public std::enable_shared_from_this<ConnectedDevice> {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -18,12 +18,12 @@
#ifndef DEVICEKITLISTER_H #ifndef DEVICEKITLISTER_H
#define DEVICEKITLISTER_H #define DEVICEKITLISTER_H
#include "devicelister.h" #include <memory>
#include <QMutex> #include <QMutex>
#include <QStringList> #include <QStringList>
#include <boost/scoped_ptr.hpp> #include "devicelister.h"
class OrgFreedesktopUDisksInterface; class OrgFreedesktopUDisksInterface;
@ -88,7 +88,7 @@ private:
T LockAndGetDeviceInfo(const QString& id, T DeviceData::*field); T LockAndGetDeviceInfo(const QString& id, T DeviceData::*field);
private: private:
boost::scoped_ptr<OrgFreedesktopUDisksInterface> interface_; std::unique_ptr<OrgFreedesktopUDisksInterface> interface_;
QMutex mutex_; QMutex mutex_;
QMap<QString, DeviceData> device_data_; QMap<QString, DeviceData> device_data_;

View File

@ -21,8 +21,6 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QUrl> #include <QUrl>
#include <boost/shared_ptr.hpp>
class ConnectedDevice; class ConnectedDevice;
class DeviceManager; class DeviceManager;

View File

@ -17,7 +17,7 @@
#include "devicemanager.h" #include "devicemanager.h"
#include <boost/bind.hpp> #include <memory>
#include <QApplication> #include <QApplication>
#include <QDir> #include <QDir>
@ -60,7 +60,7 @@
# include "mtpdevice.h" # include "mtpdevice.h"
#endif #endif
using boost::bind; using std::bind;
const int DeviceManager::kDeviceIconSize = 32; const int DeviceManager::kDeviceIconSize = 32;
const int DeviceManager::kDeviceIconOverlaySize = 16; const int DeviceManager::kDeviceIconOverlaySize = 16;
@ -311,7 +311,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const {
const_cast<DeviceManager*>(this)->Connect(index.row()); const_cast<DeviceManager*>(this)->Connect(index.row());
if (!info.device_) if (!info.device_)
return QVariant(); return QVariant();
return QVariant::fromValue<boost::shared_ptr<MusicStorage> >(info.device_); return QVariant::fromValue<std::shared_ptr<MusicStorage>>(info.device_);
case MusicStorage::Role_StorageForceConnect: case MusicStorage::Role_StorageForceConnect:
if (!info.device_) { if (!info.device_) {
@ -319,7 +319,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const {
!info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) { !info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) {
if (info.BestBackend()->lister_->AskForScan(info.BestBackend()->unique_id_)) { if (info.BestBackend()->lister_->AskForScan(info.BestBackend()->unique_id_)) {
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox( std::unique_ptr<QMessageBox> dialog(new QMessageBox(
QMessageBox::Information, tr("Connect device"), 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."), 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)); QMessageBox::Cancel));
@ -336,7 +336,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const {
} }
if (!info.device_) if (!info.device_)
return QVariant(); return QVariant();
return QVariant::fromValue<boost::shared_ptr<MusicStorage> >(info.device_); return QVariant::fromValue<std::shared_ptr<MusicStorage>>(info.device_);
case Role_MountPath: { case Role_MountPath: {
if (!info.device_) if (!info.device_)
@ -520,12 +520,12 @@ void DeviceManager::PhysicalDeviceChanged(const QString &id) {
// TODO // TODO
} }
boost::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) { std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
DeviceInfo& info = devices_[row]; DeviceInfo& info = devices_[row];
if (info.device_) // Already connected if (info.device_) // Already connected
return info.device_; return info.device_;
boost::shared_ptr<ConnectedDevice> ret; std::shared_ptr<ConnectedDevice> ret;
if (!info.BestBackend()->lister_) // Not physically connected if (!info.BestBackend()->lister_) // Not physically connected
return ret; return ret;
@ -612,7 +612,7 @@ boost::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
return ret; return ret;
} }
boost::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(int row) const { std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(int row) const {
return devices_[row].device_; return devices_[row].device_;
} }

View File

@ -19,13 +19,14 @@
#define DEVICEMANAGER_H #define DEVICEMANAGER_H
#include "devicedatabasebackend.h" #include "devicedatabasebackend.h"
#include "library/librarymodel.h"
#include <memory>
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QIcon> #include <QIcon>
#include <QThreadPool> #include <QThreadPool>
#include <boost/shared_ptr.hpp> #include "library/librarymodel.h"
class Application; class Application;
class ConnectedDevice; class ConnectedDevice;
@ -72,13 +73,13 @@ public:
// Get info about devices // Get info about devices
int GetDatabaseId(int row) const; int GetDatabaseId(int row) const;
DeviceLister* GetLister(int row) const; DeviceLister* GetLister(int row) const;
boost::shared_ptr<ConnectedDevice> GetConnectedDevice(int row) const; std::shared_ptr<ConnectedDevice> GetConnectedDevice(int row) const;
int FindDeviceById(const QString& id) const; int FindDeviceById(const QString& id) const;
int FindDeviceByUrl(const QList<QUrl>& url) const; int FindDeviceByUrl(const QList<QUrl>& url) const;
// Actions on devices // Actions on devices
boost::shared_ptr<ConnectedDevice> Connect(int row); std::shared_ptr<ConnectedDevice> Connect(int row);
void Disconnect(int row); void Disconnect(int row);
void Forget(int row); void Forget(int row);
void UnmountAsync(int row); void UnmountAsync(int row);
@ -143,7 +144,7 @@ private:
int database_id_; // -1 if not remembered in the database int database_id_; // -1 if not remembered in the database
boost::shared_ptr<ConnectedDevice> device_; // NULL if not connected to clementine std::shared_ptr<ConnectedDevice> device_; // NULL if not connected to clementine
QList<Backend> backends_; QList<Backend> backends_;
QString friendly_name_; QString friendly_name_;

View File

@ -15,20 +15,22 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "connecteddevice.h"
#include "devicelister.h"
#include "devicemanager.h"
#include "deviceproperties.h" #include "deviceproperties.h"
#include "ui_deviceproperties.h"
#include "core/utilities.h" #include <functional>
#include "transcoder/transcoder.h" #include <memory>
#include "ui/iconloader.h"
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QScrollBar> #include <QScrollBar>
#include <QtConcurrentRun> #include <QtConcurrentRun>
#include <boost/bind.hpp> #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) DeviceProperties::DeviceProperties(QWidget *parent)
: QDialog(parent), : QDialog(parent),
@ -178,7 +180,7 @@ void DeviceProperties::UpdateHardwareInfo() {
void DeviceProperties::UpdateFormats() { void DeviceProperties::UpdateFormats() {
QString id = index_.data(DeviceManager::Role_UniqueId).toString(); QString id = index_.data(DeviceManager::Role_UniqueId).toString();
DeviceLister* lister = manager_->GetLister(index_.row()); DeviceLister* lister = manager_->GetLister(index_.row());
boost::shared_ptr<ConnectedDevice> device = std::shared_ptr<ConnectedDevice> device =
manager_->GetConnectedDevice(index_.row()); manager_->GetConnectedDevice(index_.row());
// Transcode mode // Transcode mode
@ -219,7 +221,7 @@ void DeviceProperties::UpdateFormats() {
// blocks, so do it in the background. // blocks, so do it in the background.
supported_formats_.clear(); supported_formats_.clear();
QFuture<bool> future = QtConcurrent::run(boost::bind( QFuture<bool> future = QtConcurrent::run(std::bind(
&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_)); &ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_));
QFutureWatcher<bool>* watcher = new QFutureWatcher<bool>(this); QFutureWatcher<bool>* watcher = new QFutureWatcher<bool>(this);
watcher->setFuture(future); watcher->setFuture(future);

View File

@ -15,11 +15,22 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "deviceview.h"
#include <memory>
#include <QApplication>
#include <QContextMenuEvent>
#include <QMenu>
#include <QMessageBox>
#include <QPainter>
#include <QPushButton>
#include <QSortFilterProxyModel>
#include "connecteddevice.h" #include "connecteddevice.h"
#include "devicelister.h" #include "devicelister.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "deviceproperties.h" #include "deviceproperties.h"
#include "deviceview.h"
#include "core/application.h" #include "core/application.h"
#include "core/deletefiles.h" #include "core/deletefiles.h"
#include "core/mergedproxymodel.h" #include "core/mergedproxymodel.h"
@ -31,16 +42,6 @@
#include "ui/organisedialog.h" #include "ui/organisedialog.h"
#include "ui/organiseerrordialog.h" #include "ui/organiseerrordialog.h"
#include <QApplication>
#include <QContextMenuEvent>
#include <QMenu>
#include <QMessageBox>
#include <QPainter>
#include <QPushButton>
#include <QSortFilterProxyModel>
#include <boost/shared_ptr.hpp>
const int DeviceItemDelegate::kIconPadding = 6; const int DeviceItemDelegate::kIconPadding = 6;
DeviceItemDelegate::DeviceItemDelegate(QObject *parent) DeviceItemDelegate::DeviceItemDelegate(QObject *parent)
@ -238,7 +239,8 @@ void DeviceView::contextMenuEvent(QContextMenuEvent* e) {
bool is_filesystem_device = false; bool is_filesystem_device = false;
if (parent_device_index.isValid()) { if (parent_device_index.isValid()) {
boost::shared_ptr<ConnectedDevice> device = app_->device_manager()->GetConnectedDevice(parent_device_index.row()); std::shared_ptr<ConnectedDevice> device =
app_->device_manager()->GetConnectedDevice(parent_device_index.row());
if (device && !device->LocalPath().isEmpty()) if (device && !device->LocalPath().isEmpty())
is_filesystem_device = true; is_filesystem_device = true;
} }
@ -281,7 +283,8 @@ void DeviceView::Connect() {
} }
void DeviceView::DeviceConnected(int row) { void DeviceView::DeviceConnected(int row) {
boost::shared_ptr<ConnectedDevice> device = app_->device_manager()->GetConnectedDevice(row); std::shared_ptr<ConnectedDevice> device =
app_->device_manager()->GetConnectedDevice(row);
if (!device) if (!device)
return; return;
@ -306,7 +309,7 @@ void DeviceView::Forget() {
QString unique_id = app_->device_manager()->data(device_idx, DeviceManager::Role_UniqueId).toString(); QString unique_id = app_->device_manager()->data(device_idx, DeviceManager::Role_UniqueId).toString();
if (app_->device_manager()->GetLister(device_idx.row()) && if (app_->device_manager()->GetLister(device_idx.row()) &&
app_->device_manager()->GetLister(device_idx.row())->AskForScan(unique_id)) { app_->device_manager()->GetLister(device_idx.row())->AskForScan(unique_id)) {
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox( std::unique_ptr<QMessageBox> dialog(new QMessageBox(
QMessageBox::Question, tr("Forget device"), 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."), 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)); QMessageBox::Cancel, this));
@ -390,8 +393,8 @@ void DeviceView::Delete() {
QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
return; return;
boost::shared_ptr<MusicStorage> storage = std::shared_ptr<MusicStorage> storage =
device_index.data(MusicStorage::Role_Storage).value<boost::shared_ptr<MusicStorage> >(); device_index.data(MusicStorage::Role_Storage).value<std::shared_ptr<MusicStorage>>();
DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage);
connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList)));

View File

@ -18,6 +18,8 @@
#ifndef DEVICEVIEW_H #ifndef DEVICEVIEW_H
#define DEVICEVIEW_H #define DEVICEVIEW_H
#include <memory>
#include "core/song.h" #include "core/song.h"
#include "library/libraryview.h" #include "library/libraryview.h"
#include "widgets/autoexpandingtreeview.h" #include "widgets/autoexpandingtreeview.h"
@ -88,8 +90,8 @@ private:
MergedProxyModel* merged_model_; MergedProxyModel* merged_model_;
QSortFilterProxyModel* sort_model_; QSortFilterProxyModel* sort_model_;
boost::scoped_ptr<DeviceProperties> properties_dialog_; std::unique_ptr<DeviceProperties> properties_dialog_;
boost::scoped_ptr<OrganiseDialog> organise_dialog_; std::unique_ptr<OrganiseDialog> organise_dialog_;
QMenu* device_menu_; QMenu* device_menu_;
QAction* eject_action_; QAction* eject_action_;

View File

@ -17,16 +17,20 @@
#include "config.h" #include "config.h"
#include <memory>
#include <QFile> #include <QFile>
#include <QStringList> #include <QStringList>
#include <QtDebug> #include <QtDebug>
#include <boost/bind.hpp>
#include "giolister.h" #include "giolister.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/signalchecker.h" #include "core/signalchecker.h"
using std::placeholders::_1;
using std::placeholders::_2;
using std::placeholders::_3;
QString GioLister::DeviceInfo::unique_id() const { QString GioLister::DeviceInfo::unique_id() const {
if (mount) if (mount)
return QString("Gio/%1/%2/%3").arg(mount_uuid, filesystem_type).arg(filesystem_size); 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) { void GioLister::VolumeMountFinished(GObject* object, GAsyncResult* result, gpointer) {
OperationFinished<GVolume>(boost::bind( OperationFinished<GVolume>(std::bind(
g_volume_mount_finish, _1, _2, _3), object, result); 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) { void GioLister::VolumeEjectFinished(GObject *object, GAsyncResult *result, gpointer) {
OperationFinished<GVolume>(boost::bind( OperationFinished<GVolume>(std::bind(
g_volume_eject_with_operation_finish, _1, _2, _3), object, result); g_volume_eject_with_operation_finish, _1, _2, _3), object, result);
} }
void GioLister::MountEjectFinished(GObject *object, GAsyncResult *result, gpointer) { void GioLister::MountEjectFinished(GObject *object, GAsyncResult *result, gpointer) {
OperationFinished<GMount>(boost::bind( OperationFinished<GMount>(std::bind(
g_mount_eject_with_operation_finish, _1, _2, _3), object, result); g_mount_eject_with_operation_finish, _1, _2, _3), object, result);
} }
void GioLister::MountUnmountFinished(GObject *object, GAsyncResult *result, gpointer) { void GioLister::MountUnmountFinished(GObject *object, GAsyncResult *result, gpointer) {
OperationFinished<GMount>(boost::bind( OperationFinished<GMount>(std::bind(
g_mount_unmount_with_operation_finish, _1, _2, _3), object, result); g_mount_unmount_with_operation_finish, _1, _2, _3), object, result);
} }

View File

@ -27,8 +27,9 @@
#include <QDir> #include <QDir>
#include <QtDebug> #include <QtDebug>
GPodLoader::GPodLoader(const QString& mount_point, TaskManager* task_manager, GPodLoader::GPodLoader(
LibraryBackend* backend, boost::shared_ptr<ConnectedDevice> device) const QString& mount_point, TaskManager* task_manager,
LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device)
: QObject(NULL), : QObject(NULL),
device_(device), device_(device),
mount_point_(mount_point), mount_point_(mount_point),

View File

@ -18,9 +18,10 @@
#ifndef GPODLOADER_H #ifndef GPODLOADER_H
#define GPODLOADER_H #define GPODLOADER_H
#include <memory>
#include <QObject> #include <QObject>
#include <boost/shared_ptr.hpp>
#include <gpod/itdb.h> #include <gpod/itdb.h>
#include "core/song.h" #include "core/song.h"
@ -34,7 +35,7 @@ class GPodLoader : public QObject {
public: public:
GPodLoader(const QString& mount_point, TaskManager* task_manager, GPodLoader(const QString& mount_point, TaskManager* task_manager,
LibraryBackend* backend, boost::shared_ptr<ConnectedDevice> device); LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device);
~GPodLoader(); ~GPodLoader();
void set_music_path_prefix(const QString& prefix) { path_prefix_ = prefix; } void set_music_path_prefix(const QString& prefix) { path_prefix_ = prefix; }
@ -49,7 +50,7 @@ signals:
void LoadFinished(Itdb_iTunesDB* db); void LoadFinished(Itdb_iTunesDB* db);
private: private:
boost::shared_ptr<ConnectedDevice> device_; std::shared_ptr<ConnectedDevice> device_;
QThread* original_thread_; QThread* original_thread_;
QString mount_point_; QString mount_point_;

View File

@ -18,12 +18,12 @@
#ifndef MTPDEVICE_H #ifndef MTPDEVICE_H
#define MTPDEVICE_H #define MTPDEVICE_H
#include "connecteddevice.h" #include <memory>
#include <QMutex> #include <QMutex>
#include <QWaitCondition> #include <QWaitCondition>
#include <boost/scoped_ptr.hpp> #include "connecteddevice.h"
struct LIBMTP_mtpdevice_struct; struct LIBMTP_mtpdevice_struct;
@ -74,7 +74,7 @@ private:
SongList songs_to_add_; SongList songs_to_add_;
SongList songs_to_remove_; SongList songs_to_remove_;
boost::scoped_ptr<MtpConnection> connection_; std::unique_ptr<MtpConnection> connection_;
}; };
#endif // MTPDEVICE_H #endif // MTPDEVICE_H

View File

@ -15,17 +15,19 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "mtploader.h"
#include <libmtp.h>
#include "connecteddevice.h" #include "connecteddevice.h"
#include "mtpconnection.h" #include "mtpconnection.h"
#include "mtploader.h"
#include "core/song.h" #include "core/song.h"
#include "core/taskmanager.h" #include "core/taskmanager.h"
#include "library/librarybackend.h" #include "library/librarybackend.h"
#include <libmtp.h> MtpLoader::MtpLoader(
const QUrl& url, TaskManager* task_manager,
MtpLoader::MtpLoader(const QUrl& url, TaskManager* task_manager, LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device)
LibraryBackend* backend, boost::shared_ptr<ConnectedDevice> device)
: QObject(NULL), : QObject(NULL),
device_(device), device_(device),
url_(url), url_(url),

View File

@ -18,11 +18,11 @@
#ifndef MTPLOADER_H #ifndef MTPLOADER_H
#define MTPLOADER_H #define MTPLOADER_H
#include <memory>
#include <QObject> #include <QObject>
#include <QUrl> #include <QUrl>
#include <boost/shared_ptr.hpp>
class ConnectedDevice; class ConnectedDevice;
class LibraryBackend; class LibraryBackend;
class TaskManager; class TaskManager;
@ -32,7 +32,7 @@ class MtpLoader : public QObject {
public: public:
MtpLoader(const QUrl& url, TaskManager* task_manager, MtpLoader(const QUrl& url, TaskManager* task_manager,
LibraryBackend* backend, boost::shared_ptr<ConnectedDevice> device); LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device);
~MtpLoader(); ~MtpLoader();
public slots: public slots:
@ -47,7 +47,7 @@ private:
bool TryLoad(); bool TryLoad();
private: private:
boost::shared_ptr<ConnectedDevice> device_; std::shared_ptr<ConnectedDevice> device_;
QThread* original_thread_; QThread* original_thread_;
QUrl url_; QUrl url_;

View File

@ -27,8 +27,6 @@
#include <vector> #include <vector>
#include <boost/noncopyable.hpp>
#include <QList> #include <QList>
#include <QObject> #include <QObject>
#include <QUrl> #include <QUrl>
@ -39,7 +37,7 @@ namespace Engine {
typedef std::vector<int16_t> Scope; typedef std::vector<int16_t> Scope;
class Base : public QObject, boost::noncopyable { class Base : public QObject {
Q_OBJECT Q_OBJECT
public: public:
@ -153,6 +151,7 @@ class Base : public QObject, boost::noncopyable {
private: private:
bool about_to_end_emitted_; bool about_to_end_emitted_;
Q_DISABLE_COPY(Base);
}; };

View File

@ -19,23 +19,14 @@
* 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307, USA. * * 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "config.h"
#include "gstengine.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 <math.h> #include <math.h>
#include <unistd.h> #include <unistd.h>
#include <vector>
#include <iostream>
#include <boost/bind.hpp> #include <iostream>
#include <memory>
#include <vector>
#include <QTimer> #include <QTimer>
#include <QRegExp> #include <QRegExp>
@ -48,9 +39,18 @@
#include <gst/gst.h> #include <gst/gst.h>
#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 std::vector;
using boost::shared_ptr;
const char* GstEngine::kSettingsGroup = "GstEngine"; const char* GstEngine::kSettingsGroup = "GstEngine";
const char* GstEngine::kAutoSink = "autoaudiosink"; const char* GstEngine::kAutoSink = "autoaudiosink";

View File

@ -22,6 +22,8 @@
#ifndef AMAROK_GSTENGINE_H #ifndef AMAROK_GSTENGINE_H
#define AMAROK_GSTENGINE_H #define AMAROK_GSTENGINE_H
#include <memory>
#include "bufferconsumer.h" #include "bufferconsumer.h"
#include "enginebase.h" #include "enginebase.h"
#include "core/boundfuturewatcher.h" #include "core/boundfuturewatcher.h"
@ -35,7 +37,6 @@
#include <QTimerEvent> #include <QTimerEvent>
#include <gst/gst.h> #include <gst/gst.h>
#include <boost/shared_ptr.hpp>
class QTimer; class QTimer;
class QTimerEvent; class QTimerEvent;
@ -146,12 +147,13 @@ class GstEngine : public Engine::Base, public BufferConsumer {
void StartTimers(); void StartTimers();
void StopTimers(); void StopTimers();
boost::shared_ptr<GstEnginePipeline> CreatePipeline(); std::shared_ptr<GstEnginePipeline> CreatePipeline();
boost::shared_ptr<GstEnginePipeline> CreatePipeline(const QUrl& url, qint64 end_nanosec); std::shared_ptr<GstEnginePipeline> CreatePipeline(
const QUrl& url, qint64 end_nanosec);
void UpdateScope(); void UpdateScope();
int AddBackgroundStream(boost::shared_ptr<GstEnginePipeline> pipeline); int AddBackgroundStream(std::shared_ptr<GstEnginePipeline> pipeline);
static QUrl FixupUrl(const QUrl& url); static QUrl FixupUrl(const QUrl& url);
@ -171,9 +173,9 @@ class GstEngine : public Engine::Base, public BufferConsumer {
QString sink_; QString sink_;
QString device_; QString device_;
boost::shared_ptr<GstEnginePipeline> current_pipeline_; std::shared_ptr<GstEnginePipeline> current_pipeline_;
boost::shared_ptr<GstEnginePipeline> fadeout_pipeline_; std::shared_ptr<GstEnginePipeline> fadeout_pipeline_;
boost::shared_ptr<GstEnginePipeline> fadeout_pause_pipeline_; std::shared_ptr<GstEnginePipeline> fadeout_pause_pipeline_;
QUrl preloaded_url_; QUrl preloaded_url_;
QList<BufferConsumer*> buffer_consumers_; QList<BufferConsumer*> buffer_consumers_;
@ -205,7 +207,7 @@ class GstEngine : public Engine::Base, public BufferConsumer {
int timer_id_; int timer_id_;
int next_element_id_; int next_element_id_;
QHash<int, boost::shared_ptr<GstEnginePipeline> > background_streams_; QHash<int, std::shared_ptr<GstEnginePipeline> > background_streams_;
bool is_fading_out_to_pause_; bool is_fading_out_to_pause_;
bool has_faded_out_; bool has_faded_out_;

View File

@ -41,11 +41,11 @@ const int GstEnginePipeline::kEqBandFrequencies[] = {
60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000}; 60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000};
int GstEnginePipeline::sId = 1; int GstEnginePipeline::sId = 1;
GstElementDeleter* GstEnginePipeline::sElementDeleter = NULL; GstElementDeleter* GstEnginePipeline::sElementDeleter = nullptr;
GstEnginePipeline::GstEnginePipeline(GstEngine* engine) GstEnginePipeline::GstEnginePipeline(GstEngine* engine)
: QObject(NULL), : QObject(nullptr),
engine_(engine), engine_(engine),
id_(sId++), id_(sId++),
valid_(false), valid_(false),
@ -75,20 +75,19 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine)
pending_seek_nanosec_(-1), pending_seek_nanosec_(-1),
volume_percent_(100), volume_percent_(100),
volume_modifier_(1.0), volume_modifier_(1.0),
fader_(NULL), pipeline_(nullptr),
pipeline_(NULL), uridecodebin_(nullptr),
uridecodebin_(NULL), audiobin_(nullptr),
audiobin_(NULL), queue_(nullptr),
queue_(NULL), audioconvert_(nullptr),
audioconvert_(NULL), rgvolume_(nullptr),
rgvolume_(NULL), rglimiter_(nullptr),
rglimiter_(NULL), audioconvert2_(nullptr),
audioconvert2_(NULL), equalizer_(nullptr),
equalizer_(NULL), stereo_panorama_(nullptr),
stereo_panorama_(NULL), volume_(nullptr),
volume_(NULL), audioscale_(nullptr),
audioscale_(NULL), audiosink_(nullptr)
audiosink_(NULL)
{ {
if (!sElementDeleter) { if (!sElementDeleter) {
sElementDeleter = new GstElementDeleter; sElementDeleter = new GstElementDeleter;

View File

@ -18,6 +18,8 @@
#ifndef GSTENGINEPIPELINE_H #ifndef GSTENGINEPIPELINE_H
#define GSTENGINEPIPELINE_H #define GSTENGINEPIPELINE_H
#include <memory>
#include <QBasicTimer> #include <QBasicTimer>
#include <QFuture> #include <QFuture>
#include <QMutex> #include <QMutex>
@ -27,7 +29,6 @@
#include <QUrl> #include <QUrl>
#include <gst/gst.h> #include <gst/gst.h>
#include <boost/scoped_ptr.hpp>
#include "engine_fwd.h" #include "engine_fwd.h"
@ -253,7 +254,7 @@ class GstEnginePipeline : public QObject {
int volume_percent_; int volume_percent_;
qreal volume_modifier_; qreal volume_modifier_;
boost::scoped_ptr<QTimeLine> fader_; std::unique_ptr<QTimeLine> fader_;
QBasicTimer fader_fudge_timer_; QBasicTimer fader_fudge_timer_;
bool use_fudge_timer_; bool use_fudge_timer_;

View File

@ -1,25 +1,33 @@
/* This file is part of Clementine. /* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com> Copyright 2012, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Clementine is distributed in the hope that it will be useful, Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "globalsearchview.h"
#include <QMenu>
#include <QSortFilterProxyModel>
#include <QStandardItem>
#include <QTimer>
#include <functional>
#include "globalsearch.h" #include "globalsearch.h"
#include "globalsearchitemdelegate.h" #include "globalsearchitemdelegate.h"
#include "globalsearchmodel.h" #include "globalsearchmodel.h"
#include "globalsearchsortmodel.h" #include "globalsearchsortmodel.h"
#include "globalsearchview.h"
#include "searchprovider.h" #include "searchprovider.h"
#include "searchproviderstatuswidget.h" #include "searchproviderstatuswidget.h"
#include "suggestionwidget.h" #include "suggestionwidget.h"
@ -32,12 +40,8 @@
#include "library/librarymodel.h" #include "library/librarymodel.h"
#include "library/groupbydialog.h" #include "library/groupbydialog.h"
#include <boost/bind.hpp> using std::placeholders::_1;
using std::placeholders::_2;
#include <QMenu>
#include <QSortFilterProxyModel>
#include <QStandardItem>
#include <QTimer>
const int GlobalSearchView::kSwapModelsTimeoutMsec = 250; const int GlobalSearchView::kSwapModelsTimeoutMsec = 250;
const int GlobalSearchView::kMaxSuggestions = 10; const int GlobalSearchView::kMaxSuggestions = 10;
@ -176,14 +180,14 @@ namespace {
void GlobalSearchView::ReloadSettings() { void GlobalSearchView::ReloadSettings() {
QSettings s; QSettings s;
// Library settings // Library settings
s.beginGroup(LibraryView::kSettingsGroup); s.beginGroup(LibraryView::kSettingsGroup);
const bool pretty = s.value("pretty_covers", true).toBool(); const bool pretty = s.value("pretty_covers", true).toBool();
front_model_->set_use_pretty_covers(pretty); front_model_->set_use_pretty_covers(pretty);
back_model_->set_use_pretty_covers(pretty); back_model_->set_use_pretty_covers(pretty);
s.endGroup(); s.endGroup();
// Global search settings // Global search settings
s.beginGroup(GlobalSearch::kSettingsGroup); s.beginGroup(GlobalSearch::kSettingsGroup);
const QStringList provider_order = 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_by2", int(LibraryModel::GroupBy_Album)).toInt()),
LibraryModel::GroupBy(s.value("group_by3", int(LibraryModel::GroupBy_None)).toInt()))); LibraryModel::GroupBy(s.value("group_by3", int(LibraryModel::GroupBy_None)).toInt())));
s.endGroup(); s.endGroup();
// Delete any old status widgets // Delete any old status widgets
qDeleteAll(provider_status_widgets_); qDeleteAll(provider_status_widgets_);
provider_status_widgets_.clear(); provider_status_widgets_.clear();
// Toggle visibility of the providers group // Toggle visibility of the providers group
ui_->providers_group->setVisible(show_providers_); ui_->providers_group->setVisible(show_providers_);
@ -209,27 +213,27 @@ void GlobalSearchView::ReloadSettings() {
// Sort the list of providers // Sort the list of providers
QList<SearchProvider*> providers = engine_->providers(); QList<SearchProvider*> providers = engine_->providers();
qSort(providers.begin(), providers.end(), 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; bool any_disabled = false;
foreach (SearchProvider* provider, providers) { foreach (SearchProvider* provider, providers) {
QWidget* parent = ui_->enabled_list; QWidget* parent = ui_->enabled_list;
if (!engine_->is_provider_usable(provider)) { if (!engine_->is_provider_usable(provider)) {
parent = ui_->disabled_list; parent = ui_->disabled_list;
any_disabled = true; any_disabled = true;
} }
SearchProviderStatusWidget* widget = SearchProviderStatusWidget* widget =
new SearchProviderStatusWidget(warning_icon_, engine_, provider); new SearchProviderStatusWidget(warning_icon_, engine_, provider);
parent->layout()->addWidget(widget); parent->layout()->addWidget(widget);
provider_status_widgets_ << widget; provider_status_widgets_ << widget;
} }
ui_->disabled_label->setVisible(any_disabled); ui_->disabled_label->setVisible(any_disabled);
} }
ui_->suggestions_group->setVisible(show_suggestions_); ui_->suggestions_group->setVisible(show_suggestions_);
if (!show_suggestions_) { if (!show_suggestions_) {
update_suggestions_timer_->stop(); update_suggestions_timer_->stop();

View File

@ -18,9 +18,7 @@
#include "spotifysearchprovider.h" #include "spotifysearchprovider.h"
#include <ctime> #include <ctime>
#include <random>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
#include "core/logging.h" #include "core/logging.h"
#include "internet/internetmodel.h" #include "internet/internetmodel.h"
@ -219,8 +217,8 @@ QStringList SpotifySearchProvider::GetSuggestions(int count) {
QStringList all_suggestions = suggestions_.toList(); QStringList all_suggestions = suggestions_.toList();
boost::mt19937 gen(std::time(0)); std::mt19937 gen(std::time(0));
boost::uniform_int<> random(0, all_suggestions.size() - 1); std::uniform_int_distribution<> random(0, all_suggestions.size() - 1);
QSet<QString> candidates; QSet<QString> candidates;

View File

@ -18,7 +18,7 @@
#ifndef DIGITALLYIMPORTEDSERVICEBASE_H #ifndef DIGITALLYIMPORTEDSERVICEBASE_H
#define DIGITALLYIMPORTEDSERVICEBASE_H #define DIGITALLYIMPORTEDSERVICEBASE_H
#include <boost/scoped_ptr.hpp> #include <memory>
#include "digitallyimportedclient.h" #include "digitallyimportedclient.h"
#include "internetservice.h" #include "internetservice.h"
@ -104,7 +104,7 @@ private:
QStandardItem* root_; QStandardItem* root_;
boost::scoped_ptr<QMenu> context_menu_; std::unique_ptr<QMenu> context_menu_;
QStandardItem* context_item_; QStandardItem* context_item_;
CachedList<DigitallyImportedClient::Channel> saved_channels_; CachedList<DigitallyImportedClient::Channel> saved_channels_;

View File

@ -17,7 +17,7 @@
#include "groovesharkservice.h" #include "groovesharkservice.h"
#include <boost/scoped_ptr.hpp> #include <memory>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
@ -1286,8 +1286,8 @@ void GroovesharkService::DeletePlaylist(int playlist_id) {
if (!playlists_.contains(playlist_id)) { if (!playlists_.contains(playlist_id)) {
return; return;
} }
boost::scoped_ptr<QMessageBox> confirmation_dialog(new QMessageBox( std::unique_ptr<QMessageBox> confirmation_dialog(new QMessageBox(
QMessageBox::Question, tr("Delete Grooveshark playlist"), QMessageBox::Question, tr("Delete Grooveshark playlist"),
tr("Are you sure you want to delete this playlist?"), tr("Are you sure you want to delete this playlist?"),
QMessageBox::Yes | QMessageBox::Cancel)); QMessageBox::Yes | QMessageBox::Cancel));

View File

@ -32,8 +32,6 @@
#include "lastfmservice.h" #include "lastfmservice.h"
#include <boost/scoped_ptr.hpp>
#include <QMenu> #include <QMenu>
#include <QSettings> #include <QSettings>
@ -61,7 +59,6 @@
#include "ui/iconloader.h" #include "ui/iconloader.h"
#include "ui/settingsdialog.h" #include "ui/settingsdialog.h"
using boost::scoped_ptr;
using lastfm::XmlQuery; using lastfm::XmlQuery;
uint qHash(const lastfm::Track& track) { uint qHash(const lastfm::Track& track) {

View File

@ -18,6 +18,8 @@
#ifndef LASTFMSERVICE_H #ifndef LASTFMSERVICE_H
#define LASTFMSERVICE_H #define LASTFMSERVICE_H
#include <memory>
namespace lastfm { namespace lastfm {
class RadioStation; class RadioStation;
class Track; class Track;
@ -40,8 +42,6 @@ uint qHash(const lastfm::Track& track);
#include <QMenu> #include <QMenu>
#include <QQueue> #include <QQueue>
#include <boost/scoped_ptr.hpp>
class LastFMUrlHandler; class LastFMUrlHandler;
class QAction; class QAction;
@ -198,9 +198,9 @@ class LastFMService : public InternetService {
QQueue<lastfm::Track> playlist_; QQueue<lastfm::Track> playlist_;
bool already_scrobbled_; bool already_scrobbled_;
boost::scoped_ptr<LastFMStationDialog> station_dialog_; std::unique_ptr<LastFMStationDialog> station_dialog_;
boost::scoped_ptr<QMenu> context_menu_; std::unique_ptr<QMenu> context_menu_;
QAction* remove_action_; QAction* remove_action_;
QAction* add_artist_action_; QAction* add_artist_action_;
QAction* add_tag_action_; QAction* add_tag_action_;

View File

@ -16,13 +16,8 @@
*/ */
#include "magnatunedownloaddialog.h" #include "magnatunedownloaddialog.h"
#include "magnatuneservice.h"
#include "internetmodel.h" #include <memory>
#include "ui_magnatunedownloaddialog.h"
#include "core/logging.h"
#include "core/network.h"
#include "core/utilities.h"
#include "widgets/progressitemdelegate.h"
#include <QCloseEvent> #include <QCloseEvent>
#include <QDir> #include <QDir>
@ -35,6 +30,14 @@
#include <QSettings> #include <QSettings>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#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, MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service,
QWidget *parent) QWidget *parent)
: QDialog(parent), : QDialog(parent),
@ -275,7 +278,7 @@ QString MagnatuneDownloadDialog::GetOutputFilename() {
void MagnatuneDownloadDialog::closeEvent(QCloseEvent* e) { void MagnatuneDownloadDialog::closeEvent(QCloseEvent* e) {
if (current_reply_ && current_reply_->isRunning()) { if (current_reply_ && current_reply_->isRunning()) {
boost::scoped_ptr<QMessageBox> message_box(new QMessageBox( std::unique_ptr<QMessageBox> message_box(new QMessageBox(
QMessageBox::Question, tr("Really cancel?"), QMessageBox::Question, tr("Really cancel?"),
tr("Closing this window will cancel the download."), tr("Closing this window will cancel the download."),
QMessageBox::Abort, this)); QMessageBox::Abort, this));

View File

@ -18,12 +18,12 @@
#ifndef MAGNATUNEDOWNLOADDIALOG_H #ifndef MAGNATUNEDOWNLOADDIALOG_H
#define MAGNATUNEDOWNLOADDIALOG_H #define MAGNATUNEDOWNLOADDIALOG_H
#include <memory>
#include <QDialog> #include <QDialog>
#include <QNetworkReply> #include <QNetworkReply>
#include <QStringList> #include <QStringList>
#include <boost/scoped_ptr.hpp>
#include "core/song.h" #include "core/song.h"
class MagnatuneService; class MagnatuneService;
@ -71,7 +71,7 @@ private:
QNetworkAccessManager* network_; QNetworkAccessManager* network_;
QNetworkReply* current_reply_; QNetworkReply* current_reply_;
boost::scoped_ptr<QFile> download_file_; std::unique_ptr<QFile> download_file_;
int next_row_; int next_row_;
}; };

View File

@ -51,8 +51,6 @@
#include <QtDebug> #include <QtDebug>
using boost::shared_ptr;
const char* MagnatuneService::kServiceName = "Magnatune"; const char* MagnatuneService::kServiceName = "Magnatune";
const char* MagnatuneService::kSettingsGroup = "Magnatune"; const char* MagnatuneService::kSettingsGroup = "Magnatune";
const char* MagnatuneService::kSongsTable = "magnatune_songs"; const char* MagnatuneService::kSongsTable = "magnatune_songs";

View File

@ -18,9 +18,9 @@
#ifndef SAVEDRADIO_H #ifndef SAVEDRADIO_H
#define SAVEDRADIO_H #define SAVEDRADIO_H
#include "internetservice.h" #include <memory>
#include <boost/scoped_ptr.hpp> #include "internetservice.h"
class QMenu; class QMenu;
@ -83,7 +83,7 @@ class SavedRadio : public InternetService {
StreamList streams_; StreamList streams_;
boost::scoped_ptr<AddStreamDialog> edit_dialog_; std::unique_ptr<AddStreamDialog> edit_dialog_;
}; };
#endif // SAVEDRADIO_H #endif // SAVEDRADIO_H

View File

@ -1,7 +1,6 @@
#include "skydriveservice.h" #include "skydriveservice.h"
#include <boost/scoped_ptr.hpp> #include <memory>
using boost::scoped_ptr;
#include <qjson/parser.h> #include <qjson/parser.h>
@ -158,7 +157,7 @@ QUrl SkydriveService::GetStreamingUrlFromSongId(const QString& file_id) {
QUrl url(QString(kSkydriveBase) + file_id); QUrl url(QString(kSkydriveBase) + file_id);
QNetworkRequest request(url); QNetworkRequest request(url);
AddAuthorizationHeader(&request); AddAuthorizationHeader(&request);
scoped_ptr<QNetworkReply> reply(network_->get(request)); std::unique_ptr<QNetworkReply> reply(network_->get(request));
WaitForSignal(reply.get(), SIGNAL(finished())); WaitForSignal(reply.get(), SIGNAL(finished()));
QJson::Parser parser; QJson::Parser parser;

View File

@ -8,8 +8,6 @@
#include <QProcess> #include <QProcess>
#include <QTimer> #include <QTimer>
#include <boost/shared_ptr.hpp>
class Playlist; class Playlist;
class SearchBoxWidget; class SearchBoxWidget;
class SpotifyServer; class SpotifyServer;

View File

@ -20,6 +20,11 @@
#include <QDialog> #include <QDialog>
#include <memory>
using std::placeholders::_1;
using std::placeholders::_2;
#include <boost/multi_index_container.hpp> #include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp> #include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/ordered_index.hpp>

View File

@ -21,8 +21,6 @@
#include <QHash> #include <QHash>
#include <QObject> #include <QObject>
#include <boost/scoped_ptr.hpp>
class Application; class Application;
class Database; class Database;
class LibraryBackend; class LibraryBackend;

View File

@ -46,7 +46,7 @@ void LibraryDirectoryModel::DirectoryDiscovered(const Directory &dir) {
} }
item->setData(dir.id, kIdRole); item->setData(dir.id, kIdRole);
item->setIcon(dir_icon_); item->setIcon(dir_icon_);
storage_ << boost::shared_ptr<MusicStorage>(new FilesystemMusicStorage(dir.path)); storage_ << std::shared_ptr<MusicStorage>(new FilesystemMusicStorage(dir.path));
appendRow(item); appendRow(item);
} }

View File

@ -18,11 +18,11 @@
#ifndef LIBRARYDIRECTORYMODEL_H #ifndef LIBRARYDIRECTORYMODEL_H
#define LIBRARYDIRECTORYMODEL_H #define LIBRARYDIRECTORYMODEL_H
#include <memory>
#include <QIcon> #include <QIcon>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <boost/shared_ptr.hpp>
#include "directory.h" #include "directory.h"
class LibraryBackend; class LibraryBackend;
@ -51,7 +51,7 @@ class LibraryDirectoryModel : public QStandardItemModel {
QIcon dir_icon_; QIcon dir_icon_;
LibraryBackend* backend_; LibraryBackend* backend_;
QList<boost::shared_ptr<MusicStorage> > storage_; QList<std::shared_ptr<MusicStorage> > storage_;
}; };
#endif // LIBRARYDIRECTORYMODEL_H #endif // LIBRARYDIRECTORYMODEL_H

View File

@ -18,9 +18,9 @@
#ifndef LIBRARYFILTERWIDGET_H #ifndef LIBRARYFILTERWIDGET_H
#define LIBRARYFILTERWIDGET_H #define LIBRARYFILTERWIDGET_H
#include <QWidget> #include <memory>
#include <boost/scoped_ptr.hpp> #include <QWidget>
#include "librarymodel.h" #include "librarymodel.h"
@ -92,7 +92,7 @@ class LibraryFilterWidget : public QWidget {
Ui_LibraryFilterWidget* ui_; Ui_LibraryFilterWidget* ui_;
LibraryModel* model_; LibraryModel* model_;
boost::scoped_ptr<GroupByDialog> group_by_dialog_; std::unique_ptr<GroupByDialog> group_by_dialog_;
SettingsDialog* settings_dialog_; SettingsDialog* settings_dialog_;
QMenu* filter_age_menu_; QMenu* filter_age_menu_;

View File

@ -16,6 +16,18 @@
*/ */
#include "librarymodel.h" #include "librarymodel.h"
#include <functional>
#include <QFuture>
#include <QFutureWatcher>
#include <QMetaEnum>
#include <QPixmapCache>
#include <QSettings>
#include <QStringList>
#include <QUrl>
#include <QtConcurrentRun>
#include "librarybackend.h" #include "librarybackend.h"
#include "libraryitem.h" #include "libraryitem.h"
#include "librarydirectorymodel.h" #include "librarydirectorymodel.h"
@ -32,16 +44,8 @@
#include "smartplaylists/querygenerator.h" #include "smartplaylists/querygenerator.h"
#include "ui/iconloader.h" #include "ui/iconloader.h"
#include <QFuture> using std::placeholders::_1;
#include <QFutureWatcher> using std::placeholders::_2;
#include <QMetaEnum>
#include <QPixmapCache>
#include <QSettings>
#include <QStringList>
#include <QUrl>
#include <QtConcurrentRun>
#include <boost/bind.hpp>
using smart_playlists::Generator; using smart_playlists::Generator;
using smart_playlists::GeneratorMimeData; using smart_playlists::GeneratorMimeData;
@ -1114,7 +1118,7 @@ void LibraryModel::GetChildSongs(LibraryItem* item, QList<QUrl>* urls,
const_cast<LibraryModel*>(this)->LazyPopulate(item); const_cast<LibraryModel*>(this)->LazyPopulate(item);
QList<LibraryItem*> children = item->children; QList<LibraryItem*> children = item->children;
qSort(children.begin(), children.end(), boost::bind( qSort(children.begin(), children.end(), std::bind(
&LibraryModel::CompareItems, this, _1, _2)); &LibraryModel::CompareItems, this, _1, _2));
foreach (LibraryItem* child, children) foreach (LibraryItem* child, children)

View File

@ -32,8 +32,6 @@
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
#include "smartplaylists/generator_fwd.h" #include "smartplaylists/generator_fwd.h"
#include <boost/scoped_ptr.hpp>
class Application; class Application;
class AlbumCoverLoader; class AlbumCoverLoader;
class LibraryDirectoryModel; class LibraryDirectoryModel;

View File

@ -15,10 +15,22 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "libraryview.h"
#include <QPainter>
#include <QContextMenuEvent>
#include <QHelpEvent>
#include <QMenu>
#include <QMessageBox>
#include <QSet>
#include <QSettings>
#include <QSortFilterProxyModel>
#include <QToolTip>
#include <QWhatsThis>
#include "librarydirectorymodel.h" #include "librarydirectorymodel.h"
#include "libraryfilterwidget.h" #include "libraryfilterwidget.h"
#include "librarymodel.h" #include "librarymodel.h"
#include "libraryview.h"
#include "libraryitem.h" #include "libraryitem.h"
#include "librarybackend.h" #include "librarybackend.h"
#include "core/application.h" #include "core/application.h"
@ -34,17 +46,6 @@
#include "ui/organisedialog.h" #include "ui/organisedialog.h"
#include "ui/organiseerrordialog.h" #include "ui/organiseerrordialog.h"
#include <QPainter>
#include <QContextMenuEvent>
#include <QHelpEvent>
#include <QMenu>
#include <QMessageBox>
#include <QSet>
#include <QSettings>
#include <QSortFilterProxyModel>
#include <QToolTip>
#include <QWhatsThis>
using smart_playlists::Wizard; using smart_playlists::Wizard;
const char* LibraryView::kSettingsGroup = "LibraryView"; 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 // 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 // they'll all be FilesystemMusicStorage in a library and deleting doesn't
// check the actual directory. // check the actual directory.
boost::shared_ptr<MusicStorage> storage = std::shared_ptr<MusicStorage> storage =
app_->library_model()->directory_model()->index(0, 0).data(MusicStorage::Role_Storage) app_->library_model()->directory_model()->index(0, 0).data(MusicStorage::Role_Storage)
.value<boost::shared_ptr<MusicStorage> >(); .value<std::shared_ptr<MusicStorage>>();
DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage);
connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList)));

View File

@ -18,13 +18,13 @@
#ifndef LIBRARYVIEW_H #ifndef LIBRARYVIEW_H
#define LIBRARYVIEW_H #define LIBRARYVIEW_H
#include "core/song.h" #include <memory>
#include "ui/edittagdialog.h"
#include "widgets/autoexpandingtreeview.h"
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <boost/scoped_ptr.hpp> #include "core/song.h"
#include "ui/edittagdialog.h"
#include "widgets/autoexpandingtreeview.h"
class Application; class Application;
class LibraryFilterWidget; class LibraryFilterWidget;
@ -140,8 +140,8 @@ class LibraryView : public AutoExpandingTreeView {
QAction* edit_smart_playlist_; QAction* edit_smart_playlist_;
QAction* delete_smart_playlist_; QAction* delete_smart_playlist_;
boost::scoped_ptr<OrganiseDialog> organise_dialog_; std::unique_ptr<OrganiseDialog> organise_dialog_;
boost::scoped_ptr<EditTagDialog> edit_tag_dialog_; std::unique_ptr<EditTagDialog> edit_tag_dialog_;
bool is_in_keyboard_search_; bool is_in_keyboard_search_;

View File

@ -15,6 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <memory>
#include <QtGlobal> #include <QtGlobal>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
@ -23,6 +25,19 @@
# include <iostream> # include <iostream>
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
#include <QDir>
#include <QFont>
#include <QLibraryInfo>
#include <QNetworkProxyFactory>
#include <QSslSocket>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSysInfo>
#include <QTextCodec>
#include <QTranslator>
#include <QtConcurrentRun>
#include <QtDebug>
#include "config.h" #include "config.h"
#include "core/application.h" #include "core/application.h"
#include "core/commandlineoptions.h" #include "core/commandlineoptions.h"
@ -54,26 +69,10 @@
#include "qtsingleapplication.h" #include "qtsingleapplication.h"
#include "qtsinglecoreapplication.h" #include "qtsinglecoreapplication.h"
#include <QDir>
#include <QFont>
#include <QLibraryInfo>
#include <QNetworkProxyFactory>
#include <QSslSocket>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSysInfo>
#include <QTextCodec>
#include <QTranslator>
#include <QtConcurrentRun>
#include <QtDebug>
#include <glib-object.h> #include <glib-object.h>
#include <glib.h> #include <glib.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <boost/scoped_ptr.hpp>
using boost::scoped_ptr;
#include <echonest/Config.h> #include <echonest/Config.h>
#ifdef HAVE_SPOTIFY_DOWNLOADER #ifdef HAVE_SPOTIFY_DOWNLOADER
@ -449,7 +448,7 @@ int main(int argc, char *argv[]) {
#endif // Q_OS_LINUX #endif // Q_OS_LINUX
// Create the tray icon and OSD // Create the tray icon and OSD
scoped_ptr<SystemTrayIcon> tray_icon(SystemTrayIcon::CreateSystemTrayIcon()); std::unique_ptr<SystemTrayIcon> tray_icon(SystemTrayIcon::CreateSystemTrayIcon());
OSD osd(tray_icon.get(), &app); OSD osd(tray_icon.get(), &app);
#ifdef HAVE_DBUS #ifdef HAVE_DBUS

View File

@ -17,7 +17,7 @@
#include "moodbarloader.h" #include "moodbarloader.h"
#include <boost/scoped_ptr.hpp> #include <memory>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
@ -101,7 +101,7 @@ MoodbarLoader::Result MoodbarLoader::Load(
} }
// Maybe it exists in the cache? // Maybe it exists in the cache?
boost::scoped_ptr<QIODevice> cache_device(cache_->data(url)); std::unique_ptr<QIODevice> cache_device(cache_->data(url));
if (cache_device) { if (cache_device) {
qLog(Info) << "Loading cached moodbar data for" << filename; qLog(Info) << "Loading cached moodbar data for" << filename;
*data = cache_device->readAll(); *data = cache_device->readAll();

View File

@ -1,7 +1,7 @@
#ifndef NETWORKREMOTE_H #ifndef NETWORKREMOTE_H
#define NETWORKREMOTE_H #define NETWORKREMOTE_H
#include <boost/scoped_ptr.hpp> #include <memory>
#include <QTcpServer> #include <QTcpServer>
#include <QTcpSocket> #include <QTcpSocket>
@ -30,10 +30,10 @@ public slots:
void SendKitten(quint64 id, const QImage& kitten); void SendKitten(quint64 id, const QImage& kitten);
private: private:
boost::scoped_ptr<QTcpServer> server_; std::unique_ptr<QTcpServer> server_;
boost::scoped_ptr<QTcpServer> server_ipv6_; std::unique_ptr<QTcpServer> server_ipv6_;
boost::scoped_ptr<IncomingDataParser> incoming_data_parser_; std::unique_ptr<IncomingDataParser> incoming_data_parser_;
boost::scoped_ptr<OutgoingDataCreator> outgoing_data_creator_; std::unique_ptr<OutgoingDataCreator> outgoing_data_creator_;
quint16 port_; quint16 port_;
bool use_remote_; bool use_remote_;

View File

@ -1,6 +1,8 @@
#ifndef OUTGOINGDATACREATOR_H #ifndef OUTGOINGDATACREATOR_H
#define OUTGOINGDATACREATOR_H #define OUTGOINGDATACREATOR_H
#include <memory>
#include <QTcpSocket> #include <QTcpSocket>
#include <QImage> #include <QImage>
#include <QList> #include <QList>
@ -24,7 +26,6 @@
#include "songinfo/ultimatelyricsreader.h" #include "songinfo/ultimatelyricsreader.h"
#include "remotecontrolmessages.pb.h" #include "remotecontrolmessages.pb.h"
#include "remoteclient.h" #include "remoteclient.h"
#include <boost/scoped_ptr.hpp>
typedef QList<SongInfoProvider*> ProviderList; typedef QList<SongInfoProvider*> ProviderList;
@ -91,7 +92,7 @@ private:
int last_track_position_; int last_track_position_;
bool aww_; bool aww_;
boost::scoped_ptr<UltimateLyricsReader> ultimate_reader_; std::unique_ptr<UltimateLyricsReader> ultimate_reader_;
ProviderList provider_list_; ProviderList provider_list_;
QMap<int, SongInfoFetcher::Result> results_; QMap<int, SongInfoFetcher::Result> results_;
SongInfoFetcher* fetcher_; SongInfoFetcher* fetcher_;

View File

@ -16,6 +16,25 @@
*/ */
#include "playlist.h" #include "playlist.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <unordered_map>
#include <QApplication>
#include <QBuffer>
#include <QCoreApplication>
#include <QDirIterator>
#include <QFileInfo>
#include <QLinkedList>
#include <QMimeData>
#include <QMutableListIterator>
#include <QSortFilterProxyModel>
#include <QUndoStack>
#include <QtConcurrentRun>
#include <QtDebug>
#include "playlistbackend.h" #include "playlistbackend.h"
#include "playlistfilter.h" #include "playlistfilter.h"
#include "playlistitemmimedata.h" #include "playlistitemmimedata.h"
@ -49,36 +68,15 @@
#include "smartplaylists/generatorinserter.h" #include "smartplaylists/generatorinserter.h"
#include "smartplaylists/generatormimedata.h" #include "smartplaylists/generatormimedata.h"
#include <QApplication> using std::placeholders::_1;
#include <QBuffer> using std::placeholders::_2;
#include <QCoreApplication> using std::shared_ptr;
#include <QDirIterator> using std::unordered_map;
#include <QFileInfo>
#include <QLinkedList>
#include <QMimeData>
#include <QMutableListIterator>
#include <QSortFilterProxyModel>
#include <QUndoStack>
#include <QtConcurrentRun>
#include <QtDebug>
#include <algorithm>
#include <boost/bind.hpp>
#ifdef USE_STD_UNORDERED_MAP
#include <unordered_map>
using std::unordered_map;
#else
#include <tr1/unordered_map>
using std::tr1::unordered_map;
#endif
using smart_playlists::Generator; using smart_playlists::Generator;
using smart_playlists::GeneratorInserter; using smart_playlists::GeneratorInserter;
using smart_playlists::GeneratorPtr; using smart_playlists::GeneratorPtr;
using boost::shared_ptr;
const char* Playlist::kCddaMimeType = "x-content/audio-cdda"; const char* Playlist::kCddaMimeType = "x-content/audio-cdda";
const char* Playlist::kRowsMimetype = "application/x-clementine-playlist-rows"; const char* Playlist::kRowsMimetype = "application/x-clementine-playlist-rows";
const char* Playlist::kPlayNowMimetype = "application/x-clementine-play-now"; 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; begin += current_item_index_.row() + 1;
qStableSort(begin, new_items.end(), 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)); undo_stack_->push(new PlaylistUndoCommands::SortItems(this, column, order, new_items));
} }
@ -1814,8 +1812,8 @@ void Playlist::ReshuffleIndices() {
// Sort the virtual items // Sort the virtual items
std::stable_sort(begin, end, std::stable_sort(begin, end,
boost::bind(AlbumShuffleComparator, album_key_positions, std::bind(AlbumShuffleComparator, album_key_positions,
album_keys, _1, _2)); album_keys, _1, _2));
break; break;
} }

View File

@ -21,8 +21,6 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QList> #include <QList>
#include <boost/shared_ptr.hpp>
#include "playlistitem.h" #include "playlistitem.h"
#include "playlistsequence.h" #include "playlistsequence.h"
#include "core/tagreaderclient.h" #include "core/tagreaderclient.h"

View File

@ -16,6 +16,17 @@
*/ */
#include "playlistbackend.h" #include "playlistbackend.h"
#include <memory>
#include <functional>
#include <QFile>
#include <QHash>
#include <QMutexLocker>
#include <QSqlQuery>
#include <QtConcurrentMap>
#include <QtDebug>
#include "core/application.h" #include "core/application.h"
#include "core/database.h" #include "core/database.h"
#include "core/scopedtransaction.h" #include "core/scopedtransaction.h"
@ -26,19 +37,11 @@
#include "playlistparsers/cueparser.h" #include "playlistparsers/cueparser.h"
#include "smartplaylists/generator.h" #include "smartplaylists/generator.h"
#include <QFile> using std::placeholders::_1;
#include <QHash> using std::shared_ptr;
#include <QMutexLocker>
#include <QSqlQuery>
#include <QtConcurrentMap>
#include <QtDebug>
#include <boost/bind.hpp>
using smart_playlists::GeneratorPtr; using smart_playlists::GeneratorPtr;
using boost::shared_ptr;
const int PlaylistBackend::kSongTableJoins = 4; const int PlaylistBackend::kSongTableJoins = 4;
PlaylistBackend::PlaylistBackend(Application* app, QObject* parent) PlaylistBackend::PlaylistBackend(Application* app, QObject* parent)
@ -174,8 +177,10 @@ QFuture<PlaylistItemPtr> PlaylistBackend::GetPlaylistItems(int playlist) {
// it's probable that we'll have a few songs associated with the // it's probable that we'll have a few songs associated with the
// same CUE so we're caching results of parsing CUEs // same CUE so we're caching results of parsing CUEs
boost::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState()); std::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState());
return QtConcurrent::mapped(rows, boost::bind(&PlaylistBackend::NewPlaylistItemFromQuery, this, _1, state_ptr)); return QtConcurrent::mapped(
rows, std::bind(
&PlaylistBackend::NewPlaylistItemFromQuery, this, _1, state_ptr));
} }
QFuture<Song> PlaylistBackend::GetPlaylistSongs(int playlist) { QFuture<Song> PlaylistBackend::GetPlaylistSongs(int playlist) {
@ -184,11 +189,12 @@ QFuture<Song> PlaylistBackend::GetPlaylistSongs(int playlist) {
// it's probable that we'll have a few songs associated with the // it's probable that we'll have a few songs associated with the
// same CUE so we're caching results of parsing CUEs // same CUE so we're caching results of parsing CUEs
boost::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState()); std::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState());
return QtConcurrent::mapped(rows, boost::bind(&PlaylistBackend::NewSongFromQuery, this, _1, state_ptr)); return QtConcurrent::mapped(rows, std::bind(&PlaylistBackend::NewSongFromQuery, this, _1, state_ptr));
} }
PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(const SqlRow& row, boost::shared_ptr<NewSongFromQueryState> state) { PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(
const SqlRow& row, std::shared_ptr<NewSongFromQueryState> state) {
// The song tables get joined first, plus one each for the song ROWIDs // The song tables get joined first, plus one each for the song ROWIDs
const int playlist_row = (Song::kColumns.count() + 1) * kSongTableJoins; 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<NewSongFromQueryState> state) { Song PlaylistBackend::NewSongFromQuery(
const SqlRow& row, std::shared_ptr<NewSongFromQueryState> state) {
return NewPlaylistItemFromQuery(row, state)->Metadata(); return NewPlaylistItemFromQuery(row, state)->Metadata();
} }
// If song had a CUE and the CUE still exists, the metadata from it will // If song had a CUE and the CUE still exists, the metadata from it will
// be applied here. // be applied here.
PlaylistItemPtr PlaylistBackend::RestoreCueData(PlaylistItemPtr item, boost::shared_ptr<NewSongFromQueryState> state) { PlaylistItemPtr PlaylistBackend::RestoreCueData(
PlaylistItemPtr item, std::shared_ptr<NewSongFromQueryState> state) {
// we need library to run a CueParser; also, this method applies only to // we need library to run a CueParser; also, this method applies only to
// file-type PlaylistItems // file-type PlaylistItems
if(item->type() != "File") { if(item->type() != "File") {

View File

@ -92,9 +92,9 @@ class PlaylistBackend : public QObject {
QList<SqlRow> GetPlaylistRows(int playlist); QList<SqlRow> GetPlaylistRows(int playlist);
Song NewSongFromQuery(const SqlRow& row, boost::shared_ptr<NewSongFromQueryState> state); Song NewSongFromQuery(const SqlRow& row, std::shared_ptr<NewSongFromQueryState> state);
PlaylistItemPtr NewPlaylistItemFromQuery(const SqlRow& row, boost::shared_ptr<NewSongFromQueryState> state); PlaylistItemPtr NewPlaylistItemFromQuery(const SqlRow& row, std::shared_ptr<NewSongFromQueryState> state);
PlaylistItemPtr RestoreCueData(PlaylistItemPtr item, boost::shared_ptr<NewSongFromQueryState> state); PlaylistItemPtr RestoreCueData(PlaylistItemPtr item, std::shared_ptr<NewSongFromQueryState> state);
enum GetPlaylistsFlags { enum GetPlaylistsFlags {
GetPlaylists_OpenInUi = 1, GetPlaylists_OpenInUi = 1,

View File

@ -18,19 +18,19 @@
#ifndef PLAYLISTITEM_H #ifndef PLAYLISTITEM_H
#define PLAYLISTITEM_H #define PLAYLISTITEM_H
#include <memory>
#include <QMap> #include <QMap>
#include <QMetaType> #include <QMetaType>
#include <QStandardItem> #include <QStandardItem>
#include <QUrl> #include <QUrl>
#include <boost/enable_shared_from_this.hpp>
#include "core/song.h" #include "core/song.h"
class QAction; class QAction;
class SqlRow; class SqlRow;
class PlaylistItem : public boost::enable_shared_from_this<PlaylistItem> { class PlaylistItem : public std::enable_shared_from_this<PlaylistItem> {
public: public:
PlaylistItem(const QString& type) PlaylistItem(const QString& type)
: type_(type) {} : type_(type) {}
@ -109,7 +109,7 @@ class PlaylistItem : public boost::enable_shared_from_this<PlaylistItem> {
QMap<short, QColor> background_colors_; QMap<short, QColor> background_colors_;
QMap<short, QColor> foreground_colors_; QMap<short, QColor> foreground_colors_;
}; };
typedef boost::shared_ptr<PlaylistItem> PlaylistItemPtr; typedef std::shared_ptr<PlaylistItem> PlaylistItemPtr;
typedef QList<PlaylistItemPtr> PlaylistItemList; typedef QList<PlaylistItemPtr> PlaylistItemList;
Q_DECLARE_METATYPE(PlaylistItemPtr) Q_DECLARE_METATYPE(PlaylistItemPtr)

View File

@ -18,12 +18,12 @@
#ifndef PLAYLISTSEQUENCE_H #ifndef PLAYLISTSEQUENCE_H
#define PLAYLISTSEQUENCE_H #define PLAYLISTSEQUENCE_H
#include <memory>
#include <QWidget> #include <QWidget>
#include "core/settingsprovider.h" #include "core/settingsprovider.h"
#include <boost/scoped_ptr.hpp>
class QMenu; class QMenu;
class Ui_PlaylistSequence; class Ui_PlaylistSequence;
@ -79,7 +79,7 @@ class PlaylistSequence : public QWidget {
private: private:
Ui_PlaylistSequence* ui_; Ui_PlaylistSequence* ui_;
boost::scoped_ptr<SettingsProvider> settings_; std::unique_ptr<SettingsProvider> settings_;
QMenu* repeat_menu_; QMenu* repeat_menu_;
QMenu* shuffle_menu_; QMenu* shuffle_menu_;

View File

@ -18,13 +18,13 @@
#ifndef PLAYLISTVIEW_H #ifndef PLAYLISTVIEW_H
#define PLAYLISTVIEW_H #define PLAYLISTVIEW_H
#include "playlist.h" #include <memory>
#include <QBasicTimer> #include <QBasicTimer>
#include <QProxyStyle> #include <QProxyStyle>
#include <QTreeView> #include <QTreeView>
#include <boost/scoped_ptr.hpp> #include "playlist.h"
class QCleanlooksStyle; class QCleanlooksStyle;
@ -52,7 +52,7 @@ public:
QPainter* painter, const QWidget* widget) const; QPainter* painter, const QWidget* widget) const;
private: private:
boost::scoped_ptr<QCleanlooksStyle> cleanlooks_; std::unique_ptr<QCleanlooksStyle> cleanlooks_;
}; };

View File

@ -23,8 +23,6 @@
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <boost/noncopyable.hpp>
class QDomDocument; class QDomDocument;
class QDomNode; class QDomNode;
@ -32,7 +30,7 @@ class XMLParser : public ParserBase {
protected: protected:
XMLParser(LibraryBackendInterface* library, QObject* parent); XMLParser(LibraryBackendInterface* library, QObject* parent);
class StreamElement : public boost::noncopyable { class StreamElement {
public: public:
StreamElement(const QString& name, QXmlStreamWriter* stream) : stream_(stream) { StreamElement(const QString& name, QXmlStreamWriter* stream) : stream_(stream) {
stream->writeStartElement(name); stream->writeStartElement(name);
@ -44,6 +42,7 @@ class XMLParser : public ParserBase {
private: private:
QXmlStreamWriter* stream_; QXmlStreamWriter* stream_;
Q_DISABLE_COPY(StreamElement);
}; };
}; };

View File

@ -20,14 +20,13 @@
#include "playlist/playlistitem.h" #include "playlist/playlistitem.h"
#include <boost/enable_shared_from_this.hpp> #include <memory>
#include <boost/shared_ptr.hpp>
class LibraryBackend; class LibraryBackend;
namespace smart_playlists { namespace smart_playlists {
class Generator : public QObject, public boost::enable_shared_from_this<Generator> { class Generator : public QObject, public std::enable_shared_from_this<Generator> {
Q_OBJECT Q_OBJECT
public: public:
@ -38,7 +37,7 @@ public:
static const int kDefaultDynamicFuture; static const int kDefaultDynamicFuture;
// Creates a new Generator of the given type // Creates a new Generator of the given type
static boost::shared_ptr<Generator> Create(const QString& type); static std::shared_ptr<Generator> Create(const QString& type);
// Should be called before Load on a new Generator // Should be called before Load on a new Generator
void set_library(LibraryBackend* backend) { backend_ = backend; } void set_library(LibraryBackend* backend) { backend_ = backend; }

View File

@ -18,13 +18,13 @@
#ifndef PLAYLISTGENERATOR_FWD_H #ifndef PLAYLISTGENERATOR_FWD_H
#define PLAYLISTGENERATOR_FWD_H #define PLAYLISTGENERATOR_FWD_H
#include <boost/shared_ptr.hpp> #include <memory>
namespace smart_playlists { namespace smart_playlists {
class Generator; class Generator;
typedef boost::shared_ptr<Generator> GeneratorPtr; typedef std::shared_ptr<Generator> GeneratorPtr;
} // namespace } // namespace

View File

@ -55,7 +55,7 @@ public:
SearchPreview* preview_; SearchPreview* preview_;
boost::scoped_ptr<Ui_SmartPlaylistQuerySearchPage> ui_; std::unique_ptr<Ui_SmartPlaylistQuerySearchPage> ui_;
}; };
class QueryWizardPlugin::SortPage : public QWizardPage { class QueryWizardPlugin::SortPage : public QWizardPage {
@ -161,8 +161,8 @@ int QueryWizardPlugin::CreatePages(QWizard* wizard, int finish_page_id) {
} }
void QueryWizardPlugin::SetGenerator(GeneratorPtr g) { void QueryWizardPlugin::SetGenerator(GeneratorPtr g) {
boost::shared_ptr<QueryGenerator> gen = std::shared_ptr<QueryGenerator> gen =
boost::dynamic_pointer_cast<QueryGenerator>(g); std::dynamic_pointer_cast<QueryGenerator>(g);
if (!gen) if (!gen)
return; return;
Search search = gen->search(); Search search = gen->search();
@ -198,10 +198,10 @@ void QueryWizardPlugin::SetGenerator(GeneratorPtr g) {
} }
GeneratorPtr QueryWizardPlugin::CreateGenerator() const { GeneratorPtr QueryWizardPlugin::CreateGenerator() const {
boost::shared_ptr<QueryGenerator> gen(new QueryGenerator); std::shared_ptr<QueryGenerator> gen(new QueryGenerator);
gen->Load(MakeSearch()); gen->Load(MakeSearch());
return boost::static_pointer_cast<Generator>(gen); return std::static_pointer_cast<Generator>(gen);
} }
void QueryWizardPlugin::UpdateSortOrder() { void QueryWizardPlugin::UpdateSortOrder() {

View File

@ -18,12 +18,13 @@
#ifndef QUERYWIZARDPLUGIN_H #ifndef QUERYWIZARDPLUGIN_H
#define QUERYWIZARDPLUGIN_H #define QUERYWIZARDPLUGIN_H
#include "search.h"
#include "wizardplugin.h" #include "wizardplugin.h"
#include <memory>
#include <QWizard> #include <QWizard>
#include <boost/scoped_ptr.hpp> #include "search.h"
class Ui_SmartPlaylistQuerySearchPage; class Ui_SmartPlaylistQuerySearchPage;
class Ui_SmartPlaylistQuerySortPage; class Ui_SmartPlaylistQuerySortPage;
@ -70,7 +71,7 @@ private:
Search MakeSearch() const; Search MakeSearch() const;
SearchPage* search_page_; SearchPage* search_page_;
boost::scoped_ptr<Ui_SmartPlaylistQuerySortPage> sort_ui_; std::unique_ptr<Ui_SmartPlaylistQuerySortPage> sort_ui_;
int previous_scrollarea_max_; int previous_scrollarea_max_;
}; };

View File

@ -15,14 +15,17 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "querygenerator.h"
#include "searchpreview.h" #include "searchpreview.h"
#include "ui_searchpreview.h" #include "ui_searchpreview.h"
#include "playlist/playlist.h"
#include <memory>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QtConcurrentRun> #include <QtConcurrentRun>
#include "querygenerator.h"
#include "playlist/playlist.h"
namespace smart_playlists { namespace smart_playlists {
typedef QFuture<PlaylistItemList> Future; typedef QFuture<PlaylistItemList> Future;
@ -94,7 +97,7 @@ PlaylistItemList DoRunSearch(GeneratorPtr gen) {
void SearchPreview::RunSearch(const Search& search) { void SearchPreview::RunSearch(const Search& search) {
generator_.reset(new QueryGenerator); generator_.reset(new QueryGenerator);
generator_->set_library(backend_); generator_->set_library(backend_);
boost::dynamic_pointer_cast<QueryGenerator>(generator_)->Load(search); std::dynamic_pointer_cast<QueryGenerator>(generator_)->Load(search);
ui_->busy_container->show(); ui_->busy_container->show();
ui_->count_label->hide(); ui_->count_label->hide();
@ -109,7 +112,7 @@ void SearchPreview::SearchFinished() {
FutureWatcher* watcher = static_cast<FutureWatcher*>(sender()); FutureWatcher* watcher = static_cast<FutureWatcher*>(sender());
watcher->deleteLater(); watcher->deleteLater();
last_search_ = boost::dynamic_pointer_cast<QueryGenerator>(generator_)->search(); last_search_ = std::dynamic_pointer_cast<QueryGenerator>(generator_)->search();
generator_.reset(); generator_.reset();
if (pending_search_.is_valid() && pending_search_ != last_search_) { if (pending_search_.is_valid() && pending_search_ != last_search_) {

View File

@ -16,18 +16,19 @@
*/ */
#include "echonestbiographies.h" #include "echonestbiographies.h"
#include "songinfotextview.h"
#include "core/logging.h" #include <memory>
#include <echonest/Artist.h> #include <echonest/Artist.h>
#include <boost/scoped_ptr.hpp> #include "songinfotextview.h"
#include "core/logging.h"
struct EchoNestBiographies::Request { struct EchoNestBiographies::Request {
Request(int id) : id_(id), artist_(new Echonest::Artist) {} Request(int id) : id_(id), artist_(new Echonest::Artist) {}
int id_; int id_;
boost::scoped_ptr<Echonest::Artist> artist_; std::unique_ptr<Echonest::Artist> artist_;
}; };
EchoNestBiographies::EchoNestBiographies() { EchoNestBiographies::EchoNestBiographies() {
@ -46,7 +47,7 @@ EchoNestBiographies::EchoNestBiographies() {
} }
void EchoNestBiographies::FetchInfo(int id, const Song& metadata) { void EchoNestBiographies::FetchInfo(int id, const Song& metadata) {
boost::shared_ptr<Request> request(new Request(id)); std::shared_ptr<Request> request(new Request(id));
request->artist_->setName(metadata.artist()); request->artist_->setName(metadata.artist());
QNetworkReply* reply = request->artist_->fetchBiographies(); QNetworkReply* reply = request->artist_->fetchBiographies();
@ -70,7 +71,7 @@ void EchoNestBiographies::RequestFinished() {
QSet<QString> already_seen; QSet<QString> already_seen;
foreach (const Echonest::Biography& bio, request->artist_->biographies()) { for (const Echonest::Biography& bio : request->artist_->biographies()) {
QString canonical_site = bio.site().toLower(); QString canonical_site = bio.site().toLower();
canonical_site.replace(QRegExp("[^a-z]"),""); canonical_site.replace(QRegExp("[^a-z]"),"");

View File

@ -18,9 +18,9 @@
#ifndef ECHONESTBIOGRAPHIES_H #ifndef ECHONESTBIOGRAPHIES_H
#define ECHONESTBIOGRAPHIES_H #define ECHONESTBIOGRAPHIES_H
#include "songinfoprovider.h" #include <memory>
#include <boost/shared_ptr.hpp> #include "songinfoprovider.h"
class QNetworkReply; class QNetworkReply;
@ -40,7 +40,7 @@ private:
QMap<QString, QIcon> site_icons_; QMap<QString, QIcon> site_icons_;
struct Request; struct Request;
typedef boost::shared_ptr<Request> RequestPtr; typedef std::shared_ptr<Request> RequestPtr;
QMap<QNetworkReply*, RequestPtr> requests_; QMap<QNetworkReply*, RequestPtr> requests_;
}; };

View File

@ -16,21 +16,22 @@
*/ */
#include "echonestimages.h" #include "echonestimages.h"
#include "core/logging.h"
#include <memory>
#include <echonest/Artist.h> #include <echonest/Artist.h>
#include <boost/scoped_ptr.hpp> #include "core/logging.h"
struct EchoNestImages::Request { struct EchoNestImages::Request {
Request(int id) : id_(id), artist_(new Echonest::Artist) {} Request(int id) : id_(id), artist_(new Echonest::Artist) {}
int id_; int id_;
boost::scoped_ptr<Echonest::Artist> artist_; std::unique_ptr<Echonest::Artist> artist_;
}; };
void EchoNestImages::FetchInfo(int id, const Song& metadata) { void EchoNestImages::FetchInfo(int id, const Song& metadata) {
boost::shared_ptr<Request> request(new Request(id)); std::shared_ptr<Request> request(new Request(id));
request->artist_->setName(metadata.artist()); request->artist_->setName(metadata.artist());
QNetworkReply* reply = request->artist_->fetchImages(); QNetworkReply* reply = request->artist_->fetchImages();

View File

@ -18,9 +18,9 @@
#ifndef ECHONESTIMAGES_H #ifndef ECHONESTIMAGES_H
#define ECHONESTIMAGES_H #define ECHONESTIMAGES_H
#include "songinfoprovider.h" #include <memory>
#include <boost/shared_ptr.hpp> #include "songinfoprovider.h"
class QNetworkReply; class QNetworkReply;
@ -35,7 +35,7 @@ private slots:
private: private:
struct Request; struct Request;
typedef boost::shared_ptr<Request> RequestPtr; typedef std::shared_ptr<Request> RequestPtr;
QMap<QNetworkReply*, RequestPtr> requests_; QMap<QNetworkReply*, RequestPtr> requests_;
}; };

View File

@ -16,22 +16,23 @@
*/ */
#include "echonesttags.h" #include "echonesttags.h"
#include "tagwidget.h"
#include "core/logging.h" #include <memory>
#include <echonest/Artist.h> #include <echonest/Artist.h>
#include <boost/scoped_ptr.hpp> #include "tagwidget.h"
#include "core/logging.h"
struct EchoNestTags::Request { struct EchoNestTags::Request {
Request(int id) : id_(id), artist_(new Echonest::Artist) {} Request(int id) : id_(id), artist_(new Echonest::Artist) {}
int id_; int id_;
boost::scoped_ptr<Echonest::Artist> artist_; std::unique_ptr<Echonest::Artist> artist_;
}; };
void EchoNestTags::FetchInfo(int id, const Song& metadata) { void EchoNestTags::FetchInfo(int id, const Song& metadata) {
boost::shared_ptr<Request> request(new Request(id)); std::shared_ptr<Request> request(new Request(id));
request->artist_->setName(metadata.artist()); request->artist_->setName(metadata.artist());
QNetworkReply* reply = request->artist_->fetchTerms(); QNetworkReply* reply = request->artist_->fetchTerms();
@ -65,7 +66,7 @@ void EchoNestTags::RequestFinished() {
widget->SetIcon(data.icon_); widget->SetIcon(data.icon_);
foreach (const Echonest::Term& term, request->artist_->terms()) { for (const Echonest::Term& term : request->artist_->terms()) {
widget->AddTag(term.name()); widget->AddTag(term.name());
if (widget->count() >= 10) if (widget->count() >= 10)
break; break;

View File

@ -18,9 +18,9 @@
#ifndef ECHONESTTAGS_H #ifndef ECHONESTTAGS_H
#define ECHONESTTAGS_H #define ECHONESTTAGS_H
#include "songinfoprovider.h" #include <memory>
#include <boost/shared_ptr.hpp> #include "songinfoprovider.h"
class QNetworkReply; class QNetworkReply;
@ -35,7 +35,7 @@ private slots:
private: private:
struct Request; struct Request;
typedef boost::shared_ptr<Request> RequestPtr; typedef std::shared_ptr<Request> RequestPtr;
QMap<QNetworkReply*, RequestPtr> requests_; QMap<QNetworkReply*, RequestPtr> requests_;
}; };

View File

@ -18,9 +18,9 @@
#ifndef SONGINFOVIEW_H #ifndef SONGINFOVIEW_H
#define SONGINFOVIEW_H #define SONGINFOVIEW_H
#include "songinfobase.h" #include <memory>
#include <boost/scoped_ptr.hpp> #include "songinfobase.h"
class UltimateLyricsProvider; class UltimateLyricsProvider;
class UltimateLyricsReader; class UltimateLyricsReader;
@ -53,7 +53,7 @@ private slots:
void UltimateLyricsParsed(); void UltimateLyricsParsed();
private: private:
boost::scoped_ptr<UltimateLyricsReader> ultimate_reader_; std::unique_ptr<UltimateLyricsReader> ultimate_reader_;
}; };
#endif // SONGINFOVIEW_H #endif // SONGINFOVIEW_H

View File

@ -26,8 +26,6 @@
#include <QTextCodec> #include <QTextCodec>
#include <QThread> #include <QThread>
#include <boost/scoped_ptr.hpp>
const int UltimateLyricsProvider::kRedirectLimit = 5; const int UltimateLyricsProvider::kRedirectLimit = 5;

View File

@ -17,6 +17,8 @@
#include "transcoder.h" #include "transcoder.h"
#include <memory>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@ -24,12 +26,10 @@
#include <QThread> #include <QThread>
#include <QtDebug> #include <QtDebug>
#include <boost/bind.hpp>
#include "core/logging.h" #include "core/logging.h"
#include "core/signalchecker.h" #include "core/signalchecker.h"
using boost::shared_ptr; using std::shared_ptr;
int Transcoder::JobFinishedEvent::sEventType = -1; int Transcoder::JobFinishedEvent::sEventType = -1;
@ -543,7 +543,7 @@ void Transcoder::Cancel() {
QMap<QString, float> Transcoder::GetProgress() const { QMap<QString, float> Transcoder::GetProgress() const {
QMap<QString, float> ret; QMap<QString, float> ret;
foreach (boost::shared_ptr<JobState> state, current_jobs_) { for (const auto& state : current_jobs_) {
if (!state->pipeline_) if (!state->pipeline_)
continue; continue;

View File

@ -18,6 +18,8 @@
#ifndef TRANSCODER_H #ifndef TRANSCODER_H
#define TRANSCODER_H #define TRANSCODER_H
#include <memory>
#include <gst/gst.h> #include <gst/gst.h>
#include <QObject> #include <QObject>
@ -25,9 +27,6 @@
#include <QEvent> #include <QEvent>
#include <QMetaType> #include <QMetaType>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include "core/song.h" #include "core/song.h"
@ -139,7 +138,7 @@ class Transcoder : public QObject {
static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage* msg, gpointer data); static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage* msg, gpointer data);
private: private:
typedef QList<boost::shared_ptr<JobState> > JobStateList; typedef QList<std::shared_ptr<JobState> > JobStateList;
int max_threads_; int max_threads_;
QList<Job> queued_jobs_; QList<Job> queued_jobs_;

View File

@ -211,7 +211,7 @@ void AlbumCoverManager::showEvent(QShowEvent *) {
void AlbumCoverManager::closeEvent(QCloseEvent* e) { void AlbumCoverManager::closeEvent(QCloseEvent* e) {
if (!cover_fetching_tasks_.isEmpty()) { if (!cover_fetching_tasks_.isEmpty()) {
boost::scoped_ptr<QMessageBox> message_box(new QMessageBox( std::unique_ptr<QMessageBox> message_box(new QMessageBox(
QMessageBox::Question, tr("Really cancel?"), QMessageBox::Question, tr("Really cancel?"),
tr("Closing this window will stop searching for album covers."), tr("Closing this window will stop searching for album covers."),
QMessageBox::Abort, this)); QMessageBox::Abort, this));

View File

@ -15,16 +15,17 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "albumcovermanager.h"
#include "albumcovermanagerlist.h" #include "albumcovermanagerlist.h"
#include "library/librarybackend.h"
#include "playlist/songmimedata.h"
#include <boost/scoped_ptr.hpp> #include <memory>
#include <QDropEvent> #include <QDropEvent>
#include <QUrl> #include <QUrl>
#include "albumcovermanager.h"
#include "library/librarybackend.h"
#include "playlist/songmimedata.h"
AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent) AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent)
: QListWidget(parent), : QListWidget(parent),
manager_(NULL) manager_(NULL)
@ -48,7 +49,7 @@ QMimeData* AlbumCoverManagerList::mimeData(const QList<QListWidgetItem*> items)
} }
// Get the QAbstractItemModel data so the picture works // Get the QAbstractItemModel data so the picture works
boost::scoped_ptr<QMimeData> orig_data(QListWidget::mimeData(items)); std::unique_ptr<QMimeData> orig_data(QListWidget::mimeData(items));
SongMimeData* mime_data = new SongMimeData; SongMimeData* mime_data = new SongMimeData;
mime_data->backend = manager_->backend(); mime_data->backend = manager_->backend();

View File

@ -18,14 +18,12 @@
#ifndef ALBUMCOVERSEARCHER_H #ifndef ALBUMCOVERSEARCHER_H
#define ALBUMCOVERSEARCHER_H #define ALBUMCOVERSEARCHER_H
#include "covers/albumcoverfetcher.h"
#include "covers/albumcoverloaderoptions.h"
#include <QDialog> #include <QDialog>
#include <QIcon> #include <QIcon>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <boost/shared_ptr.hpp> #include "covers/albumcoverfetcher.h"
#include "covers/albumcoverloaderoptions.h"
class AlbumCoverLoader; class AlbumCoverLoader;
class Application; class Application;
@ -35,7 +33,6 @@ class QModelIndex;
class QStandardItem; class QStandardItem;
class QStandardItemModel; class QStandardItemModel;
class SizeOverlayDelegate : public QStyledItemDelegate { class SizeOverlayDelegate : public QStyledItemDelegate {
public: public:
static const int kMargin; static const int kMargin;

View File

@ -24,11 +24,9 @@
#include <QKeySequence> #include <QKeySequence>
#include <boost/noncopyable.hpp>
#import "core/mac_utilities.h" #import "core/mac_utilities.h"
class MacMonitorWrapper : boost::noncopyable { class MacMonitorWrapper {
public: public:
explicit MacMonitorWrapper(id monitor) : local_monitor_(monitor) {} explicit MacMonitorWrapper(id monitor) : local_monitor_(monitor) {}
@ -36,6 +34,7 @@ class MacMonitorWrapper : boost::noncopyable {
private: private:
id local_monitor_; id local_monitor_;
Q_DISABLE_COPY(MacMonitorWrapper);
}; };
bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) { bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) {

View File

@ -18,11 +18,11 @@
#ifndef GLOBALSHORTCUTSSETTINGSPAGE_H #ifndef GLOBALSHORTCUTSSETTINGSPAGE_H
#define GLOBALSHORTCUTSSETTINGSPAGE_H #define GLOBALSHORTCUTSSETTINGSPAGE_H
#include <memory>
#include <QMap> #include <QMap>
#include <QSettings> #include <QSettings>
#include <boost/scoped_ptr.hpp>
#include "core/globalshortcuts.h" #include "core/globalshortcuts.h"
#include "ui/settingspage.h" #include "ui/settingspage.h"
@ -64,7 +64,7 @@ private:
Ui_GlobalShortcutsSettingsPage* ui_; Ui_GlobalShortcutsSettingsPage* ui_;
bool initialised_; bool initialised_;
boost::scoped_ptr<GlobalShortcutGrabber> grabber_; std::unique_ptr<GlobalShortcutGrabber> grabber_;
QSettings settings_; QSettings settings_;
QMap<QString, Shortcut> shortcuts_; QMap<QString, Shortcut> shortcuts_;

View File

@ -18,14 +18,13 @@
#ifndef MACSYSTEMTRAYICON_H #ifndef MACSYSTEMTRAYICON_H
#define MACSYSTEMTRAYICON_H #define MACSYSTEMTRAYICON_H
#include "systemtrayicon.h" #include <memory>
#include <boost/noncopyable.hpp> #include "systemtrayicon.h"
#include <boost/scoped_ptr.hpp>
class MacSystemTrayIconPrivate; class MacSystemTrayIconPrivate;
class MacSystemTrayIcon : public SystemTrayIcon, boost::noncopyable { class MacSystemTrayIcon : public SystemTrayIcon {
Q_OBJECT Q_OBJECT
public: public:
@ -52,8 +51,8 @@ protected:
private: private:
QPixmap orange_icon_; QPixmap orange_icon_;
QPixmap grey_icon_; QPixmap grey_icon_;
std::unique_ptr<MacSystemTrayIconPrivate> p_;
boost::scoped_ptr<MacSystemTrayIconPrivate> p_; Q_DISABLE_COPY(MacSystemTrayIcon);
}; };
#endif // MACSYSTEMTRAYICON_H #endif // MACSYSTEMTRAYICON_H

View File

@ -56,7 +56,7 @@
} }
@end @end
class MacSystemTrayIconPrivate : boost::noncopyable { class MacSystemTrayIconPrivate {
public: public:
MacSystemTrayIconPrivate() { MacSystemTrayIconPrivate() {
dock_menu_ = [[NSMenu alloc] initWithTitle:@"DockMenu"]; dock_menu_ = [[NSMenu alloc] initWithTitle:@"DockMenu"];
@ -159,6 +159,8 @@ class MacSystemTrayIconPrivate : boost::noncopyable {
NSMenuItem* now_playing_; NSMenuItem* now_playing_;
NSMenuItem* now_playing_artist_; NSMenuItem* now_playing_artist_;
NSMenuItem* now_playing_title_; NSMenuItem* now_playing_title_;
Q_DISABLE_COPY(MacSystemTrayIconPrivate);
}; };
MacSystemTrayIcon::MacSystemTrayIcon(QObject* parent) MacSystemTrayIcon::MacSystemTrayIcon(QObject* parent)

View File

@ -17,6 +17,33 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include <cmath>
#include <memory>
#include <QCloseEvent>
#include <QDir>
#include <QFileDialog>
#include <QFileSystemModel>
#include <QLinearGradient>
#include <QMenu>
#include <QMessageBox>
#include <QSettings>
#include <QShortcut>
#include <QSignalMapper>
#include <QSortFilterProxyModel>
#include <QStatusBar>
#include <QtDebug>
#include <QTimer>
#include <QUndoStack>
#ifdef Q_OS_WIN32
# include <qtsparkle/Updater>
#endif
#include <gst/cdda/gstcddabasesrc.h>
#include "core/appearance.h" #include "core/appearance.h"
#include "core/application.h" #include "core/application.h"
#include "core/backgroundstreams.h" #include "core/backgroundstreams.h"
@ -122,34 +149,6 @@
# include "moodbar/moodbarproxystyle.h" # include "moodbar/moodbarproxystyle.h"
#endif #endif
#include <QCloseEvent>
#include <QDir>
#include <QFileDialog>
#include <QFileSystemModel>
#include <QLinearGradient>
#include <QMenu>
#include <QMessageBox>
#include <QSettings>
#include <QShortcut>
#include <QSignalMapper>
#include <QSortFilterProxyModel>
#include <QStatusBar>
#include <QtDebug>
#include <QTimer>
#include <QUndoStack>
#ifdef Q_OS_WIN32
# include <qtsparkle/Updater>
#endif
#include <cmath>
#include <gst/cdda/gstcddabasesrc.h>
using boost::shared_ptr;
using boost::scoped_ptr;
#ifdef Q_OS_DARWIN #ifdef Q_OS_DARWIN
// Non exported mac-specific function. // Non exported mac-specific function.
void qt_mac_set_dock_menu(QMenu*); void qt_mac_set_dock_menu(QMenu*);
@ -180,18 +179,8 @@ MainWindow::MainWindow(Application* app,
device_view_(device_view_container_->view()), device_view_(device_view_container_->view()),
song_info_view_(new SongInfoView(this)), song_info_view_(new SongInfoView(this)),
artist_info_view_(new ArtistInfoView(this)), artist_info_view_(new ArtistInfoView(this)),
settings_dialog_(NULL),
cover_manager_(NULL),
equalizer_(new Equalizer), equalizer_(new Equalizer),
error_dialog_(NULL),
organise_dialog_(new OrganiseDialog(app_->task_manager())), 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_menu_(new QMenu(this)),
playlist_add_to_another_(NULL), playlist_add_to_another_(NULL),
playlistitem_actions_separator_(NULL), playlistitem_actions_separator_(NULL),
@ -1962,7 +1951,7 @@ void MainWindow::PlaylistDelete() {
QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
return; return;
boost::shared_ptr<MusicStorage> storage(new FilesystemMusicStorage("/")); std::shared_ptr<MusicStorage> storage(new FilesystemMusicStorage("/"));
// Get selected songs // Get selected songs
SongList selected_songs; SongList selected_songs;

Some files were not shown because too many files have changed in this diff Show More