Application: Use shared pointers

Fixes #1239
This commit is contained in:
Jonas Kvinge
2023-07-21 05:55:24 +02:00
parent d6b53f78ab
commit 2e61235403
316 changed files with 2170 additions and 1643 deletions

View File

@@ -35,8 +35,8 @@ MoodbarController::MoodbarController(Application *app, QObject *parent)
app_(app),
enabled_(false) {
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MoodbarController::CurrentSongChanged);
QObject::connect(app_->player(), &Player::Stopped, this, &MoodbarController::PlaybackStopped);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MoodbarController::CurrentSongChanged);
QObject::connect(&*app_->player(), &Player::Stopped, this, &MoodbarController::PlaybackStopped);
ReloadSettings();

View File

@@ -37,8 +37,9 @@
#include <QUrl>
#include <QSettings>
#include "core/application.h"
#include "core/logging.h"
#include "core/scoped_ptr.h"
#include "core/application.h"
#include "moodbarpipeline.h"
@@ -131,7 +132,7 @@ MoodbarLoader::Result MoodbarLoader::Load(const QUrl &url, const bool has_cue, Q
QNetworkCacheMetaData disk_cache_metadata = cache_->metaData(CacheUrlEntry(filename));
if (disk_cache_metadata.isValid()) {
std::unique_ptr<QIODevice> device_cache_file(cache_->data(disk_cache_metadata.url()));
ScopedPtr<QIODevice> device_cache_file(cache_->data(disk_cache_metadata.url()));
if (device_cache_file) {
qLog(Info) << "Loading cached moodbar data for" << filename;
*data = device_cache_file->readAll();

View File

@@ -39,6 +39,8 @@
#include "ext/gstmoodbar/gstfastspectrum.h"
using std::make_unique;
const int MoodbarPipeline::kBands = 128;
MoodbarPipeline::MoodbarPipeline(const QUrl &url, QObject *parent)
@@ -109,7 +111,7 @@ void MoodbarPipeline::Start() {
return;
}
builder_ = std::make_unique<MoodbarBuilder>();
builder_ = make_unique<MoodbarBuilder>();
// Set properties

View File

@@ -23,13 +23,13 @@
#include <QString>
#include <QUrl>
#include <memory>
#include <glib.h>
#include <glib-object.h>
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
#include "core/scoped_ptr.h"
class MoodbarBuilder;
// Creates moodbar data for a single local music file.
@@ -69,7 +69,7 @@ class MoodbarPipeline : public QObject {
GstElement *pipeline_;
GstElement *convert_element_;
std::unique_ptr<MoodbarBuilder> builder_;
ScopedPtr<MoodbarBuilder> builder_;
bool success_;
bool running_;