diff --git a/src/collection/collection.cpp b/src/collection/collection.cpp index 53c1f4a58..297a00112 100644 --- a/src/collection/collection.cpp +++ b/src/collection/collection.cpp @@ -63,6 +63,8 @@ SCollection::SCollection(Application *app, QObject *parent) save_playcounts_to_files_(false), save_ratings_to_files_(false) { + setObjectName(QLatin1String(metaObject()->className())); + original_thread_ = thread(); backend_ = make_shared(); @@ -94,6 +96,7 @@ void SCollection::Init() { watcher_ = new CollectionWatcher(Song::Source::Collection); watcher_thread_ = new Thread(this); + watcher_thread_->setObjectName(watcher_->objectName()); watcher_thread_->SetIoPriority(Utilities::IoPriority::IOPRIO_CLASS_IDLE); diff --git a/src/collection/collectionbackend.cpp b/src/collection/collectionbackend.cpp index 20b52a8e0..694839ce6 100644 --- a/src/collection/collectionbackend.cpp +++ b/src/collection/collectionbackend.cpp @@ -72,17 +72,21 @@ CollectionBackend::CollectionBackend(QObject *parent) CollectionBackend::~CollectionBackend() { - qLog(Debug) << "Collection backend" << this << "for" << Song::TextForSource(source_) << "deleted"; + qLog(Debug) << "Collection backend" << this << "deleted"; } void CollectionBackend::Init(SharedPtr db, SharedPtr task_manager, const Song::Source source, const QString &songs_table, const QString &dirs_table, const QString &subdirs_table) { + + setObjectName(source == Song::Source::Collection ? QLatin1String(metaObject()->className()) : QStringLiteral("%1%2").arg(Song::DescriptionForSource(source), QLatin1String(metaObject()->className()))); + db_ = db; task_manager_ = task_manager; source_ = source; songs_table_ = songs_table; dirs_table_ = dirs_table; subdirs_table_ = subdirs_table; + } void CollectionBackend::Close() { diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index ec847fe54..9ffd8d71c 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -101,6 +101,8 @@ CollectionModel::CollectionModel(SharedPtr backend, Applicati total_album_count_(0), loading_(false) { + setObjectName(backend_->source() == Song::Source::Collection ? QLatin1String(metaObject()->className()) : QStringLiteral("%1%2").arg(Song::DescriptionForSource(backend_->source()), QLatin1String(metaObject()->className()))); + filter_->setSourceModel(this); filter_->setSortRole(Role_SortText); filter_->sort(0); @@ -149,7 +151,7 @@ CollectionModel::CollectionModel(SharedPtr backend, Applicati CollectionModel::~CollectionModel() { - qLog(Debug) << "Collection model" << this << "for" << Song::TextForSource(backend_->source()) << "deleted"; + qLog(Debug) << "Collection model" << this << "deleted"; beginResetModel(); Clear(); diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index 1ed887172..10acf23ed 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -104,6 +104,8 @@ CollectionView::CollectionView(QWidget *parent) is_in_keyboard_search_(false), delete_files_(false) { + setObjectName(QLatin1String(metaObject()->className())); + setItemDelegate(new CollectionItemDelegate(this)); setAttribute(Qt::WA_MacShowFocusRect, false); setHeaderHidden(true); diff --git a/src/collection/collectionwatcher.cpp b/src/collection/collectionwatcher.cpp index 1415a4eb9..cdef7c01c 100644 --- a/src/collection/collectionwatcher.cpp +++ b/src/collection/collectionwatcher.cpp @@ -98,6 +98,8 @@ CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent) cue_parser_(new CueParser(backend_, this)), last_scan_time_(0) { + setObjectName(source_ == Song::Source::Collection ? QLatin1String(metaObject()->className()) : QStringLiteral("%1%2").arg(Song::DescriptionForSource(source_), QLatin1String(metaObject()->className()))); + original_thread_ = thread(); rescan_timer_->setInterval(2s); diff --git a/src/core/application.cpp b/src/core/application.cpp index d10702a4d..d119df442 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -248,6 +248,8 @@ class ApplicationImpl { Application::Application(QObject *parent) : QObject(parent), p_(new ApplicationImpl(this)) { + setObjectName(QLatin1String(metaObject()->className())); + device_finders()->Init(); collection()->Init(); tag_reader_client(); @@ -275,6 +277,8 @@ QThread *Application::MoveToNewThread(QObject *object) { QThread *thread = new QThread(this); + thread->setObjectName(object->objectName()); + MoveToThread(object, thread); thread->start(); diff --git a/src/core/database.cpp b/src/core/database.cpp index ec647ffb5..4222ff1b5 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -71,6 +71,8 @@ Database::Database(Application *app, QObject *parent, const QString &database_na startup_schema_version_(-1), original_thread_(nullptr) { + setObjectName(QLatin1String(metaObject()->className())); + original_thread_ = thread(); { diff --git a/src/core/player.cpp b/src/core/player.cpp index 1bd9dceda..9cae30b63 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -101,6 +101,8 @@ Player::Player(Application *app, QObject *parent) volume_increment_(5), play_offset_nanosec_(0) { + setObjectName(QLatin1String(metaObject()->className())); + Settings s; s.beginGroup(BackendSettingsPage::kSettingsGroup); EngineBase::Type enginetype = EngineBase::TypeFromName(s.value("engine", EngineBase::Name(EngineBase::Type::GStreamer)).toString().toLower()); diff --git a/src/core/tagreaderclient.cpp b/src/core/tagreaderclient.cpp index 23df386c7..bc96611fe 100644 --- a/src/core/tagreaderclient.cpp +++ b/src/core/tagreaderclient.cpp @@ -44,6 +44,8 @@ TagReaderClient *TagReaderClient::sInstance = nullptr; TagReaderClient::TagReaderClient(QObject *parent) : QObject(parent), worker_pool_(new WorkerPool(this)) { + setObjectName(QLatin1String(metaObject()->className())); + sInstance = this; original_thread_ = thread(); diff --git a/src/core/taskmanager.cpp b/src/core/taskmanager.cpp index b16169c5e..15c468b52 100644 --- a/src/core/taskmanager.cpp +++ b/src/core/taskmanager.cpp @@ -30,7 +30,11 @@ #include "taskmanager.h" -TaskManager::TaskManager(QObject *parent) : QObject(parent), next_task_id_(1) {} +TaskManager::TaskManager(QObject *parent) : QObject(parent), next_task_id_(1) { + + setObjectName(QLatin1String(metaObject()->className())); + +} int TaskManager::StartTask(const QString &name) { diff --git a/src/covermanager/albumcoverloader.cpp b/src/covermanager/albumcoverloader.cpp index 7f9590bfb..1e7233233 100644 --- a/src/covermanager/albumcoverloader.cpp +++ b/src/covermanager/albumcoverloader.cpp @@ -57,6 +57,8 @@ AlbumCoverLoader::AlbumCoverLoader(QObject *parent) load_image_async_id_(1), original_thread_(nullptr) { + setObjectName(QLatin1String(metaObject()->className())); + original_thread_ = thread(); } diff --git a/src/covermanager/currentalbumcoverloader.cpp b/src/covermanager/currentalbumcoverloader.cpp index 3d8fd47dc..2a52c51b4 100644 --- a/src/covermanager/currentalbumcoverloader.cpp +++ b/src/covermanager/currentalbumcoverloader.cpp @@ -44,6 +44,8 @@ CurrentAlbumCoverLoader::CurrentAlbumCoverLoader(Application *app, QObject *pare temp_file_pattern_(QDir::tempPath() + QStringLiteral("/strawberry-cover-XXXXXX.jpg")), id_(0) { + setObjectName(QLatin1String(metaObject()->className())); + options_.options = AlbumCoverLoaderOptions::Option::RawImageData | AlbumCoverLoaderOptions::Option::OriginalImage | AlbumCoverLoaderOptions::Option::ScaledImage; options_.desired_scaled_size = QSize(120, 120); options_.default_cover = QStringLiteral(":/pictures/cdcase.png"); diff --git a/src/device/devicedatabasebackend.cpp b/src/device/devicedatabasebackend.cpp index c6ad6d9d5..9309384b4 100644 --- a/src/device/devicedatabasebackend.cpp +++ b/src/device/devicedatabasebackend.cpp @@ -47,6 +47,8 @@ DeviceDatabaseBackend::DeviceDatabaseBackend(QObject *parent) db_(nullptr), original_thread_(nullptr) { + setObjectName(QLatin1String(metaObject()->className())); + original_thread_ = thread(); } diff --git a/src/device/devicelister.cpp b/src/device/devicelister.cpp index 6ef1dba1a..f4c1a1397 100644 --- a/src/device/devicelister.cpp +++ b/src/device/devicelister.cpp @@ -43,6 +43,8 @@ DeviceLister::DeviceLister(QObject *parent) original_thread_(nullptr), next_mount_request_id_(0) { + setObjectName(QLatin1String(metaObject()->className())); + original_thread_ = thread(); } @@ -60,6 +62,7 @@ DeviceLister::~DeviceLister() { void DeviceLister::Start() { thread_ = new QThread; + thread_->setObjectName(objectName()); QObject::connect(thread_, &QThread::started, this, &DeviceLister::ThreadStarted); moveToThread(thread_); diff --git a/src/device/devicemanager.cpp b/src/device/devicemanager.cpp index 4d80a5d22..d5637cf03 100644 --- a/src/device/devicemanager.cpp +++ b/src/device/devicemanager.cpp @@ -94,6 +94,8 @@ DeviceManager::DeviceManager(Application *app, QObject *parent) app_(app), not_connected_overlay_(IconLoader::Load(QStringLiteral("edit-delete"))) { + setObjectName(QLatin1String(metaObject()->className())); + thread_pool_.setMaxThreadCount(1); QObject::connect(&*app_->task_manager(), &TaskManager::TasksChanged, this, &DeviceManager::TasksChanged); diff --git a/src/engine/devicefinders.cpp b/src/engine/devicefinders.cpp index 2c5f93a1f..c99ea38b6 100644 --- a/src/engine/devicefinders.cpp +++ b/src/engine/devicefinders.cpp @@ -49,7 +49,11 @@ # endif // _MSC_VER #endif // Q_OS_WIN32 -DeviceFinders::DeviceFinders(QObject *parent) : QObject(parent) {} +DeviceFinders::DeviceFinders(QObject *parent) : QObject(parent) { + + setObjectName(QLatin1String(metaObject()->className())); + +} DeviceFinders::~DeviceFinders() { qDeleteAll(device_finders_); diff --git a/src/lyrics/lyricsproviders.cpp b/src/lyrics/lyricsproviders.cpp index 13d3ec14a..ac30f1c94 100644 --- a/src/lyrics/lyricsproviders.cpp +++ b/src/lyrics/lyricsproviders.cpp @@ -44,6 +44,8 @@ using std::make_shared; LyricsProviders::LyricsProviders(QObject *parent) : QObject(parent), thread_(new QThread(this)), network_(make_shared()) { + setObjectName(QLatin1String(metaObject()->className())); + thread_->setObjectName(objectName()); network_->moveToThread(thread_); thread_->start(); diff --git a/src/main.cpp b/src/main.cpp index 6b998e17d..9f82cffd3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -205,6 +205,8 @@ int main(int argc, char *argv[]) { return 0; } + QThread::currentThread()->setObjectName(QStringLiteral("Main")); + QGuiApplication::setWindowIcon(IconLoader::Load(QStringLiteral("strawberry"))); #if defined(USE_BUNDLE) diff --git a/src/playlist/playlistbackend.cpp b/src/playlist/playlistbackend.cpp index a9a9fd917..dda409c50 100644 --- a/src/playlist/playlistbackend.cpp +++ b/src/playlist/playlistbackend.cpp @@ -65,6 +65,8 @@ PlaylistBackend::PlaylistBackend(Application *app, QObject *parent) db_(app_->database()), original_thread_(nullptr) { + setObjectName(QLatin1String(metaObject()->className())); + original_thread_ = thread(); } diff --git a/src/playlist/playlistmanager.cpp b/src/playlist/playlistmanager.cpp index 7638ba359..222dadc75 100644 --- a/src/playlist/playlistmanager.cpp +++ b/src/playlist/playlistmanager.cpp @@ -75,6 +75,8 @@ PlaylistManager::PlaylistManager(Application *app, QObject *parent) active_(-1), playlists_loading_(0) { + setObjectName(QLatin1String(metaObject()->className())); + QObject::connect(&*app_->player(), &Player::Paused, this, &PlaylistManager::SetActivePaused); QObject::connect(&*app_->player(), &Player::Playing, this, &PlaylistManager::SetActivePlaying); QObject::connect(&*app_->player(), &Player::Stopped, this, &PlaylistManager::SetActiveStopped);