From a45296d414e98e5408df05d5bfc6f385a83c14c4 Mon Sep 17 00:00:00 2001 From: Andreas Date: Tue, 3 Dec 2013 12:19:46 +0100 Subject: [PATCH 01/23] Send only songs from library which are available. (cherry picked from commit b5ba1164afe46ef783ef184b54149d982ecf921c) --- src/networkremote/outgoingdatacreator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index 4d85fdc34..bf9884460 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -726,7 +726,7 @@ void OutgoingDataCreator::SendLibrary(RemoteClient *client) { app_->database()->AttachDatabaseOnDbConnection("songs_export", adb, db); // Copy the content of the song table to this temporary database - QSqlQuery q(QString("create table songs_export.songs as SELECT * FROM songs;"), db); + QSqlQuery q(QString("create table songs_export.songs as SELECT * FROM songs where unavailable = 0;"), db); if (app_->database()->CheckErrors(q)) return; From 313ecbc7837d57b4d333c049dfcfa1a34872025b Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 5 Dec 2013 16:20:59 +0100 Subject: [PATCH 02/23] Read urls correctly when inserting into playlist. Fixes issue 4003. (cherry picked from commit 3122593ab496de11979392e79852d40f298d09ac) --- src/networkremote/incomingdataparser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/networkremote/incomingdataparser.cpp b/src/networkremote/incomingdataparser.cpp index 2d6919dbe..83af30466 100644 --- a/src/networkremote/incomingdataparser.cpp +++ b/src/networkremote/incomingdataparser.cpp @@ -249,7 +249,8 @@ void IncomingDataParser::InsertUrls(const pb::remote::Message& msg) { // Extract urls QList urls; for (auto it = request.urls().begin(); it != request.urls().end(); ++it) { - urls << QUrl(QString::fromStdString(*it)); + std::string s = *it; + urls << QUrl(QStringFromStdString(s)); } // Insert the urls From 3a8a88972fd0d27c3568071654f4eeead0ebcfac Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 29 Nov 2013 13:59:48 +0100 Subject: [PATCH 03/23] Calculate chunkcount with the real file size, not the size saved in the database (might be wrong and results in corrupted download). (cherry picked from commit 42d9a86ff09a42d0a70615e1fd7abe32d645c237) --- src/networkremote/outgoingdatacreator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index bf9884460..a4ef55c1c 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -628,10 +628,6 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song, if (!(song.url().scheme() == "file")) return; - // Calculate the number of chunks - int chunk_count = qRound((song.filesize() / kFileChunkSize) + 0.5); - int chunk_number = 1; - // Open the file QFile file(song.url().toLocalFile()); file.open(QIODevice::ReadOnly); @@ -643,6 +639,10 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song, QImage null_image; + // Calculate the number of chunks + int chunk_count = qRound((file.size() / kFileChunkSize) + 0.5); + int chunk_number = 1; + while (!file.atEnd()) { // Read file chunk data = file.read(kFileChunkSize); From ebcfd7e5d5a9fd9bbe340f2e6533a7c1b6baf4c5 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 8 Dec 2013 20:19:25 +0100 Subject: [PATCH 04/23] Check if track position is valid before sending. Bump protocol version. (cherry picked from commit 03a41450823bf91365339dcf79f6749ea093f98a) --- ext/libclementine-remote/remotecontrolmessages.proto | 2 +- src/networkremote/outgoingdatacreator.cpp | 7 ++++++- src/networkremote/outgoingdatacreator.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/libclementine-remote/remotecontrolmessages.proto b/ext/libclementine-remote/remotecontrolmessages.proto index cbce974ae..5501402ca 100644 --- a/ext/libclementine-remote/remotecontrolmessages.proto +++ b/ext/libclementine-remote/remotecontrolmessages.proto @@ -276,7 +276,7 @@ message RequestRateSong { // The message itself message Message { - optional int32 version = 1 [default=12]; + optional int32 version = 1 [default=13]; optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message? optional RequestConnect request_connect = 21; diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index a4ef55c1c..ce28beb4a 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -509,11 +509,16 @@ void OutgoingDataCreator::UpdateTrackPosition() { pb::remote::Message msg; msg.set_type(pb::remote::UPDATE_TRACK_POSITION); - const int position = std::floor( + int position = std::floor( float(app_->player()->engine()->position_nanosec()) / kNsecPerSec + 0.5); + if (app_->player()->engine()->position_nanosec() > current_song_.length_nanosec()) + position = last_track_position_; + msg.mutable_response_update_track_position()->set_position(position); + last_track_position_ = position; + SendDataToClients(&msg); } diff --git a/src/networkremote/outgoingdatacreator.h b/src/networkremote/outgoingdatacreator.h index cddabca43..270835a0e 100644 --- a/src/networkremote/outgoingdatacreator.h +++ b/src/networkremote/outgoingdatacreator.h @@ -85,6 +85,7 @@ private: QTimer* track_position_timer_; int keep_alive_timeout_; QMap > download_queue_; + int last_track_position_; boost::scoped_ptr ultimate_reader_; ProviderList provider_list_; From bdced17a577b11f4dbcd937397864afb416f31bf Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 2 Feb 2014 09:21:31 +0000 Subject: [PATCH 05/23] Namespace clementine's 3rdparty implementation of sha2 to prevent its symbols conflicting with the system's openssl symbols with the same names. This was causing SSL connections to fail in weird ways on Debian. Fixes #4130. (cherry picked from commit 96075faf88bf65ed7b94985f98228a2d0974a437) --- 3rdparty/sha2/CMakeLists.txt | 2 +- 3rdparty/sha2/{sha2.c => sha2.cpp} | 3 + 3rdparty/sha2/sha2.h | 121 ++++------------------------- src/core/utilities.cpp | 14 ++-- 4 files changed, 26 insertions(+), 114 deletions(-) rename 3rdparty/sha2/{sha2.c => sha2.cpp} (99%) diff --git a/3rdparty/sha2/CMakeLists.txt b/3rdparty/sha2/CMakeLists.txt index 9befb1ecd..3a5da0a2f 100644 --- a/3rdparty/sha2/CMakeLists.txt +++ b/3rdparty/sha2/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.6) -add_library(sha2 STATIC sha2.c) +add_library(sha2 STATIC sha2.cpp) diff --git a/3rdparty/sha2/sha2.c b/3rdparty/sha2/sha2.cpp similarity index 99% rename from 3rdparty/sha2/sha2.c rename to 3rdparty/sha2/sha2.cpp index 7ad5ea666..36be426a9 100644 --- a/3rdparty/sha2/sha2.c +++ b/3rdparty/sha2/sha2.cpp @@ -92,6 +92,8 @@ #error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN #endif +namespace clementine_sha2 { + /* * Define the followingsha2_* types to types of the correct length on * the native archtecture. Most BSD systems and Linux define u_intXX_t @@ -1066,3 +1068,4 @@ char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_S return SHA384_End(&context, digest); } +} // namespace clementine_sha2 diff --git a/3rdparty/sha2/sha2.h b/3rdparty/sha2/sha2.h index e8413e549..6f2335511 100644 --- a/3rdparty/sha2/sha2.h +++ b/3rdparty/sha2/sha2.h @@ -32,13 +32,8 @@ * $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ */ -#ifndef __SHA2_H__ -#define __SHA2_H__ - -#ifdef __cplusplus -extern "C" { -#endif - +#ifndef __CLEMENTINE_SHA2_H__ +#define __CLEMENTINE_SHA2_H__ /* * Import u_intXX_t size_t type definitions from system headers. You @@ -47,23 +42,18 @@ extern "C" { */ #include -#ifdef SHA2_USE_INTTYPES_H - -#include - -#endif /* SHA2_USE_INTTYPES_H */ - +namespace clementine_sha2 { /*** SHA-256/384/512 Various Length Definitions ***********************/ -#define SHA256_BLOCK_LENGTH 64 -#define SHA256_DIGEST_LENGTH 32 -#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) -#define SHA384_BLOCK_LENGTH 128 -#define SHA384_DIGEST_LENGTH 48 -#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) -#define SHA512_BLOCK_LENGTH 128 -#define SHA512_DIGEST_LENGTH 64 -#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) +static const int SHA256_BLOCK_LENGTH = 64; +static const int SHA256_DIGEST_LENGTH = 32; +static const int SHA256_DIGEST_STRING_LENGTH = (SHA256_DIGEST_LENGTH * 2 + 1); +static const int SHA384_BLOCK_LENGTH = 128; +static const int SHA384_DIGEST_LENGTH = 48; +static const int SHA384_DIGEST_STRING_LENGTH = (SHA384_DIGEST_LENGTH * 2 + 1); +static const int SHA512_BLOCK_LENGTH = 128; +static const int SHA512_DIGEST_LENGTH = 64; +static const int SHA512_DIGEST_STRING_LENGTH = (SHA512_DIGEST_LENGTH * 2 + 1); /*** SHA-256/384/512 Context Structures *******************************/ @@ -76,36 +66,6 @@ typedef unsigned char u_int8_t; /* 1-byte (8-bits) */ typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */ typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */ #endif -/* - * Most BSD systems already define u_intXX_t types, as does Linux. - * Some systems, however, like Compaq's Tru64 Unix instead can use - * uintXX_t types defined by very recent ANSI C standards and included - * in the file: - * - * #include - * - * If you choose to use then please define: - * - * #define SHA2_USE_INTTYPES_H - * - * Or on the command line during compile: - * - * cc -DSHA2_USE_INTTYPES_H ... - */ -#ifdef SHA2_USE_INTTYPES_H - -typedef struct _SHA256_CTX { - uint32_t state[8]; - uint64_t bitcount; - uint8_t buffer[SHA256_BLOCK_LENGTH]; -} SHA256_CTX; -typedef struct _SHA512_CTX { - uint64_t state[8]; - uint64_t bitcount[2]; - uint8_t buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; - -#else /* SHA2_USE_INTTYPES_H */ typedef struct _SHA256_CTX { u_int32_t state[8]; @@ -118,35 +78,9 @@ typedef struct _SHA512_CTX { u_int8_t buffer[SHA512_BLOCK_LENGTH]; } SHA512_CTX; -#endif /* SHA2_USE_INTTYPES_H */ - typedef SHA512_CTX SHA384_CTX; -/*** SHA-256/384/512 Function Prototypes ******************************/ -#ifndef NOPROTO -#ifdef SHA2_USE_INTTYPES_H - -void SHA256_Init(SHA256_CTX *); -void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); -void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); -char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); -char* SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); - -void SHA384_Init(SHA384_CTX*); -void SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); -void SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); -char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); -char* SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); - -void SHA512_Init(SHA512_CTX*); -void SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); -void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); -char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); -char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); - -#else /* SHA2_USE_INTTYPES_H */ - void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX*, const u_int8_t*, size_t); void SHA256_Final(u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); @@ -165,33 +99,6 @@ void SHA512_Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); char* SHA512_Data(const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); -#endif /* SHA2_USE_INTTYPES_H */ - -#else /* NOPROTO */ - -void SHA256_Init(); -void SHA256_Update(); -void SHA256_Final(); -char* SHA256_End(); -char* SHA256_Data(); - -void SHA384_Init(); -void SHA384_Update(); -void SHA384_Final(); -char* SHA384_End(); -char* SHA384_Data(); - -void SHA512_Init(); -void SHA512_Update(); -void SHA512_Final(); -char* SHA512_End(); -char* SHA512_Data(); - -#endif /* NOPROTO */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __SHA2_H__ */ +} // namespace clementine_sha2 +#endif /* __CLEMENTINE_SHA2_H__ */ diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 3fdc6be48..5d60baeb7 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -437,13 +437,15 @@ QByteArray HmacSha1(const QByteArray& key, const QByteArray& data) { } QByteArray Sha256(const QByteArray& data) { - SHA256_CTX context; - SHA256_Init(&context); - SHA256_Update(&context, reinterpret_cast(data.constData()), - data.length()); + clementine_sha2::SHA256_CTX context; + clementine_sha2::SHA256_Init(&context); + clementine_sha2::SHA256_Update( + &context, reinterpret_cast(data.constData()), + data.length()); - QByteArray ret(SHA256_DIGEST_LENGTH, '\0'); - SHA256_Final(reinterpret_cast(ret.data()), &context); + QByteArray ret(clementine_sha2::SHA256_DIGEST_LENGTH, '\0'); + clementine_sha2::SHA256_Final( + reinterpret_cast(ret.data()), &context); return ret; } From 29da0351398765fd71aa3cc8dd409a06415a30a0 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Tue, 4 Feb 2014 11:48:07 +0100 Subject: [PATCH 06/23] Set version number for 1.2.2 --- cmake/Version.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 69347e238..0fbf47e49 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -3,11 +3,11 @@ # Version numbers. set(CLEMENTINE_VERSION_MAJOR 1) set(CLEMENTINE_VERSION_MINOR 2) -set(CLEMENTINE_VERSION_PATCH 1) +set(CLEMENTINE_VERSION_PATCH 2) # set(CLEMENTINE_VERSION_PRERELEASE rc4) # This should be set to OFF in a release branch -# set(INCLUDE_GIT_REVISION ON) +set(INCLUDE_GIT_REVISION OFF) # Rules about version number comparison on different platforms: # Debian: From b40d834c8c81178421ae3e1253b032e124fddc51 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 27 Jan 2014 15:38:37 +0100 Subject: [PATCH 07/23] Rename SkyDrive to OneDrive. http://blog.onedrive.com/onedrive-for-everything-your-life/ (cherry picked from commit 977a6769b27895d4b296aa79151624fa7b863c80) --- src/internet/skydriveservice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internet/skydriveservice.cpp b/src/internet/skydriveservice.cpp index 8b9fd29a9..55d067865 100644 --- a/src/internet/skydriveservice.cpp +++ b/src/internet/skydriveservice.cpp @@ -13,7 +13,7 @@ using boost::scoped_ptr; namespace { -static const char* kServiceName = "Skydrive"; +static const char* kServiceName = "OneDrive"; static const char* kServiceId = "skydrive"; static const char* kSettingsGroup = "Skydrive"; From ce0eb1b50fb72a1ec287f5f483aff2cda00c607f Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 28 Oct 2013 17:39:18 +0100 Subject: [PATCH 08/23] D'oh (cherry picked from commit 981bbdce72debfe986587f6bf1044a764ac43e1d) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 40b825ed2..8c0e9542d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) { // This must go before QApplication initialisation. mac::MacMain(); - if (!QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) { + if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) { // Work around 10.9 issue. // https://bugreports.qt-project.org/browse/QTBUG-32789 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); From 7983343e50f17a95e69712ce920e3d10cd548917 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 19 Dec 2013 14:31:23 +0100 Subject: [PATCH 09/23] Update Skydrive client id & secret for redirect url change. Fixes #4013 (cherry picked from commit f583c40ffa3498dc36bf750012b6ae2aa310d6f4) --- src/internet/skydriveservice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internet/skydriveservice.cpp b/src/internet/skydriveservice.cpp index 55d067865..0de877394 100644 --- a/src/internet/skydriveservice.cpp +++ b/src/internet/skydriveservice.cpp @@ -17,8 +17,8 @@ static const char* kServiceName = "OneDrive"; static const char* kServiceId = "skydrive"; static const char* kSettingsGroup = "Skydrive"; -static const char* kClientId = "00000000400E7C78"; -static const char* kClientSecret = "B0KLZjEgC5SpW0KknrsBFwlaKmGThaAk"; +static const char* kClientId = "0000000040111F16"; +static const char* kClientSecret = "w2ClguSX0jG56cBl1CeUniypTBRjXt2Z"; static const char* kOAuthEndpoint = "https://login.live.com/oauth20_authorize.srf"; From d88d0d420e041a5a520902493e60b443cbec451b Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 22 Dec 2013 15:16:42 +0100 Subject: [PATCH 10/23] Androids like kittens, too (cherry picked from commit 00fd9b4724c0a35937a89b4c14d8c1fbeb549615) --- src/networkremote/networkremote.cpp | 10 ++++++ src/networkremote/networkremote.h | 2 ++ src/networkremote/outgoingdatacreator.cpp | 44 ++++++++++++++++------- src/networkremote/outgoingdatacreator.h | 4 +++ src/ui/mainwindow.cpp | 2 ++ src/widgets/nowplayingwidget.cpp | 2 ++ 6 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/networkremote/networkremote.cpp b/src/networkremote/networkremote.cpp index 4728ff3f1..38aa955fd 100644 --- a/src/networkremote/networkremote.cpp +++ b/src/networkremote/networkremote.cpp @@ -217,3 +217,13 @@ void NetworkRemote::CreateRemoteClient(QTcpSocket* client_socket) { incoming_data_parser_.get(), SLOT(Parse(pb::remote::Message))); } } + +void NetworkRemote::EnableKittens(bool aww) { + if (outgoing_data_creator_.get()) + outgoing_data_creator_->EnableKittens(aww); +} + +void NetworkRemote::SendKitten(quint64 id, const QImage &kitten) { + if (outgoing_data_creator_.get()) + outgoing_data_creator_->SendKitten(kitten); +} diff --git a/src/networkremote/networkremote.h b/src/networkremote/networkremote.h index 60b85e8d1..5de164eb3 100644 --- a/src/networkremote/networkremote.h +++ b/src/networkremote/networkremote.h @@ -26,6 +26,8 @@ public slots: void StartServer(); void ReloadSettings(); void AcceptConnection(); + void EnableKittens(bool aww); + void SendKitten(quint64 id, const QImage& kitten); private: boost::scoped_ptr server_; diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index ce28beb4a..0c1fab7e6 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -33,6 +33,7 @@ const quint32 OutgoingDataCreator::kFileChunkSize = 100000; // in Bytes OutgoingDataCreator::OutgoingDataCreator(Application* app) : app_(app), + aww_(false), ultimate_reader_(new UltimateLyricsReader(this)), fetcher_(new SongInfoFetcher(this)) { @@ -314,21 +315,26 @@ void OutgoingDataCreator::SendFirstData(bool send_playlist_songs) { void OutgoingDataCreator::CurrentSongChanged(const Song& song, const QString& uri, const QImage& img) { current_song_ = song; current_uri_ = uri; - current_image_ = img; - if (!clients_->empty()) { - // Create the message - pb::remote::Message msg; - msg.set_type(pb::remote::CURRENT_METAINFO); - - // If there is no song, create an empty node, otherwise fill it with data - int i = app_->playlist_manager()->active()->current_row(); - CreateSong( - current_song_, img, i, - msg.mutable_response_current_metadata()->mutable_song_metadata()); - - SendDataToClients(&msg); + if (!aww_) { + current_image_ = img; } + + SendSongMetadata(); +} + +void OutgoingDataCreator::SendSongMetadata() { + // Create the message + pb::remote::Message msg; + msg.set_type(pb::remote::CURRENT_METAINFO); + + // If there is no song, create an empty node, otherwise fill it with data + int i = app_->playlist_manager()->active()->current_row(); + CreateSong( + current_song_, current_image_, i, + msg.mutable_response_current_metadata()->mutable_song_metadata()); + + SendDataToClients(&msg); } void OutgoingDataCreator::CreateSong( @@ -774,3 +780,15 @@ void OutgoingDataCreator::SendLibrary(RemoteClient *client) { // Remove temporary file file.remove(); } + +void OutgoingDataCreator::EnableKittens(bool aww) { + aww_ = aww; +} + +void OutgoingDataCreator::SendKitten(const QImage& kitten) { + if (aww_) { + current_image_ = kitten; + SendSongMetadata(); + } +} + diff --git a/src/networkremote/outgoingdatacreator.h b/src/networkremote/outgoingdatacreator.h index 270835a0e..264da2add 100644 --- a/src/networkremote/outgoingdatacreator.h +++ b/src/networkremote/outgoingdatacreator.h @@ -62,6 +62,7 @@ public slots: void PlaylistRenamed(int id, const QString& new_name); void ActiveChanged(Playlist*); void CurrentSongChanged(const Song& song, const QString& uri, const QImage& img); + void SendSongMetadata(); void StateChanged(Engine::State); void SendKeepAlive(); void SendRepeatMode(PlaylistSequence::RepeatMode mode); @@ -73,6 +74,8 @@ public slots: void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client); void ResponseSongOffer(RemoteClient* client, bool accepted); void SendLibrary(RemoteClient* client); + void EnableKittens(bool aww); + void SendKitten(const QImage& kitten); private: Application* app_; @@ -86,6 +89,7 @@ private: int keep_alive_timeout_; QMap > download_queue_; int last_track_position_; + bool aww_; boost::scoped_ptr ultimate_reader_; ProviderList provider_list_; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index b4edfb485..1aa3bc0a9 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -58,6 +58,7 @@ #include "library/libraryfilterwidget.h" #include "library/libraryviewcontainer.h" #include "musicbrainz/tagfetcher.h" +#include "networkremote/networkremote.h" #include "playlist/playlistbackend.h" #include "playlist/playlist.h" #include "playlist/playlistlistcontainer.h" @@ -670,6 +671,7 @@ MainWindow::MainWindow(Application* app, SLOT(NowPlayingWidgetPositionChanged(bool))); connect(ui_->action_hypnotoad, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(AllHail(bool))); connect(ui_->action_kittens, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(EnableKittens(bool))); + connect(ui_->action_kittens, SIGNAL(toggled(bool)), app_->network_remote(), SLOT(EnableKittens(bool))); // Hide the console //connect(ui_->action_console, SIGNAL(triggered()), SLOT(ShowConsole())); NowPlayingWidgetPositionChanged(ui_->now_playing->show_above_status_bar()); diff --git a/src/widgets/nowplayingwidget.cpp b/src/widgets/nowplayingwidget.cpp index 5b06a8563..29d81eb6f 100644 --- a/src/widgets/nowplayingwidget.cpp +++ b/src/widgets/nowplayingwidget.cpp @@ -23,6 +23,7 @@ #include "covers/currentartloader.h" #include "covers/kittenloader.h" #include "library/librarybackend.h" +#include "networkremote/networkremote.h" #include "ui/albumcoverchoicecontroller.h" #include "ui/iconloader.h" @@ -423,6 +424,7 @@ void NowPlayingWidget::EnableKittens(bool aww) { kittens_ = new KittenLoader(this); app_->MoveToNewThread(kittens_); connect(kittens_, SIGNAL(ImageLoaded(quint64,QImage)), SLOT(KittenLoaded(quint64,QImage))); + connect(kittens_, SIGNAL(ImageLoaded(quint64,QImage)), app_->network_remote(), SLOT(SendKitten(quint64,QImage))); } aww_ = aww; From 9acd2e59c2a3c4c6daab6e65fe0cbedfa0fdae9a Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 30 Jan 2014 11:50:52 +0100 Subject: [PATCH 11/23] Do not log IP address from network remote settings. (cherry picked from commit 0a778e2901f933836dbf9b9d3ea75879de9826fa) --- src/ui/networkremotesettingspage.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ui/networkremotesettingspage.cpp b/src/ui/networkremotesettingspage.cpp index f08729ffb..09221becf 100644 --- a/src/ui/networkremotesettingspage.cpp +++ b/src/ui/networkremotesettingspage.cpp @@ -79,7 +79,6 @@ void NetworkRemoteSettingsPage::Load() { // TODO: Add ipv6 support to tinysvcmdns. if (address.protocol() == QAbstractSocket::IPv4Protocol && !address.isInSubnet(QHostAddress::parseSubnet("127.0.0.1/8"))) { - qLog(Debug) << "IP:" << address.toString(); if (!ip_addresses.isEmpty()) { ip_addresses.append(", "); } From 73ac5bc1ee5d205db575ae8f05b3cdf00b2dda25 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Tue, 28 Jan 2014 14:54:52 +0100 Subject: [PATCH 12/23] Print out the Clementine display version in the cmake summary. (cherry picked from commit 9858a9d5068216bc8a42f4f69a92cb44c3bd0c15) --- cmake/Summary.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/Summary.cmake b/cmake/Summary.cmake index 55e511e98..4202741aa 100644 --- a/cmake/Summary.cmake +++ b/cmake/Summary.cmake @@ -25,6 +25,8 @@ endmacro(summary_show_part) macro(summary_show) list(SORT summary_willbuild) list(SORT summary_willnotbuild) + message("") + message("Building Clementine version: ${CLEMENTINE_VERSION_DISPLAY}") summary_show_part(summary_willbuild "The following components will be built:") summary_show_part(summary_willnotbuild "The following components WILL NOT be built:") message("") From 6a7a3a7f5bc67fae4e801794fc7c2a3521c1f236 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Tue, 4 Feb 2014 22:14:13 +1100 Subject: [PATCH 13/23] Update the changelog for 1.2.2 --- Changelog | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Changelog b/Changelog index 9b52e8999..d53d8d933 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,18 @@ +Version 1.2.2: + Major features: + * (Android Remote) Add kittens support. + + Bugfixes: + * Rename SkyDrive to OneDrive. + * Don't include the user's IP address in the log (from the network remote + settings dialog). + * (Debian) Fix a bug with HTTPS logins to all cloud storage providers. + * (Mac OS X) Fix a bug in the workaround for a weird font issue on 10.9. + * (Android Remote) Don't advertise songs that aren't available. + * (Android Remote) Fix playing songs with special characters in filenames. + + + Version 1.2.1: Bugfixes: * Fix library download in the network remote. From bf887305103421c5e508ec400211daf5b693c40d Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 27 Jan 2014 16:32:02 +0100 Subject: [PATCH 14/23] Try building on OS X with libc++ (cherry picked from commit 327181ef18fee22e2c05f2e8303efeffdc63cae0) (cherry picked from commit 3e46b6134eb9788b9431f4bb5e4cff570bb79a6c) --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f1693d8..2122d7413 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,10 @@ if (CMAKE_CXX_COMPILER MATCHES ".*clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized") endif () +if (APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") +endif () + set(CMAKE_REQUIRED_FLAGS "-std=c++0x") check_cxx_source_compiles( "#include From b87cd1641b07323dd7b4cdd69d4e309e96e2f297 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 28 Oct 2013 17:30:52 +0100 Subject: [PATCH 15/23] Compile fixes for 10.9 (cherry picked from commit b17b075361ceb9cf31da36db32731881f9fb186e) --- 3rdparty/chromaprint/src/utils.h | 1 + ext/libclementine-common/core/closure.cpp | 4 ++-- ext/libclementine-common/core/closure.h | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/3rdparty/chromaprint/src/utils.h b/3rdparty/chromaprint/src/utils.h index 47c6b9827..76fb2402b 100644 --- a/3rdparty/chromaprint/src/utils.h +++ b/3rdparty/chromaprint/src/utils.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/ext/libclementine-common/core/closure.cpp b/ext/libclementine-common/core/closure.cpp index ccca3bae1..e2c27c13f 100644 --- a/ext/libclementine-common/core/closure.cpp +++ b/ext/libclementine-common/core/closure.cpp @@ -33,7 +33,7 @@ ClosureBase::~ClosureBase() { CallbackClosure::CallbackClosure( QObject* sender, const char* signal, - std::tr1::function callback) + std::function callback) : ClosureBase(new ObjectHelper(sender, signal, this)), callback_(callback) { } @@ -67,7 +67,7 @@ void Unpack(QList*) {} _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - std::tr1::function callback) { + std::function callback) { return new _detail::CallbackClosure( sender, signal, callback); } diff --git a/ext/libclementine-common/core/closure.h b/ext/libclementine-common/core/closure.h index 63ed9936b..2244a4a69 100644 --- a/ext/libclementine-common/core/closure.h +++ b/ext/libclementine-common/core/closure.h @@ -18,7 +18,7 @@ #ifndef CLOSURE_H #define CLOSURE_H -#include +#include #include #include @@ -158,12 +158,12 @@ class CallbackClosure : public ClosureBase { CallbackClosure( QObject* sender, const char* signal, - std::tr1::function callback); + std::function callback); virtual void Invoke(); private: - std::tr1::function callback_; + std::function callback_; }; } // namespace _detail @@ -194,13 +194,13 @@ _detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - std::tr1::function callback); + std::function callback); template _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - std::tr1::function callback, + std::function callback, const Args&... args) { return NewClosure(sender, signal, boost::bind(callback, args...)); } From d36f0536e8202212719b419a8093a2511e16b0f8 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 12 Dec 2013 15:41:55 +0100 Subject: [PATCH 16/23] Fix tautological comparison. (cherry picked from commit 09eeeaab4e5b80628d19ede0586be9ad00be2328) --- src/playlistparsers/plsparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/playlistparsers/plsparser.cpp b/src/playlistparsers/plsparser.cpp index e45f4165e..0c105a89e 100644 --- a/src/playlistparsers/plsparser.cpp +++ b/src/playlistparsers/plsparser.cpp @@ -46,7 +46,7 @@ SongList PLSParser::Load(QIODevice *device, const QString& playlist_path, const // Use the title and length we've already loaded if any if (!songs[n].title().isEmpty()) song.set_title(songs[n].title()); - if (!songs[n].length_nanosec() != -1) + if (songs[n].length_nanosec() != -1) song.set_length_nanosec(songs[n].length_nanosec()); songs[n] = song; From 46565bdf8c56129733a8e440367ff872eeeda24a Mon Sep 17 00:00:00 2001 From: John Maguire Date: Tue, 26 Nov 2013 14:27:30 +0100 Subject: [PATCH 17/23] Remove TIFF plugin support from Mac at least for now. (cherry picked from commit 03e2fc428282bfb02e541f197ffe72921a9819d5) --- dist/macdeploy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dist/macdeploy.py b/dist/macdeploy.py index e054619ea..beceded11 100755 --- a/dist/macdeploy.py +++ b/dist/macdeploy.py @@ -108,7 +108,6 @@ QT_PLUGINS = [ 'imageformats/libqjpeg.dylib', 'imageformats/libqmng.dylib', 'imageformats/libqsvg.dylib', - 'imageformats/libqtiff.dylib', ] QT_PLUGINS_SEARCH_PATH=[ '/target/plugins', From f246eda5a87d11df83c1dc4f9b0a219951a349ff Mon Sep 17 00:00:00 2001 From: John Maguire Date: Tue, 4 Feb 2014 14:10:59 +0100 Subject: [PATCH 18/23] u_int8_t is missing on mingw (cherry picked from commit ddda13ceb7db10c170a8993f7f7ee965d8520e34) --- src/core/utilities.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 5d60baeb7..6c07faa18 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -440,12 +440,12 @@ QByteArray Sha256(const QByteArray& data) { clementine_sha2::SHA256_CTX context; clementine_sha2::SHA256_Init(&context); clementine_sha2::SHA256_Update( - &context, reinterpret_cast(data.constData()), + &context, reinterpret_cast(data.constData()), data.length()); QByteArray ret(clementine_sha2::SHA256_DIGEST_LENGTH, '\0'); clementine_sha2::SHA256_Final( - reinterpret_cast(ret.data()), &context); + reinterpret_cast(ret.data()), &context); return ret; } From 69809d356bfb14723fd909e593445ec658c13cf0 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Tue, 26 Nov 2013 18:52:08 +0100 Subject: [PATCH 19/23] Update DLL list for new version of protobuf (cherry picked from commit 054686226e0e8cbcc1603f4b10f12c6669fc36e4) --- dist/windows/clementine.nsi.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/windows/clementine.nsi.in b/dist/windows/clementine.nsi.in index 750b33201..77314c5fc 100644 --- a/dist/windows/clementine.nsi.in +++ b/dist/windows/clementine.nsi.in @@ -107,6 +107,9 @@ Section "Delete old files" oldfiles ; 1.1 Delete "$INSTDIR\libprotobuf-lite-7.dll" + ; 1.2 + Delete "$INSTDIR\libprotobuf-7.dll" + ; mingw-w64 Delete "$INSTDIR\avcodec-52.dll" Delete "$INSTDIR\avformat-52.dll" @@ -177,7 +180,7 @@ Section "Clementine" Clementine File "liborc-test-0.4-0.dll" File "libplist.dll" File "libpng14-14.dll" - File "libprotobuf-7.dll" + File "libprotobuf-8.dll" File "libqjson.dll" File "libsoup-2.4-1.dll" File "libspeex-1.dll" From cfe6b268bb1d6cbab638cca8c0dcb92ecca08b90 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 10 Jan 2014 16:57:32 +0100 Subject: [PATCH 20/23] Fix rendering of source icons in playlist view on retina OS X 10.9 (cherry picked from commit 1a972e0f3639df3cb1a6a64b65d7a9d3e972f912) --- src/core/mac_startup.mm | 8 ++++++++ src/core/mac_utilities.h | 1 + src/playlist/playlistdelegates.cpp | 27 +++++++++++++++++++-------- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/core/mac_startup.mm b/src/core/mac_startup.mm index d9836377f..4a89677e7 100644 --- a/src/core/mac_startup.mm +++ b/src/core/mac_startup.mm @@ -451,4 +451,12 @@ void EnableFullScreen(const QWidget& main_window) { [window setCollectionBehavior: kFullScreenPrimary]; } +float GetDevicePixelRatio(QWidget* widget) { + NSView* view = reinterpret_cast(widget->winId()); + if ([[view window] respondsToSelector: @selector(backingScaleFactor)]) { + return [[view window] backingScaleFactor]; + } + return 1.0f; +} + } // namespace mac diff --git a/src/core/mac_utilities.h b/src/core/mac_utilities.h index 9ad84e1fb..fadaab0fd 100644 --- a/src/core/mac_utilities.h +++ b/src/core/mac_utilities.h @@ -29,5 +29,6 @@ namespace mac { QKeySequence KeySequenceFromNSEvent(NSEvent* event); void DumpDictionary(CFDictionaryRef dict); +float GetDevicePixelRatio(QWidget* widget); } diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index 752b556eb..b49b46ee3 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -16,13 +16,6 @@ */ #include "playlistdelegates.h" -#include "queue.h" -#include "core/logging.h" -#include "core/player.h" -#include "core/utilities.h" -#include "library/librarybackend.h" -#include "widgets/trackslider.h" -#include "ui/iconloader.h" #include #include @@ -39,6 +32,18 @@ #include #include +#include "queue.h" +#include "core/logging.h" +#include "core/player.h" +#include "core/utilities.h" +#include "library/librarybackend.h" +#include "widgets/trackslider.h" +#include "ui/iconloader.h" + +#ifdef Q_OS_DARWIN +#include "core/mac_utilities.h" +#endif // Q_OS_DARWIN + const int QueuedItemDelegate::kQueueBoxBorder = 1; const int QueuedItemDelegate::kQueueBoxCornerRadius = 3; const int QueuedItemDelegate::kQueueBoxLength = 30; @@ -492,8 +497,14 @@ void SongSourceDelegate::paint( const QUrl& url = index.data().toUrl(); QPixmap pixmap = LookupPixmap(url, option_copy.decorationSize); + float device_pixel_ratio = 1.0f; +#ifdef Q_OS_DARWIN + QWidget* parent_widget = reinterpret_cast(parent()); + device_pixel_ratio = mac::GetDevicePixelRatio(parent_widget); +#endif + // Draw the pixmap in the middle of the rectangle - QRect draw_rect(QPoint(0, 0), option_copy.decorationSize); + QRect draw_rect(QPoint(0, 0), option_copy.decorationSize / device_pixel_ratio); draw_rect.moveCenter(option_copy.rect.center()); painter->drawPixmap(draw_rect, pixmap); From 2649a452decbd799e0f6de5e48fdf2aea68074e3 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 6 Feb 2014 12:07:58 +0100 Subject: [PATCH 21/23] Update changelog for 1.2.2 --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index d53d8d933..188201e22 100644 --- a/Changelog +++ b/Changelog @@ -8,6 +8,7 @@ Version 1.2.2: settings dialog). * (Debian) Fix a bug with HTTPS logins to all cloud storage providers. * (Mac OS X) Fix a bug in the workaround for a weird font issue on 10.9. + * (Mac OS X) Fix rendering of source icons on retina displays. * (Android Remote) Don't advertise songs that aren't available. * (Android Remote) Fix playing songs with special characters in filenames. From 8424c18516d7036facaa42db3b0f50adc4710cf6 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 6 Feb 2014 14:48:00 +0100 Subject: [PATCH 22/23] Use c++11 instead of boost where possible. --- CMakeLists.txt | 18 ------ ext/libclementine-common/core/closure.h | 25 ++++---- ext/libclementine-common/core/concurrentrun.h | 21 ++++--- ext/libclementine-tagreader/fmpsparser.cpp | 11 +++- ext/libclementine-tagreader/tagreader.cpp | 18 +++--- src/CMakeLists.txt | 1 + src/config.h.in | 1 - src/core/deletefiles.cpp | 7 ++- src/core/deletefiles.h | 8 +-- src/core/mergedproxymodel.h | 3 + src/core/musicstorage.h | 10 ++-- src/core/organise.cpp | 19 ++++--- src/core/organise.h | 8 +-- src/core/player.cpp | 16 +++--- src/core/songloader.cpp | 12 ++-- src/core/songloader.h | 10 ++-- src/devices/devicemanager.cpp | 16 +++--- src/devices/devicemanager.h | 11 ++-- src/devices/deviceproperties.cpp | 22 +++---- src/devices/deviceview.cpp | 35 ++++++------ src/devices/giolister.cpp | 16 ++++-- src/engines/gstengine.cpp | 26 ++++----- src/engines/gstengine.h | 18 +++--- src/globalsearch/globalsearchview.cpp | 46 ++++++++------- src/library/groupbydialog.h | 5 ++ src/library/librarydirectorymodel.cpp | 2 +- src/library/librarydirectorymodel.h | 6 +- src/library/librarymodel.cpp | 26 +++++---- src/library/libraryview.cpp | 29 +++++----- src/main.cpp | 33 ++++++----- src/playlist/playlist.cpp | 54 +++++++++--------- src/playlist/playlistbackend.cpp | 42 ++++++++------ src/playlist/playlistbackend.h | 6 +- src/playlist/playlistitem.h | 8 +-- src/transcoder/transcoder.cpp | 8 +-- src/transcoder/transcoder.h | 7 +-- src/ui/mainwindow.cpp | 57 +++++++++---------- src/ui/organisedialog.cpp | 21 ++++--- src/widgets/fileview.h | 6 +- 39 files changed, 356 insertions(+), 332 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2122d7413..38c4cc1f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,24 +20,6 @@ if (APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") endif () -set(CMAKE_REQUIRED_FLAGS "-std=c++0x") -check_cxx_source_compiles( - "#include - int main() { - std::unordered_map m; - return 0; - } - " - USE_STD_UNORDERED_MAP) -check_cxx_source_compiles( - "int main() { - [](){}(); - } - " - HAVE_LAMBDAS) -unset(CMAKE_REQUIRED_FLAGS) - - if (UNIX AND NOT APPLE) set(LINUX 1) endif (UNIX AND NOT APPLE) diff --git a/ext/libclementine-common/core/closure.h b/ext/libclementine-common/core/closure.h index 2244a4a69..bb874d05f 100644 --- a/ext/libclementine-common/core/closure.h +++ b/ext/libclementine-common/core/closure.h @@ -19,22 +19,18 @@ #define CLOSURE_H #include +#include #include #include #include -#include -#include -#include -#include - namespace _detail { class ObjectHelper; // Interface for ObjectHelper to call on signal emission. -class ClosureBase : boost::noncopyable { +class ClosureBase { public: virtual ~ClosureBase(); virtual void Invoke() = 0; @@ -45,6 +41,9 @@ class ClosureBase : boost::noncopyable { protected: explicit ClosureBase(ObjectHelper*); ObjectHelper* helper_; + + private: + Q_DISABLE_COPY(ClosureBase); }; // QObject helper as templated QObjects do not work. @@ -62,7 +61,7 @@ class ObjectHelper : public QObject { void Invoked(); private: - boost::scoped_ptr closure_; + std::unique_ptr closure_; Q_DISABLE_COPY(ObjectHelper); }; @@ -92,8 +91,8 @@ class Closure : public ClosureBase { const char* slot, const Args&... args) : ClosureBase(new ObjectHelper(sender, signal, this)), - // boost::bind is the easiest way to store an argument list. - function_(boost::bind(&Closure::Call, this, args...)), + // std::bind is the easiest way to store an argument list. + function_(std::bind(&Closure::Call, this, args...)), receiver_(receiver) { const QMetaObject* meta_receiver = receiver->metaObject(); QByteArray normalised_slot = QMetaObject::normalizedSignature(slot + 1); @@ -126,7 +125,7 @@ class Closure : public ClosureBase { arg_list.size() > 9 ? arg_list[9] : QGenericArgument()); } - boost::function function_; + std::function function_; QObject* receiver_; QMetaMethod slot_; }; @@ -202,7 +201,7 @@ _detail::ClosureBase* NewClosure( const char* signal, std::function callback, const Args&... args) { - return NewClosure(sender, signal, boost::bind(callback, args...)); + return NewClosure(sender, signal, std::bind(callback, args...)); } template @@ -211,7 +210,7 @@ _detail::ClosureBase* NewClosure( const char* signal, void (*callback)(Args...), const Args&... args) { - return NewClosure(sender, signal, boost::bind(callback, args...)); + return NewClosure(sender, signal, std::bind(callback, args...)); } template @@ -220,7 +219,7 @@ _detail::ClosureBase* NewClosure( const char* signal, T* receiver, Unused (T::*callback)(Args...), const Args&... args) { - return NewClosure(sender, signal, boost::bind(callback, receiver, args...)); + return NewClosure(sender, signal, std::bind(callback, receiver, args...)); } diff --git a/ext/libclementine-common/core/concurrentrun.h b/ext/libclementine-common/core/concurrentrun.h index 119ee083a..58fc05577 100644 --- a/ext/libclementine-common/core/concurrentrun.h +++ b/ext/libclementine-common/core/concurrentrun.h @@ -18,8 +18,7 @@ #ifndef CONCURRENTRUN_H #define CONCURRENTRUN_H -#include -#include +#include #include #include @@ -69,9 +68,9 @@ class ThreadFunctorBase : public QFutureInterface, public QRunnable template class ThreadFunctor : public ThreadFunctorBase { public: - ThreadFunctor(boost::function function, + ThreadFunctor(std::function function, Args... args) - : function_(boost::bind(function, args...)) { + : function_(std::bind(function, args...)) { } virtual void run() { @@ -80,16 +79,16 @@ class ThreadFunctor : public ThreadFunctorBase { } private: - boost::function function_; + std::function function_; }; // Partial specialisation for void return type. template class ThreadFunctor : public ThreadFunctorBase { public: - ThreadFunctor(boost::function function, + ThreadFunctor(std::function function, Args... args) - : function_(boost::bind(function, args...)) { + : function_(std::bind(function, args...)) { } virtual void run() { @@ -98,7 +97,7 @@ class ThreadFunctor : public ThreadFunctorBase { } private: - boost::function function_; + std::function function_; }; @@ -111,7 +110,7 @@ namespace ConcurrentRun { template QFuture Run( QThreadPool* threadpool, - boost::function function) { + std::function function) { return (new ThreadFunctor(function))->Start(threadpool); } @@ -119,7 +118,7 @@ namespace ConcurrentRun { template QFuture Run( QThreadPool* threadpool, - boost::function function, + std::function function, const Args&... args) { return (new ThreadFunctor( function, args...))->Start(threadpool); @@ -132,7 +131,7 @@ namespace ConcurrentRun { ReturnType (*function) (Args...), const Args&... args) { return Run( - threadpool, boost::function(function), args...); + threadpool, std::function(function), args...); } } diff --git a/ext/libclementine-tagreader/fmpsparser.cpp b/ext/libclementine-tagreader/fmpsparser.cpp index 113f9f316..5eca59207 100644 --- a/ext/libclementine-tagreader/fmpsparser.cpp +++ b/ext/libclementine-tagreader/fmpsparser.cpp @@ -17,10 +17,13 @@ #include "fmpsparser.h" +#include + #include #include -#include +using std::placeholders::_1; +using std::placeholders::_2; FMPSParser::FMPSParser() : // The float regex ends with (?:$|(?=::|;;)) to ensure it matches all the way @@ -105,12 +108,14 @@ int FMPSParser::ParseValueRef(const QStringRef& data, QVariant* ret) const { // Parses an inner list - a list of values int FMPSParser::ParseListRef(const QStringRef& data, QVariantList* ret) const { - return ParseContainer<':'>(data, boost::bind(&FMPSParser::ParseValueRef, this, _1, _2), ret); + return ParseContainer<':'>( + data, std::bind(&FMPSParser::ParseValueRef, this, _1, _2), ret); } // Parses an outer list - a list of lists int FMPSParser::ParseListListRef(const QStringRef& data, Result* ret) const { - return ParseContainer<';'>(data, boost::bind(&FMPSParser::ParseListRef, this, _1, _2), ret); + return ParseContainer<';'>( + data, std::bind(&FMPSParser::ParseListRef, this, _1, _2), ret); } // Convenience functions that take QStrings instead of QStringRefs. Use the diff --git a/ext/libclementine-tagreader/tagreader.cpp b/ext/libclementine-tagreader/tagreader.cpp index 89ff08d3e..8e3009281 100644 --- a/ext/libclementine-tagreader/tagreader.cpp +++ b/ext/libclementine-tagreader/tagreader.cpp @@ -17,6 +17,8 @@ #include "tagreader.h" +#include + #include #include #include @@ -51,15 +53,11 @@ #include -#include - #include "fmpsparser.h" #include "core/logging.h" #include "core/messagehandler.h" #include "core/timeconstants.h" -using boost::scoped_ptr; - // Taglib added support for FLAC pictures in 1.7.0 #if (TAGLIB_MAJOR_VERSION > 1) || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 7) # define TAGLIB_HAS_FLAC_PICTURELIST @@ -123,7 +121,7 @@ void TagReader::ReadFile(const QString& filename, song->set_mtime(info.lastModified().toTime_t()); song->set_ctime(info.created().toTime_t()); - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if(fileref->isNull()) { qLog(Info) << "TagLib hasn't been able to read " << filename << " file"; return; @@ -528,7 +526,7 @@ bool TagReader::SaveFile(const QString& filename, qLog(Debug) << "Saving tags to" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if (!fileref || fileref->isNull()) // The file probably doesn't exist return false; @@ -589,7 +587,7 @@ bool TagReader::SaveSongStatisticsToFile(const QString& filename, qLog(Debug) << "Saving song statistics tags to" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if (!fileref || fileref->isNull()) // The file probably doesn't exist return false; @@ -645,7 +643,7 @@ bool TagReader::SaveSongRatingToFile(const QString& filename, qLog(Debug) << "Saving song rating tags to" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); if (!fileref || fileref->isNull()) // The file probably doesn't exist return false; @@ -747,7 +745,7 @@ void TagReader::SetTextFrame(const char* id, const std::string& value, bool TagReader::IsMediaFile(const QString& filename) const { qLog(Debug) << "Checking for valid file" << filename; - scoped_ptr fileref(factory_->GetFileRef(filename)); + std::unique_ptr fileref(factory_->GetFileRef(filename)); return !fileref->isNull() && fileref->tag(); } @@ -844,7 +842,7 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, CloudStream* stream = new CloudStream( download_url, title, size, authorisation_header, network_); stream->Precache(); - scoped_ptr tag; + std::unique_ptr tag; if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) { tag.reset(new TagLib::MPEG::File( stream, // Takes ownership. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1104542b7..93f825f81 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ if (QT_VERSION_MINOR GREATER 5) endif(QT_VERSION_MINOR GREATER 7) endif(QT_VERSION_MINOR GREATER 5) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) +add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS) include_directories(${CMAKE_BINARY_DIR}) include_directories(${GLIB_INCLUDE_DIRS}) diff --git a/src/config.h.in b/src/config.h.in index 6cac97ec7..218dafe80 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -47,7 +47,6 @@ #cmakedefine TAGLIB_HAS_OPUS #cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_SYSTEM_PROJECTM -#cmakedefine USE_STD_UNORDERED_MAP #cmakedefine HAVE_LAMBDAS #endif // CONFIG_H_IN diff --git a/src/core/deletefiles.cpp b/src/core/deletefiles.cpp index e881dc947..8a65e34ac 100644 --- a/src/core/deletefiles.cpp +++ b/src/core/deletefiles.cpp @@ -16,18 +16,19 @@ */ #include "deletefiles.h" -#include "musicstorage.h" -#include "taskmanager.h" #include #include #include #include +#include "musicstorage.h" +#include "taskmanager.h" + const int DeleteFiles::kBatchSize = 50; DeleteFiles::DeleteFiles(TaskManager* task_manager, - boost::shared_ptr storage) + std::shared_ptr storage) : thread_(NULL), task_manager_(task_manager), storage_(storage), diff --git a/src/core/deletefiles.h b/src/core/deletefiles.h index 38c995b67..142c5a7b5 100644 --- a/src/core/deletefiles.h +++ b/src/core/deletefiles.h @@ -18,9 +18,9 @@ #ifndef DELETEFILES_H #define DELETEFILES_H -#include +#include -#include +#include #include "song.h" @@ -31,7 +31,7 @@ class DeleteFiles : public QObject { Q_OBJECT public: - DeleteFiles(TaskManager* task_manager, boost::shared_ptr storage); + DeleteFiles(TaskManager* task_manager, std::shared_ptr storage); ~DeleteFiles(); static const int kBatchSize; @@ -49,7 +49,7 @@ private: QThread* thread_; QThread* original_thread_; TaskManager* task_manager_; - boost::shared_ptr storage_; + std::shared_ptr storage_; SongList songs_; diff --git a/src/core/mergedproxymodel.h b/src/core/mergedproxymodel.h index c8b04ec7c..92b4ee3f1 100644 --- a/src/core/mergedproxymodel.h +++ b/src/core/mergedproxymodel.h @@ -20,6 +20,9 @@ #include +using std::placeholders::_1; +using std::placeholders::_2; + #include #include #include diff --git a/src/core/musicstorage.h b/src/core/musicstorage.h index 4f7d0556f..4127c9304 100644 --- a/src/core/musicstorage.h +++ b/src/core/musicstorage.h @@ -20,10 +20,10 @@ #include "song.h" -#include +#include +#include -#include -#include +#include class MusicStorage { public: @@ -44,7 +44,7 @@ public: Transcode_Unsupported = 3, }; - typedef boost::function ProgressFunction; + typedef std::function ProgressFunction; struct CopyJob { QString source_; @@ -77,6 +77,6 @@ public: }; Q_DECLARE_METATYPE(MusicStorage*); -Q_DECLARE_METATYPE(boost::shared_ptr); +Q_DECLARE_METATYPE(std::shared_ptr); #endif // MUSICSTORAGE_H diff --git a/src/core/organise.cpp b/src/core/organise.cpp index 39de12916..dc87c1807 100644 --- a/src/core/organise.cpp +++ b/src/core/organise.cpp @@ -15,11 +15,9 @@ along with Clementine. If not, see . */ -#include "musicstorage.h" #include "organise.h" -#include "taskmanager.h" -#include "core/logging.h" -#include "core/tagreaderclient.h" + +#include #include #include @@ -27,13 +25,18 @@ #include #include -#include +#include "musicstorage.h" +#include "taskmanager.h" +#include "core/logging.h" +#include "core/tagreaderclient.h" + +using std::placeholders::_1; const int Organise::kBatchSize = 10; const int Organise::kTranscodeProgressInterval = 500; Organise::Organise(TaskManager* task_manager, - boost::shared_ptr destination, + std::shared_ptr destination, const OrganiseFormat &format, bool copy, bool overwrite, const QStringList& files, bool eject_after) : thread_(NULL), @@ -188,8 +191,8 @@ void Organise::ProcessSomeFiles() { job.metadata_ = song; job.overwrite_ = overwrite_; job.remove_original_ = !copy_; - job.progress_ = boost::bind(&Organise::SetSongProgress, - this, _1, !task.transcoded_filename_.isEmpty()); + job.progress_ = std::bind(&Organise::SetSongProgress, + this, _1, !task.transcoded_filename_.isEmpty()); if (!destination_->CopyToStorage(job)) { files_with_errors_ << task.filename_; diff --git a/src/core/organise.h b/src/core/organise.h index a45374c42..3f1639a1c 100644 --- a/src/core/organise.h +++ b/src/core/organise.h @@ -18,12 +18,12 @@ #ifndef ORGANISE_H #define ORGANISE_H +#include + #include #include #include -#include - #include "organiseformat.h" #include "transcoder/transcoder.h" @@ -35,7 +35,7 @@ class Organise : public QObject { public: Organise(TaskManager* task_manager, - boost::shared_ptr destination, + std::shared_ptr destination, const OrganiseFormat& format, bool copy, bool overwrite, const QStringList& files, bool eject_after); @@ -78,7 +78,7 @@ private: QThread* original_thread_; TaskManager* task_manager_; Transcoder* transcoder_; - boost::shared_ptr destination_; + std::shared_ptr destination_; QList supported_filetypes_; const OrganiseFormat format_; diff --git a/src/core/player.cpp b/src/core/player.cpp index 4cdf33f18..2814ba18b 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -15,8 +15,14 @@ along with Clementine. If not, see . */ -#include "config.h" #include "player.h" + +#include + +#include +#include + +#include "config.h" #include "core/application.h" #include "core/logging.h" #include "core/urlhandler.h" @@ -31,13 +37,7 @@ # include "internet/lastfmservice.h" #endif -#include -#include - -#include - -using boost::shared_ptr; - +using std::shared_ptr; Player::Player(Application* app, QObject* parent) : PlayerInterface(parent), diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 77ddd227d..c5a732dd5 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -17,7 +17,8 @@ #include "songloader.h" -#include +#include +#include #include #include @@ -48,6 +49,7 @@ #include "podcasts/podcastservice.h" #include "podcasts/podcasturlloader.h" +using std::placeholders::_1; QSet SongLoader::sRawUriSchemes; const int SongLoader::kDefaultTimeout = 5000; @@ -229,7 +231,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) { // inside right away. if (QFileInfo(filename).isDir()) { ConcurrentRun::Run(&thread_pool_, - boost::bind(&SongLoader::LoadLocalDirectoryAndEmit, this, filename)); + std::bind(&SongLoader::LoadLocalDirectoryAndEmit, this, filename)); return WillLoadAsync; } @@ -252,7 +254,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) { // It's a playlist! ConcurrentRun::Run(&thread_pool_, - boost::bind(&SongLoader::LoadPlaylistAndEmit, this, parser, filename)); + std::bind(&SongLoader::LoadPlaylistAndEmit, this, parser, filename)); return WillLoadAsync; } @@ -455,8 +457,8 @@ SongLoader::Result SongLoader::LoadRemote() { // rest of the file, parse the playlist and return success. // Create the pipeline - it gets unreffed if it goes out of scope - boost::shared_ptr pipeline( - gst_pipeline_new(NULL), boost::bind(&gst_object_unref, _1)); + std::shared_ptr pipeline( + gst_pipeline_new(NULL), std::bind(&gst_object_unref, _1)); // Create the source element automatically based on the URL GstElement* source = gst_element_make_from_uri( diff --git a/src/core/songloader.h b/src/core/songloader.h index 806e0378a..7e003f094 100644 --- a/src/core/songloader.h +++ b/src/core/songloader.h @@ -18,6 +18,10 @@ #ifndef SONGLOADER_H #define SONGLOADER_H +#include + +#include + #include #include #include @@ -26,10 +30,6 @@ #include "core/tagreaderclient.h" #include "musicbrainz/musicbrainzclient.h" -#include - -#include - class CueParser; class LibraryBackendInterface; class ParserBase; @@ -131,7 +131,7 @@ private: QByteArray buffer_; LibraryBackendInterface* library_; - boost::shared_ptr pipeline_; + std::shared_ptr pipeline_; QThreadPool thread_pool_; }; diff --git a/src/devices/devicemanager.cpp b/src/devices/devicemanager.cpp index eb2a1d351..e4e041755 100644 --- a/src/devices/devicemanager.cpp +++ b/src/devices/devicemanager.cpp @@ -17,7 +17,7 @@ #include "devicemanager.h" -#include +#include #include #include @@ -60,7 +60,7 @@ # include "mtpdevice.h" #endif -using boost::bind; +using std::bind; const int DeviceManager::kDeviceIconSize = 32; const int DeviceManager::kDeviceIconOverlaySize = 16; @@ -311,7 +311,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const { const_cast(this)->Connect(index.row()); if (!info.device_) return QVariant(); - return QVariant::fromValue >(info.device_); + return QVariant::fromValue>(info.device_); case MusicStorage::Role_StorageForceConnect: if (!info.device_) { @@ -319,7 +319,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const { !info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) { if (info.BestBackend()->lister_->AskForScan(info.BestBackend()->unique_id_)) { - boost::scoped_ptr dialog(new QMessageBox( + std::unique_ptr dialog(new QMessageBox( QMessageBox::Information, tr("Connect device"), tr("This is the first time you have connected this device. Clementine will now scan the device to find music files - this may take some time."), QMessageBox::Cancel)); @@ -336,7 +336,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const { } if (!info.device_) return QVariant(); - return QVariant::fromValue >(info.device_); + return QVariant::fromValue>(info.device_); case Role_MountPath: { if (!info.device_) @@ -520,12 +520,12 @@ void DeviceManager::PhysicalDeviceChanged(const QString &id) { // TODO } -boost::shared_ptr DeviceManager::Connect(int row) { +std::shared_ptr DeviceManager::Connect(int row) { DeviceInfo& info = devices_[row]; if (info.device_) // Already connected return info.device_; - boost::shared_ptr ret; + std::shared_ptr ret; if (!info.BestBackend()->lister_) // Not physically connected return ret; @@ -612,7 +612,7 @@ boost::shared_ptr DeviceManager::Connect(int row) { return ret; } -boost::shared_ptr DeviceManager::GetConnectedDevice(int row) const { +std::shared_ptr DeviceManager::GetConnectedDevice(int row) const { return devices_[row].device_; } diff --git a/src/devices/devicemanager.h b/src/devices/devicemanager.h index d165d17db..6f20b0159 100644 --- a/src/devices/devicemanager.h +++ b/src/devices/devicemanager.h @@ -19,13 +19,14 @@ #define DEVICEMANAGER_H #include "devicedatabasebackend.h" -#include "library/librarymodel.h" + +#include #include #include #include -#include +#include "library/librarymodel.h" class Application; class ConnectedDevice; @@ -72,13 +73,13 @@ public: // Get info about devices int GetDatabaseId(int row) const; DeviceLister* GetLister(int row) const; - boost::shared_ptr GetConnectedDevice(int row) const; + std::shared_ptr GetConnectedDevice(int row) const; int FindDeviceById(const QString& id) const; int FindDeviceByUrl(const QList& url) const; // Actions on devices - boost::shared_ptr Connect(int row); + std::shared_ptr Connect(int row); void Disconnect(int row); void Forget(int row); void UnmountAsync(int row); @@ -143,7 +144,7 @@ private: int database_id_; // -1 if not remembered in the database - boost::shared_ptr device_; // NULL if not connected to clementine + std::shared_ptr device_; // NULL if not connected to clementine QList backends_; QString friendly_name_; diff --git a/src/devices/deviceproperties.cpp b/src/devices/deviceproperties.cpp index 0f59f3c85..80bca6e9c 100644 --- a/src/devices/deviceproperties.cpp +++ b/src/devices/deviceproperties.cpp @@ -15,20 +15,22 @@ along with Clementine. If not, see . */ -#include "connecteddevice.h" -#include "devicelister.h" -#include "devicemanager.h" #include "deviceproperties.h" -#include "ui_deviceproperties.h" -#include "core/utilities.h" -#include "transcoder/transcoder.h" -#include "ui/iconloader.h" + +#include +#include #include #include #include -#include +#include "connecteddevice.h" +#include "devicelister.h" +#include "devicemanager.h" +#include "ui_deviceproperties.h" +#include "core/utilities.h" +#include "transcoder/transcoder.h" +#include "ui/iconloader.h" DeviceProperties::DeviceProperties(QWidget *parent) : QDialog(parent), @@ -178,7 +180,7 @@ void DeviceProperties::UpdateHardwareInfo() { void DeviceProperties::UpdateFormats() { QString id = index_.data(DeviceManager::Role_UniqueId).toString(); DeviceLister* lister = manager_->GetLister(index_.row()); - boost::shared_ptr device = + std::shared_ptr device = manager_->GetConnectedDevice(index_.row()); // Transcode mode @@ -219,7 +221,7 @@ void DeviceProperties::UpdateFormats() { // blocks, so do it in the background. supported_formats_.clear(); - QFuture future = QtConcurrent::run(boost::bind( + QFuture future = QtConcurrent::run(std::bind( &ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_)); QFutureWatcher* watcher = new QFutureWatcher(this); watcher->setFuture(future); diff --git a/src/devices/deviceview.cpp b/src/devices/deviceview.cpp index 2d561bb41..342ce936a 100644 --- a/src/devices/deviceview.cpp +++ b/src/devices/deviceview.cpp @@ -15,11 +15,22 @@ along with Clementine. If not, see . */ +#include "deviceview.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + #include "connecteddevice.h" #include "devicelister.h" #include "devicemanager.h" #include "deviceproperties.h" -#include "deviceview.h" #include "core/application.h" #include "core/deletefiles.h" #include "core/mergedproxymodel.h" @@ -31,16 +42,6 @@ #include "ui/organisedialog.h" #include "ui/organiseerrordialog.h" -#include -#include -#include -#include -#include -#include -#include - -#include - const int DeviceItemDelegate::kIconPadding = 6; DeviceItemDelegate::DeviceItemDelegate(QObject *parent) @@ -238,7 +239,8 @@ void DeviceView::contextMenuEvent(QContextMenuEvent* e) { bool is_filesystem_device = false; if (parent_device_index.isValid()) { - boost::shared_ptr device = app_->device_manager()->GetConnectedDevice(parent_device_index.row()); + std::shared_ptr device = + app_->device_manager()->GetConnectedDevice(parent_device_index.row()); if (device && !device->LocalPath().isEmpty()) is_filesystem_device = true; } @@ -281,7 +283,8 @@ void DeviceView::Connect() { } void DeviceView::DeviceConnected(int row) { - boost::shared_ptr device = app_->device_manager()->GetConnectedDevice(row); + std::shared_ptr device = + app_->device_manager()->GetConnectedDevice(row); if (!device) return; @@ -306,7 +309,7 @@ void DeviceView::Forget() { QString unique_id = app_->device_manager()->data(device_idx, DeviceManager::Role_UniqueId).toString(); if (app_->device_manager()->GetLister(device_idx.row()) && app_->device_manager()->GetLister(device_idx.row())->AskForScan(unique_id)) { - boost::scoped_ptr dialog(new QMessageBox( + std::unique_ptr dialog(new QMessageBox( QMessageBox::Question, tr("Forget device"), tr("Forgetting a device will remove it from this list and Clementine will have to rescan all the songs again next time you connect it."), QMessageBox::Cancel, this)); @@ -390,8 +393,8 @@ void DeviceView::Delete() { QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) return; - boost::shared_ptr storage = - device_index.data(MusicStorage::Role_Storage).value >(); + std::shared_ptr storage = + device_index.data(MusicStorage::Role_Storage).value>(); DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); diff --git a/src/devices/giolister.cpp b/src/devices/giolister.cpp index 625f05d66..504bbbc7c 100644 --- a/src/devices/giolister.cpp +++ b/src/devices/giolister.cpp @@ -17,16 +17,20 @@ #include "config.h" +#include + #include #include #include -#include - #include "giolister.h" #include "core/logging.h" #include "core/signalchecker.h" +using std::placeholders::_1; +using std::placeholders::_2; +using std::placeholders::_3; + QString GioLister::DeviceInfo::unique_id() const { if (mount) return QString("Gio/%1/%2/%3").arg(mount_uuid, filesystem_type).arg(filesystem_size); @@ -65,7 +69,7 @@ void OperationFinished(F f, GObject *object, GAsyncResult *result) { } void GioLister::VolumeMountFinished(GObject* object, GAsyncResult* result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_volume_mount_finish, _1, _2, _3), object, result); } @@ -456,17 +460,17 @@ QString GioLister::FindUniqueIdByVolume(GVolume* volume) const { } void GioLister::VolumeEjectFinished(GObject *object, GAsyncResult *result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_volume_eject_with_operation_finish, _1, _2, _3), object, result); } void GioLister::MountEjectFinished(GObject *object, GAsyncResult *result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_mount_eject_with_operation_finish, _1, _2, _3), object, result); } void GioLister::MountUnmountFinished(GObject *object, GAsyncResult *result, gpointer) { - OperationFinished(boost::bind( + OperationFinished(std::bind( g_mount_unmount_with_operation_finish, _1, _2, _3), object, result); } diff --git a/src/engines/gstengine.cpp b/src/engines/gstengine.cpp index 7131c8ce9..b6f185a8e 100644 --- a/src/engines/gstengine.cpp +++ b/src/engines/gstengine.cpp @@ -19,23 +19,14 @@ * 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "config.h" #include "gstengine.h" -#include "gstenginepipeline.h" -#include "core/logging.h" -#include "core/taskmanager.h" -#include "core/utilities.h" - -#ifdef HAVE_MOODBAR -# include "gst/moodbar/spectrum.h" -#endif #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -49,9 +40,18 @@ #include +#include "config.h" +#include "gstenginepipeline.h" +#include "core/logging.h" +#include "core/taskmanager.h" +#include "core/utilities.h" +#ifdef HAVE_MOODBAR +# include "gst/moodbar/spectrum.h" +#endif + +using std::shared_ptr; using std::vector; -using boost::shared_ptr; const char* GstEngine::kSettingsGroup = "GstEngine"; const char* GstEngine::kAutoSink = "autoaudiosink"; diff --git a/src/engines/gstengine.h b/src/engines/gstengine.h index 94c3a93bc..3f3a6c8bf 100644 --- a/src/engines/gstengine.h +++ b/src/engines/gstengine.h @@ -22,6 +22,8 @@ #ifndef AMAROK_GSTENGINE_H #define AMAROK_GSTENGINE_H +#include + #include "bufferconsumer.h" #include "enginebase.h" #include "core/boundfuturewatcher.h" @@ -35,7 +37,6 @@ #include #include -#include class QTimer; class QTimerEvent; @@ -146,12 +147,13 @@ class GstEngine : public Engine::Base, public BufferConsumer { void StartTimers(); void StopTimers(); - boost::shared_ptr CreatePipeline(); - boost::shared_ptr CreatePipeline(const QUrl& url, qint64 end_nanosec); + std::shared_ptr CreatePipeline(); + std::shared_ptr CreatePipeline( + const QUrl& url, qint64 end_nanosec); void UpdateScope(); - int AddBackgroundStream(boost::shared_ptr pipeline); + int AddBackgroundStream(std::shared_ptr pipeline); static QUrl FixupUrl(const QUrl& url); @@ -171,9 +173,9 @@ class GstEngine : public Engine::Base, public BufferConsumer { QString sink_; QString device_; - boost::shared_ptr current_pipeline_; - boost::shared_ptr fadeout_pipeline_; - boost::shared_ptr fadeout_pause_pipeline_; + std::shared_ptr current_pipeline_; + std::shared_ptr fadeout_pipeline_; + std::shared_ptr fadeout_pause_pipeline_; QUrl preloaded_url_; QList buffer_consumers_; @@ -205,7 +207,7 @@ class GstEngine : public Engine::Base, public BufferConsumer { int timer_id_; int next_element_id_; - QHash > background_streams_; + QHash > background_streams_; bool is_fading_out_to_pause_; bool has_faded_out_; diff --git a/src/globalsearch/globalsearchview.cpp b/src/globalsearch/globalsearchview.cpp index 67cc90bb2..9b38847aa 100644 --- a/src/globalsearch/globalsearchview.cpp +++ b/src/globalsearch/globalsearchview.cpp @@ -1,25 +1,33 @@ /* This file is part of Clementine. Copyright 2012, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ +#include "globalsearchview.h" + +#include +#include +#include +#include + +#include + #include "globalsearch.h" #include "globalsearchitemdelegate.h" #include "globalsearchmodel.h" #include "globalsearchsortmodel.h" -#include "globalsearchview.h" #include "searchprovider.h" #include "searchproviderstatuswidget.h" #include "suggestionwidget.h" @@ -32,12 +40,8 @@ #include "library/librarymodel.h" #include "library/groupbydialog.h" -#include - -#include -#include -#include -#include +using std::placeholders::_1; +using std::placeholders::_2; const int GlobalSearchView::kSwapModelsTimeoutMsec = 250; const int GlobalSearchView::kMaxSuggestions = 10; @@ -176,14 +180,14 @@ namespace { void GlobalSearchView::ReloadSettings() { QSettings s; - + // Library settings s.beginGroup(LibraryView::kSettingsGroup); const bool pretty = s.value("pretty_covers", true).toBool(); front_model_->set_use_pretty_covers(pretty); back_model_->set_use_pretty_covers(pretty); s.endGroup(); - + // Global search settings s.beginGroup(GlobalSearch::kSettingsGroup); const QStringList provider_order = @@ -197,11 +201,11 @@ void GlobalSearchView::ReloadSettings() { LibraryModel::GroupBy(s.value("group_by2", int(LibraryModel::GroupBy_Album)).toInt()), LibraryModel::GroupBy(s.value("group_by3", int(LibraryModel::GroupBy_None)).toInt()))); s.endGroup(); - + // Delete any old status widgets qDeleteAll(provider_status_widgets_); provider_status_widgets_.clear(); - + // Toggle visibility of the providers group ui_->providers_group->setVisible(show_providers_); @@ -209,27 +213,27 @@ void GlobalSearchView::ReloadSettings() { // Sort the list of providers QList providers = engine_->providers(); qSort(providers.begin(), providers.end(), - boost::bind(&CompareProvider, boost::cref(provider_order), _1, _2)); - + std::bind(&CompareProvider, std::cref(provider_order), _1, _2)); + bool any_disabled = false; - + foreach (SearchProvider* provider, providers) { QWidget* parent = ui_->enabled_list; if (!engine_->is_provider_usable(provider)) { parent = ui_->disabled_list; any_disabled = true; } - + SearchProviderStatusWidget* widget = new SearchProviderStatusWidget(warning_icon_, engine_, provider); - + parent->layout()->addWidget(widget); provider_status_widgets_ << widget; } - + ui_->disabled_label->setVisible(any_disabled); } - + ui_->suggestions_group->setVisible(show_suggestions_); if (!show_suggestions_) { update_suggestions_timer_->stop(); diff --git a/src/library/groupbydialog.h b/src/library/groupbydialog.h index fa8976d27..718590286 100644 --- a/src/library/groupbydialog.h +++ b/src/library/groupbydialog.h @@ -20,6 +20,11 @@ #include +#include + +using std::placeholders::_1; +using std::placeholders::_2; + #include #include #include diff --git a/src/library/librarydirectorymodel.cpp b/src/library/librarydirectorymodel.cpp index 8376ffef4..79b140161 100644 --- a/src/library/librarydirectorymodel.cpp +++ b/src/library/librarydirectorymodel.cpp @@ -38,7 +38,7 @@ void LibraryDirectoryModel::DirectoryDiscovered(const Directory &dir) { QStandardItem* item = new QStandardItem(dir.path); item->setData(dir.id, kIdRole); item->setIcon(dir_icon_); - storage_ << boost::shared_ptr(new FilesystemMusicStorage(dir.path)); + storage_ << std::shared_ptr(new FilesystemMusicStorage(dir.path)); appendRow(item); } diff --git a/src/library/librarydirectorymodel.h b/src/library/librarydirectorymodel.h index eee72270b..5d7c4d482 100644 --- a/src/library/librarydirectorymodel.h +++ b/src/library/librarydirectorymodel.h @@ -18,11 +18,11 @@ #ifndef LIBRARYDIRECTORYMODEL_H #define LIBRARYDIRECTORYMODEL_H +#include + #include #include -#include - #include "directory.h" class LibraryBackend; @@ -51,7 +51,7 @@ class LibraryDirectoryModel : public QStandardItemModel { QIcon dir_icon_; LibraryBackend* backend_; - QList > storage_; + QList > storage_; }; #endif // LIBRARYDIRECTORYMODEL_H diff --git a/src/library/librarymodel.cpp b/src/library/librarymodel.cpp index 9bd919522..db3f95a3d 100644 --- a/src/library/librarymodel.cpp +++ b/src/library/librarymodel.cpp @@ -16,6 +16,18 @@ */ #include "librarymodel.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + #include "librarybackend.h" #include "libraryitem.h" #include "librarydirectorymodel.h" @@ -32,16 +44,8 @@ #include "smartplaylists/querygenerator.h" #include "ui/iconloader.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include +using std::placeholders::_1; +using std::placeholders::_2; using smart_playlists::Generator; using smart_playlists::GeneratorMimeData; @@ -1079,7 +1083,7 @@ void LibraryModel::GetChildSongs(LibraryItem* item, QList* urls, const_cast(this)->LazyPopulate(item); QList children = item->children; - qSort(children.begin(), children.end(), boost::bind( + qSort(children.begin(), children.end(), std::bind( &LibraryModel::CompareItems, this, _1, _2)); foreach (LibraryItem* child, children) diff --git a/src/library/libraryview.cpp b/src/library/libraryview.cpp index e807836d2..297212837 100644 --- a/src/library/libraryview.cpp +++ b/src/library/libraryview.cpp @@ -15,10 +15,22 @@ along with Clementine. If not, see . */ +#include "libraryview.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "librarydirectorymodel.h" #include "libraryfilterwidget.h" #include "librarymodel.h" -#include "libraryview.h" #include "libraryitem.h" #include "librarybackend.h" #include "core/application.h" @@ -34,17 +46,6 @@ #include "ui/organisedialog.h" #include "ui/organiseerrordialog.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - using smart_playlists::Wizard; const char* LibraryView::kSettingsGroup = "LibraryView"; @@ -613,9 +614,9 @@ void LibraryView::Delete() { // We can cheat and always take the storage of the first directory, since // they'll all be FilesystemMusicStorage in a library and deleting doesn't // check the actual directory. - boost::shared_ptr storage = + std::shared_ptr storage = app_->library_model()->directory_model()->index(0, 0).data(MusicStorage::Role_Storage) - .value >(); + .value>(); DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); diff --git a/src/main.cpp b/src/main.cpp index 8c0e9542d..2bf13f593 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,8 @@ along with Clementine. If not, see . */ +#include + #include #ifdef Q_OS_WIN32 @@ -23,6 +25,19 @@ # include #endif // Q_OS_WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "config.h" #include "core/application.h" #include "core/commandlineoptions.h" @@ -54,26 +69,10 @@ #include "qtsingleapplication.h" #include "qtsinglecoreapplication.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include -#include -using boost::scoped_ptr; - #include #ifdef HAVE_SPOTIFY_DOWNLOADER @@ -438,7 +437,7 @@ int main(int argc, char *argv[]) { #endif // Q_OS_LINUX // Create the tray icon and OSD - scoped_ptr tray_icon(SystemTrayIcon::CreateSystemTrayIcon()); + std::unique_ptr tray_icon(SystemTrayIcon::CreateSystemTrayIcon()); OSD osd(tray_icon.get(), &app); #ifdef HAVE_DBUS diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index ea07cca42..dfb11116f 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -16,6 +16,25 @@ */ #include "playlist.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "playlistbackend.h" #include "playlistfilter.h" #include "playlistitemmimedata.h" @@ -48,36 +67,15 @@ #include "smartplaylists/generatorinserter.h" #include "smartplaylists/generatormimedata.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef USE_STD_UNORDERED_MAP - #include - using std::unordered_map; -#else - #include - using std::tr1::unordered_map; -#endif +using std::placeholders::_1; +using std::placeholders::_2; +using std::shared_ptr; +using std::unordered_map; using smart_playlists::Generator; using smart_playlists::GeneratorInserter; using smart_playlists::GeneratorPtr; -using boost::shared_ptr; - const char* Playlist::kCddaMimeType = "x-content/audio-cdda"; const char* Playlist::kRowsMimetype = "application/x-clementine-playlist-rows"; const char* Playlist::kPlayNowMimetype = "application/x-clementine-play-now"; @@ -1264,7 +1262,7 @@ void Playlist::sort(int column, Qt::SortOrder order) { begin += current_item_index_.row() + 1; qStableSort(begin, new_items.end(), - boost::bind(&Playlist::CompareItems, column, order, _1, _2)); + std::bind(&Playlist::CompareItems, column, order, _1, _2)); undo_stack_->push(new PlaylistUndoCommands::SortItems(this, column, order, new_items)); } @@ -1811,8 +1809,8 @@ void Playlist::ReshuffleIndices() { // Sort the virtual items std::stable_sort(begin, end, - boost::bind(AlbumShuffleComparator, album_key_positions, - album_keys, _1, _2)); + std::bind(AlbumShuffleComparator, album_key_positions, + album_keys, _1, _2)); break; } diff --git a/src/playlist/playlistbackend.cpp b/src/playlist/playlistbackend.cpp index c248a2b3d..f8a604016 100644 --- a/src/playlist/playlistbackend.cpp +++ b/src/playlist/playlistbackend.cpp @@ -16,6 +16,17 @@ */ #include "playlistbackend.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + #include "core/application.h" #include "core/database.h" #include "core/scopedtransaction.h" @@ -26,19 +37,11 @@ #include "playlistparsers/cueparser.h" #include "smartplaylists/generator.h" -#include -#include -#include -#include -#include -#include - -#include +using std::placeholders::_1; +using std::shared_ptr; using smart_playlists::GeneratorPtr; -using boost::shared_ptr; - const int PlaylistBackend::kSongTableJoins = 4; PlaylistBackend::PlaylistBackend(Application* app, QObject* parent) @@ -174,8 +177,10 @@ QFuture PlaylistBackend::GetPlaylistItems(int playlist) { // it's probable that we'll have a few songs associated with the // same CUE so we're caching results of parsing CUEs - boost::shared_ptr state_ptr(new NewSongFromQueryState()); - return QtConcurrent::mapped(rows, boost::bind(&PlaylistBackend::NewPlaylistItemFromQuery, this, _1, state_ptr)); + std::shared_ptr state_ptr(new NewSongFromQueryState()); + return QtConcurrent::mapped( + rows, std::bind( + &PlaylistBackend::NewPlaylistItemFromQuery, this, _1, state_ptr)); } QFuture PlaylistBackend::GetPlaylistSongs(int playlist) { @@ -184,11 +189,12 @@ QFuture PlaylistBackend::GetPlaylistSongs(int playlist) { // it's probable that we'll have a few songs associated with the // same CUE so we're caching results of parsing CUEs - boost::shared_ptr state_ptr(new NewSongFromQueryState()); - return QtConcurrent::mapped(rows, boost::bind(&PlaylistBackend::NewSongFromQuery, this, _1, state_ptr)); + std::shared_ptr state_ptr(new NewSongFromQueryState()); + return QtConcurrent::mapped(rows, std::bind(&PlaylistBackend::NewSongFromQuery, this, _1, state_ptr)); } -PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(const SqlRow& row, boost::shared_ptr state) { +PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery( + const SqlRow& row, std::shared_ptr state) { // The song tables get joined first, plus one each for the song ROWIDs const int playlist_row = (Song::kColumns.count() + 1) * kSongTableJoins; @@ -201,13 +207,15 @@ PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(const SqlRow& row, boo } } -Song PlaylistBackend::NewSongFromQuery(const SqlRow& row, boost::shared_ptr state) { +Song PlaylistBackend::NewSongFromQuery( + const SqlRow& row, std::shared_ptr state) { return NewPlaylistItemFromQuery(row, state)->Metadata(); } // If song had a CUE and the CUE still exists, the metadata from it will // be applied here. -PlaylistItemPtr PlaylistBackend::RestoreCueData(PlaylistItemPtr item, boost::shared_ptr state) { +PlaylistItemPtr PlaylistBackend::RestoreCueData( + PlaylistItemPtr item, std::shared_ptr state) { // we need library to run a CueParser; also, this method applies only to // file-type PlaylistItems if(item->type() != "File") { diff --git a/src/playlist/playlistbackend.h b/src/playlist/playlistbackend.h index d9c4a071c..29fdf9142 100644 --- a/src/playlist/playlistbackend.h +++ b/src/playlist/playlistbackend.h @@ -90,9 +90,9 @@ class PlaylistBackend : public QObject { QList GetPlaylistRows(int playlist); - Song NewSongFromQuery(const SqlRow& row, boost::shared_ptr state); - PlaylistItemPtr NewPlaylistItemFromQuery(const SqlRow& row, boost::shared_ptr state); - PlaylistItemPtr RestoreCueData(PlaylistItemPtr item, boost::shared_ptr state); + Song NewSongFromQuery(const SqlRow& row, std::shared_ptr state); + PlaylistItemPtr NewPlaylistItemFromQuery(const SqlRow& row, std::shared_ptr state); + PlaylistItemPtr RestoreCueData(PlaylistItemPtr item, std::shared_ptr state); enum GetPlaylistsFlags { GetPlaylists_OpenInUi = 1, diff --git a/src/playlist/playlistitem.h b/src/playlist/playlistitem.h index 449a1f421..467d10c09 100644 --- a/src/playlist/playlistitem.h +++ b/src/playlist/playlistitem.h @@ -18,19 +18,19 @@ #ifndef PLAYLISTITEM_H #define PLAYLISTITEM_H +#include + #include #include #include #include -#include - #include "core/song.h" class QAction; class SqlRow; -class PlaylistItem : public boost::enable_shared_from_this { +class PlaylistItem : public std::enable_shared_from_this { public: PlaylistItem(const QString& type) : type_(type) {} @@ -109,7 +109,7 @@ class PlaylistItem : public boost::enable_shared_from_this { QMap background_colors_; QMap foreground_colors_; }; -typedef boost::shared_ptr PlaylistItemPtr; +typedef std::shared_ptr PlaylistItemPtr; typedef QList PlaylistItemList; Q_DECLARE_METATYPE(PlaylistItemPtr) diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index 487f975ff..e7e91b9b4 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -17,6 +17,8 @@ #include "transcoder.h" +#include + #include #include #include @@ -24,12 +26,10 @@ #include #include -#include - #include "core/logging.h" #include "core/signalchecker.h" -using boost::shared_ptr; +using std::shared_ptr; int Transcoder::JobFinishedEvent::sEventType = -1; @@ -541,7 +541,7 @@ void Transcoder::Cancel() { QMap Transcoder::GetProgress() const { QMap ret; - foreach (boost::shared_ptr state, current_jobs_) { + for (const auto& state : current_jobs_) { if (!state->pipeline_) continue; diff --git a/src/transcoder/transcoder.h b/src/transcoder/transcoder.h index 58c53288e..62f3149b4 100644 --- a/src/transcoder/transcoder.h +++ b/src/transcoder/transcoder.h @@ -18,6 +18,8 @@ #ifndef TRANSCODER_H #define TRANSCODER_H +#include + #include #include @@ -25,9 +27,6 @@ #include #include -#include -#include - #include "core/song.h" @@ -138,7 +137,7 @@ class Transcoder : public QObject { static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage* msg, gpointer data); private: - typedef QList > JobStateList; + typedef QList > JobStateList; int max_threads_; QList queued_jobs_; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 1aa3bc0a9..bc9a43f24 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -17,6 +17,33 @@ #include "mainwindow.h" #include "ui_mainwindow.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_WIN32 +# include +#endif + +#include + + #include "core/appearance.h" #include "core/application.h" #include "core/backgroundstreams.h" @@ -118,34 +145,6 @@ # include "moodbar/moodbarproxystyle.h" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_OS_WIN32 -# include -#endif - - -#include - -#include - -using boost::shared_ptr; -using boost::scoped_ptr; - #ifdef Q_OS_DARWIN // Non exported mac-specific function. void qt_mac_set_dock_menu(QMenu*); @@ -1909,7 +1908,7 @@ void MainWindow::PlaylistDelete() { QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) return; - boost::shared_ptr storage(new FilesystemMusicStorage("/")); + std::shared_ptr storage(new FilesystemMusicStorage("/")); // Get selected songs SongList selected_songs; diff --git a/src/ui/organisedialog.cpp b/src/ui/organisedialog.cpp index bb786115e..c3f7908f2 100644 --- a/src/ui/organisedialog.cpp +++ b/src/ui/organisedialog.cpp @@ -15,13 +15,10 @@ along with Clementine. If not, see . */ -#include "iconloader.h" #include "organisedialog.h" -#include "organiseerrordialog.h" #include "ui_organisedialog.h" -#include "core/musicstorage.h" -#include "core/organise.h" -#include "core/tagreaderclient.h" + +#include #include #include @@ -32,6 +29,12 @@ #include #include +#include "iconloader.h" +#include "organiseerrordialog.h" +#include "core/musicstorage.h" +#include "core/organise.h" +#include "core/tagreaderclient.h" + const int OrganiseDialog::kNumberOfPreviews = 10; const char* OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension"; @@ -192,12 +195,12 @@ void OrganiseDialog::InsertTag(const QString &tag) { void OrganiseDialog::UpdatePreviews() { const QModelIndex destination = ui_->destination->model()->index( ui_->destination->currentIndex(), 0); - boost::shared_ptr storage; + std::shared_ptr storage; bool has_local_destination = false; if (destination.isValid()) { storage = destination.data(MusicStorage::Role_Storage) - .value >(); + .value>(); if (storage) { has_local_destination = !storage->LocalPath().isEmpty(); } @@ -294,9 +297,9 @@ void OrganiseDialog::accept() { const QModelIndex destination = ui_->destination->model()->index( ui_->destination->currentIndex(), 0); - boost::shared_ptr storage = + std::shared_ptr storage = destination.data(MusicStorage::Role_StorageForceConnect) - .value >(); + .value>(); if (!storage) return; diff --git a/src/widgets/fileview.h b/src/widgets/fileview.h index 07e5d239f..db740bcb7 100644 --- a/src/widgets/fileview.h +++ b/src/widgets/fileview.h @@ -18,13 +18,13 @@ #ifndef FILEVIEW_H #define FILEVIEW_H +#include + #include #include #include #include -#include - #include "core/song.h" class FilesystemMusicStorage; @@ -102,7 +102,7 @@ class FileView : public QWidget { QUndoStack* undo_stack_; TaskManager* task_manager_; - boost::shared_ptr storage_; + std::shared_ptr storage_; QString lazy_set_path_; From 5b4b06f64bdd4c1e1ef478a17c9a19beae7ee587 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 6 Feb 2014 15:35:36 +0100 Subject: [PATCH 23/23] Remove boost::scoped_ptr & boost::shared_ptr --- src/core/crashreporting.h | 6 ++-- src/core/macglobalshortcutbackend.h | 6 ++-- src/core/mpris2.h | 2 -- src/core/player.h | 6 ++-- src/core/utilities.cpp | 4 +-- src/core/utilities.h | 6 ++-- src/covers/albumcoverfetcher.h | 2 -- src/covers/currentartloader.h | 10 +++---- src/devices/connecteddevice.h | 8 ++--- src/devices/devicekitlister.h | 6 ++-- src/devices/devicelister.h | 2 -- src/devices/deviceview.h | 6 ++-- src/devices/gpodloader.cpp | 5 ++-- src/devices/gpodloader.h | 7 +++-- src/devices/mtpdevice.h | 6 ++-- src/devices/mtploader.cpp | 12 ++++---- src/devices/mtploader.h | 8 ++--- src/engines/enginebase.h | 5 ++-- src/engines/gstenginepipeline.cpp | 31 ++++++++++---------- src/engines/gstenginepipeline.h | 5 ++-- src/globalsearch/spotifysearchprovider.cpp | 8 ++--- src/internet/cloudfileservice.h | 6 ++-- src/internet/digitallyimportedservicebase.h | 4 +-- src/internet/groovesharkservice.cpp | 6 ++-- src/internet/lastfmservice.cpp | 3 -- src/internet/lastfmservice.h | 8 ++--- src/internet/magnatunedownloaddialog.cpp | 19 +++++++----- src/internet/magnatunedownloaddialog.h | 6 ++-- src/internet/magnatuneservice.cpp | 2 -- src/internet/savedradio.h | 6 ++-- src/internet/skydriveservice.cpp | 5 ++-- src/internet/spotifyservice.h | 2 -- src/library/library.h | 2 -- src/library/libraryfilterwidget.h | 6 ++-- src/library/librarymodel.h | 2 -- src/library/libraryview.h | 12 ++++---- src/moodbar/moodbarloader.cpp | 4 +-- src/networkremote/networkremote.h | 10 +++---- src/networkremote/outgoingdatacreator.h | 5 ++-- src/playlist/playlist.h | 2 -- src/playlist/playlistsequence.h | 6 ++-- src/playlist/playlistview.h | 6 ++-- src/playlistparsers/xmlparser.h | 5 ++-- src/smartplaylists/generator.h | 7 ++--- src/smartplaylists/generator_fwd.h | 4 +-- src/smartplaylists/querywizardplugin.cpp | 10 +++---- src/smartplaylists/querywizardplugin.h | 7 +++-- src/smartplaylists/searchpreview.cpp | 11 ++++--- src/songinfo/echonestbiographies.cpp | 13 ++++---- src/songinfo/echonestbiographies.h | 6 ++-- src/songinfo/echonestimages.cpp | 9 +++--- src/songinfo/echonestimages.h | 6 ++-- src/songinfo/echonesttags.cpp | 13 ++++---- src/songinfo/echonesttags.h | 6 ++-- src/songinfo/songinfoview.h | 6 ++-- src/songinfo/ultimatelyricsprovider.cpp | 2 -- src/ui/albumcovermanager.cpp | 2 +- src/ui/albumcovermanagerlist.cpp | 11 +++---- src/ui/albumcoversearcher.h | 7 ++--- src/ui/globalshortcutgrabber.mm | 5 ++-- src/ui/globalshortcutssettingspage.h | 6 ++-- src/ui/macsystemtrayicon.h | 11 ++++--- src/ui/macsystemtrayicon.mm | 4 ++- src/ui/mainwindow.cpp | 10 ------- src/ui/mainwindow.h | 30 +++++++++---------- src/ui/organisedialog.h | 6 ++-- src/visualisations/projectmvisualisation.cpp | 8 ++--- src/visualisations/projectmvisualisation.h | 8 ++--- src/widgets/fancytabwidget.h | 6 ++-- src/widgets/nowplayingwidget.h | 10 +++---- src/widgets/osd.h | 5 ++-- src/widgets/osd_x11.cpp | 11 +++---- src/wiimotedev/shortcuts.cpp | 1 - src/wiimotedev/shortcuts.h | 5 ++-- src/wiimotedev/wiimoteshortcutgrabber.h | 6 ++-- 75 files changed, 255 insertions(+), 275 deletions(-) diff --git a/src/core/crashreporting.h b/src/core/crashreporting.h index 54d30558a..a627d0bb0 100644 --- a/src/core/crashreporting.h +++ b/src/core/crashreporting.h @@ -18,9 +18,9 @@ #ifndef CRASHREPORTING_H #define CRASHREPORTING_H -#include +#include -#include +#include class QFile; class QNetworkAccessManager; @@ -64,7 +64,7 @@ private: static const char* kSendCrashReportOption; static char* sPath; - boost::scoped_ptr handler_; + std::unique_ptr handler_; }; diff --git a/src/core/macglobalshortcutbackend.h b/src/core/macglobalshortcutbackend.h index 4e42be366..9abcf8e98 100644 --- a/src/core/macglobalshortcutbackend.h +++ b/src/core/macglobalshortcutbackend.h @@ -18,13 +18,13 @@ #ifndef MACGLOBALSHORTCUTBACKEND_H #define MACGLOBALSHORTCUTBACKEND_H +#include + #include "globalshortcutbackend.h" #include #include -#include - class MacGlobalShortcutBackendPrivate; class QAction; @@ -50,7 +50,7 @@ private: QMap shortcuts_; friend class MacGlobalShortcutBackendPrivate; - boost::scoped_ptr p_; + std::unique_ptr p_; }; #endif // MACGLOBALSHORTCUTBACKEND_H diff --git a/src/core/mpris2.h b/src/core/mpris2.h index 999994cd4..28b4e1744 100644 --- a/src/core/mpris2.h +++ b/src/core/mpris2.h @@ -24,8 +24,6 @@ #include #include -#include - class Application; class MainWindow; class Playlist; diff --git a/src/core/player.h b/src/core/player.h index c8b7b7854..70fcc4266 100644 --- a/src/core/player.h +++ b/src/core/player.h @@ -18,11 +18,11 @@ #ifndef PLAYER_H #define PLAYER_H +#include + #include #include -#include - #include "config.h" #include "core/song.h" #include "core/urlhandler.h" @@ -176,7 +176,7 @@ public slots: PlaylistItemPtr current_item_; - boost::scoped_ptr engine_; + std::unique_ptr engine_; Engine::TrackChangeFlags stream_change_type_; Engine::State last_state_; diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 6c07faa18..0978609cf 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -19,7 +19,7 @@ #include -#include +#include #include #include @@ -265,7 +265,7 @@ bool Copy(QIODevice* source, QIODevice* destination) { return false; const qint64 bytes = source->size(); - boost::scoped_array data(new char[bytes]); + std::unique_ptr data(new char[bytes]); qint64 pos = 0; qint64 bytes_read; diff --git a/src/core/utilities.h b/src/core/utilities.h index edaa54508..1ad614c03 100644 --- a/src/core/utilities.h +++ b/src/core/utilities.h @@ -18,6 +18,8 @@ #ifndef UTILITIES_H #define UTILITIES_H +#include + #include #include #include @@ -25,8 +27,6 @@ #include #include -#include - class QIODevice; class QMouseEvent; class QXmlStreamReader; @@ -159,7 +159,7 @@ private: Q_DISABLE_COPY(ScopedWCharArray); int chars_; - boost::scoped_array data_; + std::unique_ptr data_; }; #endif // UTILITIES_H diff --git a/src/covers/albumcoverfetcher.h b/src/covers/albumcoverfetcher.h index a8a8dcc2f..034ddddfb 100644 --- a/src/covers/albumcoverfetcher.h +++ b/src/covers/albumcoverfetcher.h @@ -29,8 +29,6 @@ #include #include -#include - class QNetworkReply; class QString; diff --git a/src/covers/currentartloader.h b/src/covers/currentartloader.h index 05e1a7db7..5b24e71fd 100644 --- a/src/covers/currentartloader.h +++ b/src/covers/currentartloader.h @@ -18,12 +18,12 @@ #ifndef CURRENTARTLOADER_H #define CURRENTARTLOADER_H -#include "core/song.h" -#include "covers/albumcoverloaderoptions.h" +#include #include -#include +#include "core/song.h" +#include "covers/albumcoverloaderoptions.h" class Application; @@ -56,8 +56,8 @@ private: QString temp_file_pattern_; - boost::scoped_ptr temp_art_; - boost::scoped_ptr temp_art_thumbnail_; + std::unique_ptr temp_art_; + std::unique_ptr temp_art_thumbnail_; quint64 id_; Song last_song_; diff --git a/src/devices/connecteddevice.h b/src/devices/connecteddevice.h index 3eb468a39..663e5253d 100644 --- a/src/devices/connecteddevice.h +++ b/src/devices/connecteddevice.h @@ -18,14 +18,14 @@ #ifndef CONNECTEDDEVICE_H #define CONNECTEDDEVICE_H -#include "core/musicstorage.h" -#include "core/song.h" +#include #include #include #include -#include +#include "core/musicstorage.h" +#include "core/song.h" class Application; class Database; @@ -35,7 +35,7 @@ class LibraryBackend; class LibraryModel; class ConnectedDevice : public QObject, public virtual MusicStorage, - public boost::enable_shared_from_this { + public std::enable_shared_from_this { Q_OBJECT public: diff --git a/src/devices/devicekitlister.h b/src/devices/devicekitlister.h index c91bdb437..201e9b74b 100644 --- a/src/devices/devicekitlister.h +++ b/src/devices/devicekitlister.h @@ -18,12 +18,12 @@ #ifndef DEVICEKITLISTER_H #define DEVICEKITLISTER_H -#include "devicelister.h" +#include #include #include -#include +#include "devicelister.h" class OrgFreedesktopUDisksInterface; @@ -88,7 +88,7 @@ private: T LockAndGetDeviceInfo(const QString& id, T DeviceData::*field); private: - boost::scoped_ptr interface_; + std::unique_ptr interface_; QMutex mutex_; QMap device_data_; diff --git a/src/devices/devicelister.h b/src/devices/devicelister.h index 4003fb8fc..5791968ab 100644 --- a/src/devices/devicelister.h +++ b/src/devices/devicelister.h @@ -21,8 +21,6 @@ #include #include -#include - class ConnectedDevice; class DeviceManager; diff --git a/src/devices/deviceview.h b/src/devices/deviceview.h index 6bb81c440..f64592e6e 100644 --- a/src/devices/deviceview.h +++ b/src/devices/deviceview.h @@ -18,6 +18,8 @@ #ifndef DEVICEVIEW_H #define DEVICEVIEW_H +#include + #include "core/song.h" #include "library/libraryview.h" #include "widgets/autoexpandingtreeview.h" @@ -88,8 +90,8 @@ private: MergedProxyModel* merged_model_; QSortFilterProxyModel* sort_model_; - boost::scoped_ptr properties_dialog_; - boost::scoped_ptr organise_dialog_; + std::unique_ptr properties_dialog_; + std::unique_ptr organise_dialog_; QMenu* device_menu_; QAction* eject_action_; diff --git a/src/devices/gpodloader.cpp b/src/devices/gpodloader.cpp index 730cff5b8..9faa44be5 100644 --- a/src/devices/gpodloader.cpp +++ b/src/devices/gpodloader.cpp @@ -27,8 +27,9 @@ #include #include -GPodLoader::GPodLoader(const QString& mount_point, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device) +GPodLoader::GPodLoader( + const QString& mount_point, TaskManager* task_manager, + LibraryBackend* backend, std::shared_ptr device) : QObject(NULL), device_(device), mount_point_(mount_point), diff --git a/src/devices/gpodloader.h b/src/devices/gpodloader.h index c24fd8a7a..e3c2f74f6 100644 --- a/src/devices/gpodloader.h +++ b/src/devices/gpodloader.h @@ -18,9 +18,10 @@ #ifndef GPODLOADER_H #define GPODLOADER_H +#include + #include -#include #include #include "core/song.h" @@ -34,7 +35,7 @@ class GPodLoader : public QObject { public: GPodLoader(const QString& mount_point, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device); + LibraryBackend* backend, std::shared_ptr device); ~GPodLoader(); void set_music_path_prefix(const QString& prefix) { path_prefix_ = prefix; } @@ -49,7 +50,7 @@ signals: void LoadFinished(Itdb_iTunesDB* db); private: - boost::shared_ptr device_; + std::shared_ptr device_; QThread* original_thread_; QString mount_point_; diff --git a/src/devices/mtpdevice.h b/src/devices/mtpdevice.h index 6bc45f5ba..7317ea5e6 100644 --- a/src/devices/mtpdevice.h +++ b/src/devices/mtpdevice.h @@ -18,12 +18,12 @@ #ifndef MTPDEVICE_H #define MTPDEVICE_H -#include "connecteddevice.h" +#include #include #include -#include +#include "connecteddevice.h" struct LIBMTP_mtpdevice_struct; @@ -74,7 +74,7 @@ private: SongList songs_to_add_; SongList songs_to_remove_; - boost::scoped_ptr connection_; + std::unique_ptr connection_; }; #endif // MTPDEVICE_H diff --git a/src/devices/mtploader.cpp b/src/devices/mtploader.cpp index 17015f18a..abb4329b4 100644 --- a/src/devices/mtploader.cpp +++ b/src/devices/mtploader.cpp @@ -15,17 +15,19 @@ along with Clementine. If not, see . */ +#include "mtploader.h" + +#include + #include "connecteddevice.h" #include "mtpconnection.h" -#include "mtploader.h" #include "core/song.h" #include "core/taskmanager.h" #include "library/librarybackend.h" -#include - -MtpLoader::MtpLoader(const QUrl& url, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device) +MtpLoader::MtpLoader( + const QUrl& url, TaskManager* task_manager, + LibraryBackend* backend, std::shared_ptr device) : QObject(NULL), device_(device), url_(url), diff --git a/src/devices/mtploader.h b/src/devices/mtploader.h index c38401f89..357597d41 100644 --- a/src/devices/mtploader.h +++ b/src/devices/mtploader.h @@ -18,11 +18,11 @@ #ifndef MTPLOADER_H #define MTPLOADER_H +#include + #include #include -#include - class ConnectedDevice; class LibraryBackend; class TaskManager; @@ -32,7 +32,7 @@ class MtpLoader : public QObject { public: MtpLoader(const QUrl& url, TaskManager* task_manager, - LibraryBackend* backend, boost::shared_ptr device); + LibraryBackend* backend, std::shared_ptr device); ~MtpLoader(); public slots: @@ -47,7 +47,7 @@ private: bool TryLoad(); private: - boost::shared_ptr device_; + std::shared_ptr device_; QThread* original_thread_; QUrl url_; diff --git a/src/engines/enginebase.h b/src/engines/enginebase.h index c3e75b0d5..d998639e1 100644 --- a/src/engines/enginebase.h +++ b/src/engines/enginebase.h @@ -27,8 +27,6 @@ #include -#include - #include #include #include @@ -39,7 +37,7 @@ namespace Engine { typedef std::vector Scope; -class Base : public QObject, boost::noncopyable { +class Base : public QObject { Q_OBJECT public: @@ -153,6 +151,7 @@ class Base : public QObject, boost::noncopyable { private: bool about_to_end_emitted_; + Q_DISABLE_COPY(Base); }; diff --git a/src/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index 94f77a357..21eb614b7 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -41,11 +41,11 @@ const int GstEnginePipeline::kEqBandFrequencies[] = { 60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000}; int GstEnginePipeline::sId = 1; -GstElementDeleter* GstEnginePipeline::sElementDeleter = NULL; +GstElementDeleter* GstEnginePipeline::sElementDeleter = nullptr; GstEnginePipeline::GstEnginePipeline(GstEngine* engine) - : QObject(NULL), + : QObject(nullptr), engine_(engine), id_(sId++), valid_(false), @@ -75,20 +75,19 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine) pending_seek_nanosec_(-1), volume_percent_(100), volume_modifier_(1.0), - fader_(NULL), - pipeline_(NULL), - uridecodebin_(NULL), - audiobin_(NULL), - queue_(NULL), - audioconvert_(NULL), - rgvolume_(NULL), - rglimiter_(NULL), - audioconvert2_(NULL), - equalizer_(NULL), - stereo_panorama_(NULL), - volume_(NULL), - audioscale_(NULL), - audiosink_(NULL) + pipeline_(nullptr), + uridecodebin_(nullptr), + audiobin_(nullptr), + queue_(nullptr), + audioconvert_(nullptr), + rgvolume_(nullptr), + rglimiter_(nullptr), + audioconvert2_(nullptr), + equalizer_(nullptr), + stereo_panorama_(nullptr), + volume_(nullptr), + audioscale_(nullptr), + audiosink_(nullptr) { if (!sElementDeleter) { sElementDeleter = new GstElementDeleter; diff --git a/src/engines/gstenginepipeline.h b/src/engines/gstenginepipeline.h index a1b8c9efb..65e23003f 100644 --- a/src/engines/gstenginepipeline.h +++ b/src/engines/gstenginepipeline.h @@ -18,6 +18,8 @@ #ifndef GSTENGINEPIPELINE_H #define GSTENGINEPIPELINE_H +#include + #include #include #include @@ -27,7 +29,6 @@ #include #include -#include #include "engine_fwd.h" @@ -253,7 +254,7 @@ class GstEnginePipeline : public QObject { int volume_percent_; qreal volume_modifier_; - boost::scoped_ptr fader_; + std::unique_ptr fader_; QBasicTimer fader_fudge_timer_; bool use_fudge_timer_; diff --git a/src/globalsearch/spotifysearchprovider.cpp b/src/globalsearch/spotifysearchprovider.cpp index 0dfc6bdd4..5f955c27b 100644 --- a/src/globalsearch/spotifysearchprovider.cpp +++ b/src/globalsearch/spotifysearchprovider.cpp @@ -18,9 +18,7 @@ #include "spotifysearchprovider.h" #include - -#include -#include +#include #include "core/logging.h" #include "internet/internetmodel.h" @@ -219,8 +217,8 @@ QStringList SpotifySearchProvider::GetSuggestions(int count) { QStringList all_suggestions = suggestions_.toList(); - boost::mt19937 gen(std::time(0)); - boost::uniform_int<> random(0, all_suggestions.size() - 1); + std::mt19937 gen(std::time(0)); + std::uniform_int_distribution<> random(0, all_suggestions.size() - 1); QSet candidates; diff --git a/src/internet/cloudfileservice.h b/src/internet/cloudfileservice.h index ef3627cc5..d31a54ccc 100644 --- a/src/internet/cloudfileservice.h +++ b/src/internet/cloudfileservice.h @@ -3,6 +3,8 @@ #include "internetservice.h" +#include + #include #include "core/tagreaderclient.h" @@ -61,8 +63,8 @@ class CloudFileService : public InternetService { LibraryModel* library_model_; QSortFilterProxyModel* library_sort_model_; - boost::scoped_ptr context_menu_; - boost::scoped_ptr cover_manager_; + std::unique_ptr context_menu_; + std::unique_ptr cover_manager_; PlaylistManager* playlist_manager_; TaskManager* task_manager_; diff --git a/src/internet/digitallyimportedservicebase.h b/src/internet/digitallyimportedservicebase.h index 6380cb9a3..d58f3c614 100644 --- a/src/internet/digitallyimportedservicebase.h +++ b/src/internet/digitallyimportedservicebase.h @@ -18,7 +18,7 @@ #ifndef DIGITALLYIMPORTEDSERVICEBASE_H #define DIGITALLYIMPORTEDSERVICEBASE_H -#include +#include #include "digitallyimportedclient.h" #include "internetservice.h" @@ -104,7 +104,7 @@ private: QStandardItem* root_; - boost::scoped_ptr context_menu_; + std::unique_ptr context_menu_; QStandardItem* context_item_; CachedList saved_channels_; diff --git a/src/internet/groovesharkservice.cpp b/src/internet/groovesharkservice.cpp index 6b3b30155..697bfadd6 100644 --- a/src/internet/groovesharkservice.cpp +++ b/src/internet/groovesharkservice.cpp @@ -17,7 +17,7 @@ #include "groovesharkservice.h" -#include +#include #include #include @@ -1286,8 +1286,8 @@ void GroovesharkService::DeletePlaylist(int playlist_id) { if (!playlists_.contains(playlist_id)) { return; } - - boost::scoped_ptr confirmation_dialog(new QMessageBox( + + std::unique_ptr confirmation_dialog(new QMessageBox( QMessageBox::Question, tr("Delete Grooveshark playlist"), tr("Are you sure you want to delete this playlist?"), QMessageBox::Yes | QMessageBox::Cancel)); diff --git a/src/internet/lastfmservice.cpp b/src/internet/lastfmservice.cpp index 2636524fe..b8c2c6730 100644 --- a/src/internet/lastfmservice.cpp +++ b/src/internet/lastfmservice.cpp @@ -32,8 +32,6 @@ #include "lastfmservice.h" -#include - #include #include @@ -61,7 +59,6 @@ #include "ui/iconloader.h" #include "ui/settingsdialog.h" -using boost::scoped_ptr; using lastfm::XmlQuery; uint qHash(const lastfm::Track& track) { diff --git a/src/internet/lastfmservice.h b/src/internet/lastfmservice.h index a25b21f33..9b832ea7a 100644 --- a/src/internet/lastfmservice.h +++ b/src/internet/lastfmservice.h @@ -18,6 +18,8 @@ #ifndef LASTFMSERVICE_H #define LASTFMSERVICE_H +#include + namespace lastfm { class RadioStation; class Track; @@ -40,8 +42,6 @@ uint qHash(const lastfm::Track& track); #include #include -#include - class LastFMUrlHandler; class QAction; @@ -198,9 +198,9 @@ class LastFMService : public InternetService { QQueue playlist_; bool already_scrobbled_; - boost::scoped_ptr station_dialog_; + std::unique_ptr station_dialog_; - boost::scoped_ptr context_menu_; + std::unique_ptr context_menu_; QAction* remove_action_; QAction* add_artist_action_; QAction* add_tag_action_; diff --git a/src/internet/magnatunedownloaddialog.cpp b/src/internet/magnatunedownloaddialog.cpp index 91afc8f4d..edf645223 100644 --- a/src/internet/magnatunedownloaddialog.cpp +++ b/src/internet/magnatunedownloaddialog.cpp @@ -16,13 +16,8 @@ */ #include "magnatunedownloaddialog.h" -#include "magnatuneservice.h" -#include "internetmodel.h" -#include "ui_magnatunedownloaddialog.h" -#include "core/logging.h" -#include "core/network.h" -#include "core/utilities.h" -#include "widgets/progressitemdelegate.h" + +#include #include #include @@ -35,6 +30,14 @@ #include #include +#include "magnatuneservice.h" +#include "internetmodel.h" +#include "ui_magnatunedownloaddialog.h" +#include "core/logging.h" +#include "core/network.h" +#include "core/utilities.h" +#include "widgets/progressitemdelegate.h" + MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service, QWidget *parent) : QDialog(parent), @@ -275,7 +278,7 @@ QString MagnatuneDownloadDialog::GetOutputFilename() { void MagnatuneDownloadDialog::closeEvent(QCloseEvent* e) { if (current_reply_ && current_reply_->isRunning()) { - boost::scoped_ptr message_box(new QMessageBox( + std::unique_ptr message_box(new QMessageBox( QMessageBox::Question, tr("Really cancel?"), tr("Closing this window will cancel the download."), QMessageBox::Abort, this)); diff --git a/src/internet/magnatunedownloaddialog.h b/src/internet/magnatunedownloaddialog.h index 397a91705..7c0ffb438 100644 --- a/src/internet/magnatunedownloaddialog.h +++ b/src/internet/magnatunedownloaddialog.h @@ -18,12 +18,12 @@ #ifndef MAGNATUNEDOWNLOADDIALOG_H #define MAGNATUNEDOWNLOADDIALOG_H +#include + #include #include #include -#include - #include "core/song.h" class MagnatuneService; @@ -71,7 +71,7 @@ private: QNetworkAccessManager* network_; QNetworkReply* current_reply_; - boost::scoped_ptr download_file_; + std::unique_ptr download_file_; int next_row_; }; diff --git a/src/internet/magnatuneservice.cpp b/src/internet/magnatuneservice.cpp index 7b00a0fa2..78c343bd4 100644 --- a/src/internet/magnatuneservice.cpp +++ b/src/internet/magnatuneservice.cpp @@ -51,8 +51,6 @@ #include -using boost::shared_ptr; - const char* MagnatuneService::kServiceName = "Magnatune"; const char* MagnatuneService::kSettingsGroup = "Magnatune"; const char* MagnatuneService::kSongsTable = "magnatune_songs"; diff --git a/src/internet/savedradio.h b/src/internet/savedradio.h index d3a1d9ec6..619aeec66 100644 --- a/src/internet/savedradio.h +++ b/src/internet/savedradio.h @@ -18,9 +18,9 @@ #ifndef SAVEDRADIO_H #define SAVEDRADIO_H -#include "internetservice.h" +#include -#include +#include "internetservice.h" class QMenu; @@ -83,7 +83,7 @@ class SavedRadio : public InternetService { StreamList streams_; - boost::scoped_ptr edit_dialog_; + std::unique_ptr edit_dialog_; }; #endif // SAVEDRADIO_H diff --git a/src/internet/skydriveservice.cpp b/src/internet/skydriveservice.cpp index 0de877394..e3023f5c1 100644 --- a/src/internet/skydriveservice.cpp +++ b/src/internet/skydriveservice.cpp @@ -1,7 +1,6 @@ #include "skydriveservice.h" -#include -using boost::scoped_ptr; +#include #include @@ -158,7 +157,7 @@ QUrl SkydriveService::GetStreamingUrlFromSongId(const QString& file_id) { QUrl url(QString(kSkydriveBase) + file_id); QNetworkRequest request(url); AddAuthorizationHeader(&request); - scoped_ptr reply(network_->get(request)); + std::unique_ptr reply(network_->get(request)); WaitForSignal(reply.get(), SIGNAL(finished())); QJson::Parser parser; diff --git a/src/internet/spotifyservice.h b/src/internet/spotifyservice.h index 338114067..530aa0a5d 100644 --- a/src/internet/spotifyservice.h +++ b/src/internet/spotifyservice.h @@ -8,8 +8,6 @@ #include #include -#include - class Playlist; class SearchBoxWidget; class SpotifyServer; diff --git a/src/library/library.h b/src/library/library.h index f174845ea..70681cda6 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -21,8 +21,6 @@ #include #include -#include - class Application; class Database; class LibraryBackend; diff --git a/src/library/libraryfilterwidget.h b/src/library/libraryfilterwidget.h index 572bb1185..25074ee8c 100644 --- a/src/library/libraryfilterwidget.h +++ b/src/library/libraryfilterwidget.h @@ -18,9 +18,9 @@ #ifndef LIBRARYFILTERWIDGET_H #define LIBRARYFILTERWIDGET_H -#include +#include -#include +#include #include "librarymodel.h" @@ -91,7 +91,7 @@ class LibraryFilterWidget : public QWidget { Ui_LibraryFilterWidget* ui_; LibraryModel* model_; - boost::scoped_ptr group_by_dialog_; + std::unique_ptr group_by_dialog_; SettingsDialog* settings_dialog_; QMenu* filter_age_menu_; diff --git a/src/library/librarymodel.h b/src/library/librarymodel.h index b2ad18443..a5d708de6 100644 --- a/src/library/librarymodel.h +++ b/src/library/librarymodel.h @@ -32,8 +32,6 @@ #include "playlist/playlistmanager.h" #include "smartplaylists/generator_fwd.h" -#include - class Application; class AlbumCoverLoader; class LibraryDirectoryModel; diff --git a/src/library/libraryview.h b/src/library/libraryview.h index 85afe7e8a..fb096fa2d 100644 --- a/src/library/libraryview.h +++ b/src/library/libraryview.h @@ -18,13 +18,13 @@ #ifndef LIBRARYVIEW_H #define LIBRARYVIEW_H -#include "core/song.h" -#include "ui/edittagdialog.h" -#include "widgets/autoexpandingtreeview.h" +#include #include -#include +#include "core/song.h" +#include "ui/edittagdialog.h" +#include "widgets/autoexpandingtreeview.h" class Application; class LibraryFilterWidget; @@ -140,8 +140,8 @@ class LibraryView : public AutoExpandingTreeView { QAction* edit_smart_playlist_; QAction* delete_smart_playlist_; - boost::scoped_ptr organise_dialog_; - boost::scoped_ptr edit_tag_dialog_; + std::unique_ptr organise_dialog_; + std::unique_ptr edit_tag_dialog_; bool is_in_keyboard_search_; diff --git a/src/moodbar/moodbarloader.cpp b/src/moodbar/moodbarloader.cpp index dacbe1e0e..2bface572 100644 --- a/src/moodbar/moodbarloader.cpp +++ b/src/moodbar/moodbarloader.cpp @@ -17,7 +17,7 @@ #include "moodbarloader.h" -#include +#include #include #include @@ -101,7 +101,7 @@ MoodbarLoader::Result MoodbarLoader::Load( } // Maybe it exists in the cache? - boost::scoped_ptr cache_device(cache_->data(url)); + std::unique_ptr cache_device(cache_->data(url)); if (cache_device) { qLog(Info) << "Loading cached moodbar data for" << filename; *data = cache_device->readAll(); diff --git a/src/networkremote/networkremote.h b/src/networkremote/networkremote.h index 5de164eb3..716538251 100644 --- a/src/networkremote/networkremote.h +++ b/src/networkremote/networkremote.h @@ -1,7 +1,7 @@ #ifndef NETWORKREMOTE_H #define NETWORKREMOTE_H -#include +#include #include #include @@ -30,10 +30,10 @@ public slots: void SendKitten(quint64 id, const QImage& kitten); private: - boost::scoped_ptr server_; - boost::scoped_ptr server_ipv6_; - boost::scoped_ptr incoming_data_parser_; - boost::scoped_ptr outgoing_data_creator_; + std::unique_ptr server_; + std::unique_ptr server_ipv6_; + std::unique_ptr incoming_data_parser_; + std::unique_ptr outgoing_data_creator_; quint16 port_; bool use_remote_; diff --git a/src/networkremote/outgoingdatacreator.h b/src/networkremote/outgoingdatacreator.h index 264da2add..fb243a3db 100644 --- a/src/networkremote/outgoingdatacreator.h +++ b/src/networkremote/outgoingdatacreator.h @@ -1,6 +1,8 @@ #ifndef OUTGOINGDATACREATOR_H #define OUTGOINGDATACREATOR_H +#include + #include #include #include @@ -24,7 +26,6 @@ #include "songinfo/ultimatelyricsreader.h" #include "remotecontrolmessages.pb.h" #include "remoteclient.h" -#include typedef QList ProviderList; @@ -91,7 +92,7 @@ private: int last_track_position_; bool aww_; - boost::scoped_ptr ultimate_reader_; + std::unique_ptr ultimate_reader_; ProviderList provider_list_; QMap results_; SongInfoFetcher* fetcher_; diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index 8a24ce7f8..cf7721dee 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -21,8 +21,6 @@ #include #include -#include - #include "playlistitem.h" #include "playlistsequence.h" #include "core/tagreaderclient.h" diff --git a/src/playlist/playlistsequence.h b/src/playlist/playlistsequence.h index cfdae520d..0141b09cf 100644 --- a/src/playlist/playlistsequence.h +++ b/src/playlist/playlistsequence.h @@ -18,12 +18,12 @@ #ifndef PLAYLISTSEQUENCE_H #define PLAYLISTSEQUENCE_H +#include + #include #include "core/settingsprovider.h" -#include - class QMenu; class Ui_PlaylistSequence; @@ -79,7 +79,7 @@ class PlaylistSequence : public QWidget { private: Ui_PlaylistSequence* ui_; - boost::scoped_ptr settings_; + std::unique_ptr settings_; QMenu* repeat_menu_; QMenu* shuffle_menu_; diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index 6b897188c..1fb1eca60 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -18,13 +18,13 @@ #ifndef PLAYLISTVIEW_H #define PLAYLISTVIEW_H -#include "playlist.h" +#include #include #include #include -#include +#include "playlist.h" class QCleanlooksStyle; @@ -52,7 +52,7 @@ public: QPainter* painter, const QWidget* widget) const; private: - boost::scoped_ptr cleanlooks_; + std::unique_ptr cleanlooks_; }; diff --git a/src/playlistparsers/xmlparser.h b/src/playlistparsers/xmlparser.h index ee1081f85..33750b028 100644 --- a/src/playlistparsers/xmlparser.h +++ b/src/playlistparsers/xmlparser.h @@ -23,8 +23,6 @@ #include #include -#include - class QDomDocument; class QDomNode; @@ -32,7 +30,7 @@ class XMLParser : public ParserBase { protected: XMLParser(LibraryBackendInterface* library, QObject* parent); - class StreamElement : public boost::noncopyable { + class StreamElement { public: StreamElement(const QString& name, QXmlStreamWriter* stream) : stream_(stream) { stream->writeStartElement(name); @@ -44,6 +42,7 @@ class XMLParser : public ParserBase { private: QXmlStreamWriter* stream_; + Q_DISABLE_COPY(StreamElement); }; }; diff --git a/src/smartplaylists/generator.h b/src/smartplaylists/generator.h index 7046e87ec..561e3b8f5 100644 --- a/src/smartplaylists/generator.h +++ b/src/smartplaylists/generator.h @@ -20,14 +20,13 @@ #include "playlist/playlistitem.h" -#include -#include +#include class LibraryBackend; namespace smart_playlists { -class Generator : public QObject, public boost::enable_shared_from_this { +class Generator : public QObject, public std::enable_shared_from_this { Q_OBJECT public: @@ -38,7 +37,7 @@ public: static const int kDefaultDynamicFuture; // Creates a new Generator of the given type - static boost::shared_ptr Create(const QString& type); + static std::shared_ptr Create(const QString& type); // Should be called before Load on a new Generator void set_library(LibraryBackend* backend) { backend_ = backend; } diff --git a/src/smartplaylists/generator_fwd.h b/src/smartplaylists/generator_fwd.h index db110b0bd..4f46aa135 100644 --- a/src/smartplaylists/generator_fwd.h +++ b/src/smartplaylists/generator_fwd.h @@ -18,13 +18,13 @@ #ifndef PLAYLISTGENERATOR_FWD_H #define PLAYLISTGENERATOR_FWD_H -#include +#include namespace smart_playlists { class Generator; -typedef boost::shared_ptr GeneratorPtr; +typedef std::shared_ptr GeneratorPtr; } // namespace diff --git a/src/smartplaylists/querywizardplugin.cpp b/src/smartplaylists/querywizardplugin.cpp index e0991a582..2bc4f5b6d 100644 --- a/src/smartplaylists/querywizardplugin.cpp +++ b/src/smartplaylists/querywizardplugin.cpp @@ -55,7 +55,7 @@ public: SearchPreview* preview_; - boost::scoped_ptr ui_; + std::unique_ptr ui_; }; class QueryWizardPlugin::SortPage : public QWizardPage { @@ -161,8 +161,8 @@ int QueryWizardPlugin::CreatePages(QWizard* wizard, int finish_page_id) { } void QueryWizardPlugin::SetGenerator(GeneratorPtr g) { - boost::shared_ptr gen = - boost::dynamic_pointer_cast(g); + std::shared_ptr gen = + std::dynamic_pointer_cast(g); if (!gen) return; Search search = gen->search(); @@ -198,10 +198,10 @@ void QueryWizardPlugin::SetGenerator(GeneratorPtr g) { } GeneratorPtr QueryWizardPlugin::CreateGenerator() const { - boost::shared_ptr gen(new QueryGenerator); + std::shared_ptr gen(new QueryGenerator); gen->Load(MakeSearch()); - return boost::static_pointer_cast(gen); + return std::static_pointer_cast(gen); } void QueryWizardPlugin::UpdateSortOrder() { diff --git a/src/smartplaylists/querywizardplugin.h b/src/smartplaylists/querywizardplugin.h index 8213d945b..8dded7c32 100644 --- a/src/smartplaylists/querywizardplugin.h +++ b/src/smartplaylists/querywizardplugin.h @@ -18,12 +18,13 @@ #ifndef QUERYWIZARDPLUGIN_H #define QUERYWIZARDPLUGIN_H -#include "search.h" #include "wizardplugin.h" +#include + #include -#include +#include "search.h" class Ui_SmartPlaylistQuerySearchPage; class Ui_SmartPlaylistQuerySortPage; @@ -70,7 +71,7 @@ private: Search MakeSearch() const; SearchPage* search_page_; - boost::scoped_ptr sort_ui_; + std::unique_ptr sort_ui_; int previous_scrollarea_max_; }; diff --git a/src/smartplaylists/searchpreview.cpp b/src/smartplaylists/searchpreview.cpp index 08c6065f0..d16db4c25 100644 --- a/src/smartplaylists/searchpreview.cpp +++ b/src/smartplaylists/searchpreview.cpp @@ -15,14 +15,17 @@ along with Clementine. If not, see . */ -#include "querygenerator.h" #include "searchpreview.h" #include "ui_searchpreview.h" -#include "playlist/playlist.h" + +#include #include #include +#include "querygenerator.h" +#include "playlist/playlist.h" + namespace smart_playlists { typedef QFuture Future; @@ -94,7 +97,7 @@ PlaylistItemList DoRunSearch(GeneratorPtr gen) { void SearchPreview::RunSearch(const Search& search) { generator_.reset(new QueryGenerator); generator_->set_library(backend_); - boost::dynamic_pointer_cast(generator_)->Load(search); + std::dynamic_pointer_cast(generator_)->Load(search); ui_->busy_container->show(); ui_->count_label->hide(); @@ -109,7 +112,7 @@ void SearchPreview::SearchFinished() { FutureWatcher* watcher = static_cast(sender()); watcher->deleteLater(); - last_search_ = boost::dynamic_pointer_cast(generator_)->search(); + last_search_ = std::dynamic_pointer_cast(generator_)->search(); generator_.reset(); if (pending_search_.is_valid() && pending_search_ != last_search_) { diff --git a/src/songinfo/echonestbiographies.cpp b/src/songinfo/echonestbiographies.cpp index 720b7ab08..20ed63fc5 100644 --- a/src/songinfo/echonestbiographies.cpp +++ b/src/songinfo/echonestbiographies.cpp @@ -16,18 +16,19 @@ */ #include "echonestbiographies.h" -#include "songinfotextview.h" -#include "core/logging.h" + +#include #include -#include +#include "songinfotextview.h" +#include "core/logging.h" struct EchoNestBiographies::Request { Request(int id) : id_(id), artist_(new Echonest::Artist) {} int id_; - boost::scoped_ptr artist_; + std::unique_ptr artist_; }; EchoNestBiographies::EchoNestBiographies() { @@ -46,7 +47,7 @@ EchoNestBiographies::EchoNestBiographies() { } void EchoNestBiographies::FetchInfo(int id, const Song& metadata) { - boost::shared_ptr request(new Request(id)); + std::shared_ptr request(new Request(id)); request->artist_->setName(metadata.artist()); QNetworkReply* reply = request->artist_->fetchBiographies(); @@ -70,7 +71,7 @@ void EchoNestBiographies::RequestFinished() { QSet already_seen; - foreach (const Echonest::Biography& bio, request->artist_->biographies()) { + for (const Echonest::Biography& bio : request->artist_->biographies()) { QString canonical_site = bio.site().toLower(); canonical_site.replace(QRegExp("[^a-z]"),""); diff --git a/src/songinfo/echonestbiographies.h b/src/songinfo/echonestbiographies.h index 5223fa114..8e8175fd1 100644 --- a/src/songinfo/echonestbiographies.h +++ b/src/songinfo/echonestbiographies.h @@ -18,9 +18,9 @@ #ifndef ECHONESTBIOGRAPHIES_H #define ECHONESTBIOGRAPHIES_H -#include "songinfoprovider.h" +#include -#include +#include "songinfoprovider.h" class QNetworkReply; @@ -40,7 +40,7 @@ private: QMap site_icons_; struct Request; - typedef boost::shared_ptr RequestPtr; + typedef std::shared_ptr RequestPtr; QMap requests_; }; diff --git a/src/songinfo/echonestimages.cpp b/src/songinfo/echonestimages.cpp index 87a5c8559..b16e9c20c 100644 --- a/src/songinfo/echonestimages.cpp +++ b/src/songinfo/echonestimages.cpp @@ -16,21 +16,22 @@ */ #include "echonestimages.h" -#include "core/logging.h" + +#include #include -#include +#include "core/logging.h" struct EchoNestImages::Request { Request(int id) : id_(id), artist_(new Echonest::Artist) {} int id_; - boost::scoped_ptr artist_; + std::unique_ptr artist_; }; void EchoNestImages::FetchInfo(int id, const Song& metadata) { - boost::shared_ptr request(new Request(id)); + std::shared_ptr request(new Request(id)); request->artist_->setName(metadata.artist()); QNetworkReply* reply = request->artist_->fetchImages(); diff --git a/src/songinfo/echonestimages.h b/src/songinfo/echonestimages.h index ddd3f66e5..25585b9bb 100644 --- a/src/songinfo/echonestimages.h +++ b/src/songinfo/echonestimages.h @@ -18,9 +18,9 @@ #ifndef ECHONESTIMAGES_H #define ECHONESTIMAGES_H -#include "songinfoprovider.h" +#include -#include +#include "songinfoprovider.h" class QNetworkReply; @@ -35,7 +35,7 @@ private slots: private: struct Request; - typedef boost::shared_ptr RequestPtr; + typedef std::shared_ptr RequestPtr; QMap requests_; }; diff --git a/src/songinfo/echonesttags.cpp b/src/songinfo/echonesttags.cpp index 5e4c902ab..6ed53afe2 100644 --- a/src/songinfo/echonesttags.cpp +++ b/src/songinfo/echonesttags.cpp @@ -16,22 +16,23 @@ */ #include "echonesttags.h" -#include "tagwidget.h" -#include "core/logging.h" + +#include #include -#include +#include "tagwidget.h" +#include "core/logging.h" struct EchoNestTags::Request { Request(int id) : id_(id), artist_(new Echonest::Artist) {} int id_; - boost::scoped_ptr artist_; + std::unique_ptr artist_; }; void EchoNestTags::FetchInfo(int id, const Song& metadata) { - boost::shared_ptr request(new Request(id)); + std::shared_ptr request(new Request(id)); request->artist_->setName(metadata.artist()); QNetworkReply* reply = request->artist_->fetchTerms(); @@ -65,7 +66,7 @@ void EchoNestTags::RequestFinished() { widget->SetIcon(data.icon_); - foreach (const Echonest::Term& term, request->artist_->terms()) { + for (const Echonest::Term& term : request->artist_->terms()) { widget->AddTag(term.name()); if (widget->count() >= 10) break; diff --git a/src/songinfo/echonesttags.h b/src/songinfo/echonesttags.h index 7ef9284b3..96bddd86d 100644 --- a/src/songinfo/echonesttags.h +++ b/src/songinfo/echonesttags.h @@ -18,9 +18,9 @@ #ifndef ECHONESTTAGS_H #define ECHONESTTAGS_H -#include "songinfoprovider.h" +#include -#include +#include "songinfoprovider.h" class QNetworkReply; @@ -35,7 +35,7 @@ private slots: private: struct Request; - typedef boost::shared_ptr RequestPtr; + typedef std::shared_ptr RequestPtr; QMap requests_; }; diff --git a/src/songinfo/songinfoview.h b/src/songinfo/songinfoview.h index 744a4d5c0..031226b5b 100644 --- a/src/songinfo/songinfoview.h +++ b/src/songinfo/songinfoview.h @@ -18,9 +18,9 @@ #ifndef SONGINFOVIEW_H #define SONGINFOVIEW_H -#include "songinfobase.h" +#include -#include +#include "songinfobase.h" class UltimateLyricsProvider; class UltimateLyricsReader; @@ -52,7 +52,7 @@ private slots: void UltimateLyricsParsed(); private: - boost::scoped_ptr ultimate_reader_; + std::unique_ptr ultimate_reader_; }; #endif // SONGINFOVIEW_H diff --git a/src/songinfo/ultimatelyricsprovider.cpp b/src/songinfo/ultimatelyricsprovider.cpp index ccab2ce4c..95bcf0037 100644 --- a/src/songinfo/ultimatelyricsprovider.cpp +++ b/src/songinfo/ultimatelyricsprovider.cpp @@ -26,8 +26,6 @@ #include #include -#include - const int UltimateLyricsProvider::kRedirectLimit = 5; diff --git a/src/ui/albumcovermanager.cpp b/src/ui/albumcovermanager.cpp index ab98af032..43112cca3 100644 --- a/src/ui/albumcovermanager.cpp +++ b/src/ui/albumcovermanager.cpp @@ -211,7 +211,7 @@ void AlbumCoverManager::showEvent(QShowEvent *) { void AlbumCoverManager::closeEvent(QCloseEvent* e) { if (!cover_fetching_tasks_.isEmpty()) { - boost::scoped_ptr message_box(new QMessageBox( + std::unique_ptr message_box(new QMessageBox( QMessageBox::Question, tr("Really cancel?"), tr("Closing this window will stop searching for album covers."), QMessageBox::Abort, this)); diff --git a/src/ui/albumcovermanagerlist.cpp b/src/ui/albumcovermanagerlist.cpp index a73cb9f5a..faa671f51 100644 --- a/src/ui/albumcovermanagerlist.cpp +++ b/src/ui/albumcovermanagerlist.cpp @@ -15,16 +15,17 @@ along with Clementine. If not, see . */ -#include "albumcovermanager.h" #include "albumcovermanagerlist.h" -#include "library/librarybackend.h" -#include "playlist/songmimedata.h" -#include +#include #include #include +#include "albumcovermanager.h" +#include "library/librarybackend.h" +#include "playlist/songmimedata.h" + AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent) : QListWidget(parent), manager_(NULL) @@ -48,7 +49,7 @@ QMimeData* AlbumCoverManagerList::mimeData(const QList items) } // Get the QAbstractItemModel data so the picture works - boost::scoped_ptr orig_data(QListWidget::mimeData(items)); + std::unique_ptr orig_data(QListWidget::mimeData(items)); SongMimeData* mime_data = new SongMimeData; mime_data->backend = manager_->backend(); diff --git a/src/ui/albumcoversearcher.h b/src/ui/albumcoversearcher.h index 710e9ce8a..f028cce40 100644 --- a/src/ui/albumcoversearcher.h +++ b/src/ui/albumcoversearcher.h @@ -18,14 +18,12 @@ #ifndef ALBUMCOVERSEARCHER_H #define ALBUMCOVERSEARCHER_H -#include "covers/albumcoverfetcher.h" -#include "covers/albumcoverloaderoptions.h" - #include #include #include -#include +#include "covers/albumcoverfetcher.h" +#include "covers/albumcoverloaderoptions.h" class AlbumCoverLoader; class Application; @@ -35,7 +33,6 @@ class QModelIndex; class QStandardItem; class QStandardItemModel; - class SizeOverlayDelegate : public QStyledItemDelegate { public: static const int kMargin; diff --git a/src/ui/globalshortcutgrabber.mm b/src/ui/globalshortcutgrabber.mm index dfefc5feb..b46536ad1 100644 --- a/src/ui/globalshortcutgrabber.mm +++ b/src/ui/globalshortcutgrabber.mm @@ -24,11 +24,9 @@ #include -#include - #import "core/mac_utilities.h" -class MacMonitorWrapper : boost::noncopyable { +class MacMonitorWrapper { public: explicit MacMonitorWrapper(id monitor) : local_monitor_(monitor) { @@ -40,6 +38,7 @@ class MacMonitorWrapper : boost::noncopyable { private: id local_monitor_; + Q_DISABLE_COPY(MacMonitorWrapper); }; bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) { diff --git a/src/ui/globalshortcutssettingspage.h b/src/ui/globalshortcutssettingspage.h index dd830ee74..593b14a5c 100644 --- a/src/ui/globalshortcutssettingspage.h +++ b/src/ui/globalshortcutssettingspage.h @@ -18,11 +18,11 @@ #ifndef GLOBALSHORTCUTSSETTINGSPAGE_H #define GLOBALSHORTCUTSSETTINGSPAGE_H +#include + #include #include -#include - #include "core/globalshortcuts.h" #include "ui/settingspage.h" @@ -64,7 +64,7 @@ private: Ui_GlobalShortcutsSettingsPage* ui_; bool initialised_; - boost::scoped_ptr grabber_; + std::unique_ptr grabber_; QSettings settings_; QMap shortcuts_; diff --git a/src/ui/macsystemtrayicon.h b/src/ui/macsystemtrayicon.h index 154473bd7..1cfa5f6ab 100644 --- a/src/ui/macsystemtrayicon.h +++ b/src/ui/macsystemtrayicon.h @@ -18,14 +18,13 @@ #ifndef MACSYSTEMTRAYICON_H #define MACSYSTEMTRAYICON_H -#include "systemtrayicon.h" +#include -#include -#include +#include "systemtrayicon.h" class MacSystemTrayIconPrivate; -class MacSystemTrayIcon : public SystemTrayIcon, boost::noncopyable { +class MacSystemTrayIcon : public SystemTrayIcon { Q_OBJECT public: @@ -52,8 +51,8 @@ protected: private: QPixmap orange_icon_; QPixmap grey_icon_; - - boost::scoped_ptr p_; + std::unique_ptr p_; + Q_DISABLE_COPY(MacSystemTrayIcon); }; #endif // MACSYSTEMTRAYICON_H diff --git a/src/ui/macsystemtrayicon.mm b/src/ui/macsystemtrayicon.mm index 3142c14ea..b15282d7a 100644 --- a/src/ui/macsystemtrayicon.mm +++ b/src/ui/macsystemtrayicon.mm @@ -56,7 +56,7 @@ } @end -class MacSystemTrayIconPrivate : boost::noncopyable { +class MacSystemTrayIconPrivate { public: MacSystemTrayIconPrivate() { dock_menu_ = [[NSMenu alloc] initWithTitle:@"DockMenu"]; @@ -153,6 +153,8 @@ class MacSystemTrayIconPrivate : boost::noncopyable { NSMenuItem* now_playing_; NSMenuItem* now_playing_artist_; NSMenuItem* now_playing_title_; + + Q_DISABLE_COPY(MacSystemTrayIconPrivate); }; MacSystemTrayIcon::MacSystemTrayIcon(QObject* parent) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index bc9a43f24..303016a43 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -174,18 +174,8 @@ MainWindow::MainWindow(Application* app, device_view_(new DeviceView(this)), song_info_view_(new SongInfoView(this)), artist_info_view_(new ArtistInfoView(this)), - settings_dialog_(NULL), - cover_manager_(NULL), equalizer_(new Equalizer), - error_dialog_(NULL), organise_dialog_(new OrganiseDialog(app_->task_manager())), - queue_manager_(NULL), -#ifdef ENABLE_VISUALISATIONS - visualisation_(NULL), -#endif -#ifdef HAVE_WIIMOTEDEV - wiimotedev_shortcuts_(NULL), -#endif playlist_menu_(new QMenu(this)), playlist_add_to_another_(NULL), playlistitem_actions_separator_(NULL), diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index 9d25ab01e..b62357833 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -18,7 +18,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include #include #include @@ -278,8 +278,8 @@ class MainWindow : public QMainWindow, public PlatformInterface { Application* app_; SystemTrayIcon* tray_icon_; OSD* osd_; - boost::scoped_ptr edit_tag_dialog_; - boost::scoped_ptr about_dialog_; + std::unique_ptr edit_tag_dialog_; + std::unique_ptr about_dialog_; GlobalShortcuts* global_shortcuts_; Remote* remote_; @@ -293,25 +293,25 @@ class MainWindow : public QMainWindow, public PlatformInterface { SongInfoView* song_info_view_; ArtistInfoView* artist_info_view_; - boost::scoped_ptr settings_dialog_; - boost::scoped_ptr add_stream_dialog_; - boost::scoped_ptr cover_manager_; - boost::scoped_ptr equalizer_; - boost::scoped_ptr transcode_dialog_; - boost::scoped_ptr error_dialog_; - boost::scoped_ptr organise_dialog_; - boost::scoped_ptr queue_manager_; + std::unique_ptr settings_dialog_; + std::unique_ptr add_stream_dialog_; + std::unique_ptr cover_manager_; + std::unique_ptr equalizer_; + std::unique_ptr transcode_dialog_; + std::unique_ptr error_dialog_; + std::unique_ptr organise_dialog_; + std::unique_ptr queue_manager_; - boost::scoped_ptr tag_fetcher_; - boost::scoped_ptr track_selection_dialog_; + std::unique_ptr tag_fetcher_; + std::unique_ptr track_selection_dialog_; PlaylistItemList autocomplete_tag_items_; #ifdef ENABLE_VISUALISATIONS - boost::scoped_ptr visualisation_; + std::unique_ptr visualisation_; #endif #ifdef HAVE_WIIMOTEDEV - boost::scoped_ptr wiimotedev_shortcuts_; + std::unique_ptr wiimotedev_shortcuts_; #endif QAction* library_show_all_; diff --git a/src/ui/organisedialog.h b/src/ui/organisedialog.h index 30b6dfba1..9ac05e01f 100644 --- a/src/ui/organisedialog.h +++ b/src/ui/organisedialog.h @@ -18,6 +18,8 @@ #ifndef ORGANISEDIALOG_H #define ORGANISEDIALOG_H +#include + #include #include #include @@ -25,8 +27,6 @@ #include "core/organiseformat.h" #include "core/song.h" -#include - class LibraryWatcher; class OrganiseErrorDialog; class TaskManager; @@ -80,7 +80,7 @@ private: SongList preview_songs_; quint64 total_size_; - boost::scoped_ptr error_dialog_; + std::unique_ptr error_dialog_; bool resized_by_user_; }; diff --git a/src/visualisations/projectmvisualisation.cpp b/src/visualisations/projectmvisualisation.cpp index 536c5ccbe..673bb95a2 100644 --- a/src/visualisations/projectmvisualisation.cpp +++ b/src/visualisations/projectmvisualisation.cpp @@ -48,15 +48,13 @@ ProjectMVisualisation::ProjectMVisualisation(QObject *parent) : QGraphicsScene(parent), - projectm_(NULL), - preset_model_(NULL), + preset_model_(nullptr), mode_(Random), duration_(15), - texture_size_(512) -{ + texture_size_(512) { connect(this, SIGNAL(sceneRectChanged(QRectF)), SLOT(SceneRectChanged(QRectF))); - for (int i=0 ; i + #include #include #include -#include - #include "engines/bufferconsumer.h" class projectM; @@ -77,12 +77,12 @@ private: int IndexOfPreset(const QString& path) const; private: - boost::scoped_ptr projectm_; + std::unique_ptr projectm_; ProjectMPresetModel* preset_model_; Mode mode_; int duration_; - boost::scoped_ptr temporary_font_; + std::unique_ptr temporary_font_; std::vector default_rating_list_; diff --git a/src/widgets/fancytabwidget.h b/src/widgets/fancytabwidget.h index cbdbb2167..5d9d412fa 100644 --- a/src/widgets/fancytabwidget.h +++ b/src/widgets/fancytabwidget.h @@ -30,6 +30,8 @@ #ifndef FANCYTABWIDGET_H #define FANCYTABWIDGET_H +#include + #include #include #include @@ -37,8 +39,6 @@ #include #include -#include - class QActionGroup; class QMenu; class QPainter; @@ -219,7 +219,7 @@ private: QMenu* menu_; - boost::scoped_ptr proxy_style_; + std::unique_ptr proxy_style_; }; } // namespace Internal diff --git a/src/widgets/nowplayingwidget.h b/src/widgets/nowplayingwidget.h index 498e1a44e..aee49956a 100644 --- a/src/widgets/nowplayingwidget.h +++ b/src/widgets/nowplayingwidget.h @@ -18,12 +18,12 @@ #ifndef NOWPLAYINGWIDGET_H #define NOWPLAYINGWIDGET_H -#include "core/song.h" -#include "covers/albumcoverloaderoptions.h" +#include #include -#include +#include "core/song.h" +#include "covers/albumcoverloaderoptions.h" class AlbumCoverChoiceController; class Application; @@ -141,8 +141,8 @@ private: static const char* kHypnotoadPath; QAction* bask_in_his_glory_action_; - boost::scoped_ptr hypnotoad_; - boost::scoped_ptr big_hypnotoad_; + std::unique_ptr hypnotoad_; + std::unique_ptr big_hypnotoad_; bool aww_; KittenLoader* kittens_; diff --git a/src/widgets/osd.h b/src/widgets/osd.h index dddd7648e..af1dacbfd 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -18,6 +18,8 @@ #ifndef OSD_H #define OSD_H +#include + #include #include #include @@ -36,7 +38,6 @@ class QDBusPendingCallWatcher; #ifdef HAVE_DBUS # include -# include QDBusArgument& operator<< (QDBusArgument& arg, const QImage& image); const QDBusArgument& operator>> (const QDBusArgument& arg, QImage& image); @@ -136,7 +137,7 @@ class OSD : public QObject { #endif // Q_OS_DARWIN #ifdef HAVE_DBUS - boost::scoped_ptr interface_; + std::unique_ptr interface_; uint notification_id_; QDateTime last_notification_time_; #endif diff --git a/src/widgets/osd_x11.cpp b/src/widgets/osd_x11.cpp index afe8e0db1..831b9761a 100644 --- a/src/widgets/osd_x11.cpp +++ b/src/widgets/osd_x11.cpp @@ -15,19 +15,20 @@ along with Clementine. If not, see . */ -#include "config.h" #include "osd.h" -#include "core/logging.h" + +#include #include +#include "config.h" +#include "core/logging.h" + #ifdef HAVE_DBUS #include "dbus/notification.h" #include #include -using boost::scoped_ptr; - QDBusArgument& operator<< (QDBusArgument& arg, const QImage& image) { if (image.isNull()) { // Sometimes this gets called with a null QImage for no obvious reason. @@ -142,7 +143,7 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message, #ifdef HAVE_DBUS void OSD::CallFinished(QDBusPendingCallWatcher* watcher) { - scoped_ptr w(watcher); + std::unique_ptr w(watcher); QDBusPendingReply reply = *watcher; if (reply.isError()) { diff --git a/src/wiimotedev/shortcuts.cpp b/src/wiimotedev/shortcuts.cpp index c01e4f4f8..6379a5ab1 100644 --- a/src/wiimotedev/shortcuts.cpp +++ b/src/wiimotedev/shortcuts.cpp @@ -36,7 +36,6 @@ WiimotedevShortcuts::WiimotedevShortcuts(OSD* osd, QWidget* window, QObject* par wiimotedev_device_(1), wiimotedev_enable_(true), wiimotedev_focus_(false), - wiimotedev_iface_(NULL), wiimotedev_notification_(true) { connect(this, SIGNAL(WiiremoteActived(int)), osd_, SLOT(WiiremoteActived(int))); diff --git a/src/wiimotedev/shortcuts.h b/src/wiimotedev/shortcuts.h index 046a5829b..be0206789 100644 --- a/src/wiimotedev/shortcuts.h +++ b/src/wiimotedev/shortcuts.h @@ -18,8 +18,9 @@ #ifndef WIIMOTEDEV_SHORTCUTS_H #define WIIMOTEDEV_SHORTCUTS_H +#include + #include -#include #include "dbus/wiimotedev.h" #include "core/player.h" @@ -77,7 +78,7 @@ private: quint32 wiimotedev_device_; bool wiimotedev_enable_; bool wiimotedev_focus_; - boost::scoped_ptr wiimotedev_iface_; + std::unique_ptr wiimotedev_iface_; bool wiimotedev_notification_; QHash actions_; diff --git a/src/wiimotedev/wiimoteshortcutgrabber.h b/src/wiimotedev/wiimoteshortcutgrabber.h index 130e167e8..d02c9fc8e 100644 --- a/src/wiimotedev/wiimoteshortcutgrabber.h +++ b/src/wiimotedev/wiimoteshortcutgrabber.h @@ -18,11 +18,11 @@ #ifndef WIIMOTESHORTCUTGRABBER_H #define WIIMOTESHORTCUTGRABBER_H +#include + #include #include -#include - #include "wiimotesettingspage.h" #include "dbus/wiimotedev.h" @@ -47,7 +47,7 @@ private: Ui_WiimoteShortcutGrabber* ui_; WiimoteSettingsPage* config_; - boost::scoped_ptr wiimotedev_iface_; + std::unique_ptr wiimotedev_iface_; quint32 wiimotedev_device_; quint64 wiimotedev_buttons_;