Use c++11 instead of boost where possible.

This commit is contained in:
John Maguire 2014-02-06 14:48:00 +01:00
parent 2649a452de
commit 8424c18516
39 changed files with 356 additions and 332 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

@ -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_;
}; };
@ -202,7 +201,7 @@ _detail::ClosureBase* NewClosure(
const char* signal, const char* signal,
std::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;
@ -528,7 +526,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;
@ -589,7 +587,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;
@ -645,7 +643,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;
@ -747,7 +745,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();
} }
@ -844,7 +842,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

@ -47,7 +47,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

@ -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

@ -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

@ -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,11 +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 <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@ -27,13 +25,18 @@
#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"
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 QStringList& files, bool eject_after) const QStringList& files, bool eject_after)
: thread_(NULL), : thread_(NULL),
@ -188,8 +191,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.filename_; files_with_errors_ << task.filename_;

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"
@ -35,7 +35,7 @@ class Organise : public QObject {
public: public:
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 QStringList& files, bool eject_after); const QStringList& files, bool eject_after);
@ -78,7 +78,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,14 @@
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 <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 +37,7 @@
# include "internet/lastfmservice.h" # include "internet/lastfmservice.h"
#endif #endif
#include <QtDebug> 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

@ -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>
@ -48,6 +49,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;
@ -229,7 +231,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;
} }
@ -252,7 +254,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;
} }
@ -455,8 +457,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;
@ -131,7 +131,7 @@ private:
QByteArray buffer_; QByteArray buffer_;
LibraryBackendInterface* library_; LibraryBackendInterface* library_;
boost::shared_ptr<GstElement> pipeline_; std::shared_ptr<GstElement> pipeline_;
QThreadPool thread_pool_; QThreadPool thread_pool_;
}; };

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

@ -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

@ -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>
@ -49,9 +40,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

@ -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

@ -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

@ -38,7 +38,7 @@ void LibraryDirectoryModel::DirectoryDiscovered(const Directory &dir) {
QStandardItem* item = new QStandardItem(dir.path); QStandardItem* item = new QStandardItem(dir.path);
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

@ -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;
@ -1079,7 +1083,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

@ -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

@ -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
@ -438,7 +437,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

@ -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"
@ -48,36 +67,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";
@ -1264,7 +1262,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));
} }
@ -1811,8 +1809,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

@ -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

@ -90,9 +90,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

@ -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;
@ -541,7 +541,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"
@ -138,7 +137,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

@ -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"
@ -118,34 +145,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*);
@ -1909,7 +1908,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;

View File

@ -15,13 +15,10 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "iconloader.h"
#include "organisedialog.h" #include "organisedialog.h"
#include "organiseerrordialog.h"
#include "ui_organisedialog.h" #include "ui_organisedialog.h"
#include "core/musicstorage.h"
#include "core/organise.h" #include <memory>
#include "core/tagreaderclient.h"
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@ -32,6 +29,12 @@
#include <QSignalMapper> #include <QSignalMapper>
#include <QtDebug> #include <QtDebug>
#include "iconloader.h"
#include "organiseerrordialog.h"
#include "core/musicstorage.h"
#include "core/organise.h"
#include "core/tagreaderclient.h"
const int OrganiseDialog::kNumberOfPreviews = 10; const int OrganiseDialog::kNumberOfPreviews = 10;
const char* OrganiseDialog::kDefaultFormat = const char* OrganiseDialog::kDefaultFormat =
"%artist/%album{ (Disc %disc)}/{%track - }%title.%extension"; "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension";
@ -192,12 +195,12 @@ void OrganiseDialog::InsertTag(const QString &tag) {
void OrganiseDialog::UpdatePreviews() { void OrganiseDialog::UpdatePreviews() {
const QModelIndex destination = ui_->destination->model()->index( const QModelIndex destination = ui_->destination->model()->index(
ui_->destination->currentIndex(), 0); ui_->destination->currentIndex(), 0);
boost::shared_ptr<MusicStorage> storage; std::shared_ptr<MusicStorage> storage;
bool has_local_destination = false; bool has_local_destination = false;
if (destination.isValid()) { if (destination.isValid()) {
storage = destination.data(MusicStorage::Role_Storage) storage = destination.data(MusicStorage::Role_Storage)
.value<boost::shared_ptr<MusicStorage> >(); .value<std::shared_ptr<MusicStorage>>();
if (storage) { if (storage) {
has_local_destination = !storage->LocalPath().isEmpty(); has_local_destination = !storage->LocalPath().isEmpty();
} }
@ -294,9 +297,9 @@ void OrganiseDialog::accept() {
const QModelIndex destination = ui_->destination->model()->index( const QModelIndex destination = ui_->destination->model()->index(
ui_->destination->currentIndex(), 0); ui_->destination->currentIndex(), 0);
boost::shared_ptr<MusicStorage> storage = std::shared_ptr<MusicStorage> storage =
destination.data(MusicStorage::Role_StorageForceConnect) destination.data(MusicStorage::Role_StorageForceConnect)
.value<boost::shared_ptr<MusicStorage> >(); .value<std::shared_ptr<MusicStorage>>();
if (!storage) if (!storage)
return; return;

View File

@ -18,13 +18,13 @@
#ifndef FILEVIEW_H #ifndef FILEVIEW_H
#define FILEVIEW_H #define FILEVIEW_H
#include <memory>
#include <QWidget> #include <QWidget>
#include <QUndoCommand> #include <QUndoCommand>
#include <QUrl> #include <QUrl>
#include <QModelIndex> #include <QModelIndex>
#include <boost/shared_ptr.hpp>
#include "core/song.h" #include "core/song.h"
class FilesystemMusicStorage; class FilesystemMusicStorage;
@ -102,7 +102,7 @@ class FileView : public QWidget {
QUndoStack* undo_stack_; QUndoStack* undo_stack_;
TaskManager* task_manager_; TaskManager* task_manager_;
boost::shared_ptr<MusicStorage> storage_; std::shared_ptr<MusicStorage> storage_;
QString lazy_set_path_; QString lazy_set_path_;