1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-02-02 10:36:45 +01:00

Use static QMetaObject::invokeMethod

This commit is contained in:
Jonas Kvinge 2021-09-09 21:53:14 +02:00
parent d35d3aabc3
commit 24a3ac9811
17 changed files with 53 additions and 53 deletions

View File

@ -130,7 +130,7 @@ void AbstractMessageHandler<MT>::SendMessage(const MessageType &message) {
template <typename MT>
void AbstractMessageHandler<MT>::SendMessageAsync(const MessageType &message) {
std::string data = message.SerializeAsString();
metaObject()->invokeMethod(this, "WriteMessage", Qt::QueuedConnection, Q_ARG(QByteArray, QByteArray(data.data(), data.size())));
QMetaObject::invokeMethod(this, "WriteMessage", Qt::QueuedConnection, Q_ARG(QByteArray, QByteArray(data.data(), data.size())));
}
template<typename MT>

View File

@ -219,7 +219,7 @@ void WorkerPool<HandlerType>::SetExecutableName(const QString &executable_name)
template <typename HandlerType>
void WorkerPool<HandlerType>::Start() {
metaObject()->invokeMethod(this, "DoStart");
QMetaObject::invokeMethod(this, "DoStart");
}
template <typename HandlerType>
@ -382,7 +382,7 @@ WorkerPool<HandlerType>::SendMessageWithReply(MessageType *message) {
}
// Wake up the main thread
metaObject()->invokeMethod(this, "SendQueuedMessages", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "SendQueuedMessages", Qt::QueuedConnection);
return reply;

View File

@ -82,7 +82,7 @@ void CollectionBackend::Close() {
}
void CollectionBackend::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void CollectionBackend::Exit() {
@ -110,31 +110,31 @@ void CollectionBackend::ReportErrors(const CollectionQuery &query) {
}
void CollectionBackend::LoadDirectoriesAsync() {
metaObject()->invokeMethod(this, "LoadDirectories", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "LoadDirectories", Qt::QueuedConnection);
}
void CollectionBackend::UpdateTotalSongCountAsync() {
metaObject()->invokeMethod(this, "UpdateTotalSongCount", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "UpdateTotalSongCount", Qt::QueuedConnection);
}
void CollectionBackend::UpdateTotalArtistCountAsync() {
metaObject()->invokeMethod(this, "UpdateTotalArtistCount", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "UpdateTotalArtistCount", Qt::QueuedConnection);
}
void CollectionBackend::UpdateTotalAlbumCountAsync() {
metaObject()->invokeMethod(this, "UpdateTotalAlbumCount", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "UpdateTotalAlbumCount", Qt::QueuedConnection);
}
void CollectionBackend::IncrementPlayCountAsync(const int id) {
metaObject()->invokeMethod(this, "IncrementPlayCount", Qt::QueuedConnection, Q_ARG(int, id));
QMetaObject::invokeMethod(this, "IncrementPlayCount", Qt::QueuedConnection, Q_ARG(int, id));
}
void CollectionBackend::IncrementSkipCountAsync(const int id, const float progress) {
metaObject()->invokeMethod(this, "IncrementSkipCount", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(float, progress));
QMetaObject::invokeMethod(this, "IncrementSkipCount", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(float, progress));
}
void CollectionBackend::ResetStatisticsAsync(const int id) {
metaObject()->invokeMethod(this, "ResetStatistics", Qt::QueuedConnection, Q_ARG(int, id));
QMetaObject::invokeMethod(this, "ResetStatistics", Qt::QueuedConnection, Q_ARG(int, id));
}
void CollectionBackend::LoadDirectories() {
@ -501,7 +501,7 @@ void CollectionBackend::AddOrUpdateSubdirs(const SubdirectoryList &subdirs) {
}
void CollectionBackend::AddOrUpdateSongsAsync(const SongList &songs) {
metaObject()->invokeMethod(this, "AddOrUpdateSongs", Qt::QueuedConnection, Q_ARG(SongList, songs));
QMetaObject::invokeMethod(this, "AddOrUpdateSongs", Qt::QueuedConnection, Q_ARG(SongList, songs));
}
void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
@ -1366,7 +1366,7 @@ CollectionBackend::Album CollectionBackend::GetAlbumArt(const QString &effective
void CollectionBackend::UpdateManualAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic) {
metaObject()->invokeMethod(this, "UpdateManualAlbumArt", Qt::QueuedConnection, Q_ARG(QString, effective_albumartist), Q_ARG(QString, album), Q_ARG(QUrl, cover_url), Q_ARG(bool, clear_art_automatic));
QMetaObject::invokeMethod(this, "UpdateManualAlbumArt", Qt::QueuedConnection, Q_ARG(QString, effective_albumartist), Q_ARG(QString, album), Q_ARG(QUrl, cover_url), Q_ARG(bool, clear_art_automatic));
}
@ -1433,7 +1433,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &effective_albumartis
void CollectionBackend::UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url) {
metaObject()->invokeMethod(this, "UpdateAutomaticAlbumArt", Qt::QueuedConnection, Q_ARG(QString, effective_albumartist), Q_ARG(QString, album), Q_ARG(QUrl, cover_url));
QMetaObject::invokeMethod(this, "UpdateAutomaticAlbumArt", Qt::QueuedConnection, Q_ARG(QString, effective_albumartist), Q_ARG(QString, album), Q_ARG(QUrl, cover_url));
}
@ -1806,11 +1806,11 @@ void CollectionBackend::UpdateSongsRating(const QList<int> &id_list, const doubl
}
void CollectionBackend::UpdateSongRatingAsync(const int id, const double rating) {
metaObject()->invokeMethod(this, "UpdateSongRating", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(double, rating));
QMetaObject::invokeMethod(this, "UpdateSongRating", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(double, rating));
}
void CollectionBackend::UpdateSongsRatingAsync(const QList<int> &ids, const double rating) {
metaObject()->invokeMethod(this, "UpdateSongsRating", Qt::QueuedConnection, Q_ARG(QList<int>, ids), Q_ARG(double, rating));
QMetaObject::invokeMethod(this, "UpdateSongsRating", Qt::QueuedConnection, Q_ARG(QList<int>, ids), Q_ARG(double, rating));
}
void CollectionBackend::UpdateLastSeen(const int directory_id, const int expire_unavailable_songs_days) {

View File

@ -120,7 +120,7 @@ CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
}
void CollectionWatcher::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void CollectionWatcher::Exit() {

View File

@ -97,7 +97,7 @@ Database::~Database() {
}
void Database::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void Database::Exit() {

View File

@ -2117,7 +2117,7 @@ void MainWindow::SongSaveComplete(TagReaderReply *reply, const QPersistentModelI
if (reply->is_successful() && idx.isValid()) {
app_->playlist_manager()->current()->ReloadItems(QList<int>() << idx.row());
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
}

View File

@ -714,7 +714,7 @@ void SongLoader::StopTypefindAsync(bool success) {
state_ = Finished;
success_ = success;
metaObject()->invokeMethod(this, "StopTypefind", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "StopTypefind", Qt::QueuedConnection);
}
#endif
@ -726,7 +726,7 @@ void SongLoader::ScheduleTimeoutAsync() {
ScheduleTimeout();
}
else {
metaObject()->invokeMethod(this, "ScheduleTimeout", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "ScheduleTimeout", Qt::QueuedConnection);
}
}

View File

@ -55,7 +55,7 @@ TagReaderClient::TagReaderClient(QObject *parent) : QObject(parent), worker_pool
void TagReaderClient::Start() { worker_pool_->Start(); }
void TagReaderClient::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void TagReaderClient::Exit() {
@ -137,7 +137,7 @@ void TagReaderClient::ReadFileBlocking(const QString &filename, Song *song) {
if (reply->WaitForFinished()) {
song->InitFromProtobuf(reply->message().read_file_response().metadata());
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
}
@ -151,7 +151,7 @@ bool TagReaderClient::SaveFileBlocking(const QString &filename, const Song &meta
if (reply->WaitForFinished()) {
ret = reply->message().save_file_response().success();
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
return ret;
@ -167,7 +167,7 @@ bool TagReaderClient::IsMediaFileBlocking(const QString &filename) {
if (reply->WaitForFinished()) {
ret = reply->message().is_media_file_response().success();
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
return ret;
@ -184,7 +184,7 @@ QByteArray TagReaderClient::LoadEmbeddedArtBlocking(const QString &filename) {
const std::string &data_str = reply->message().load_embedded_art_response().data();
ret = QByteArray(data_str.data(), data_str.size());
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
return ret;
@ -201,7 +201,7 @@ QImage TagReaderClient::LoadEmbeddedArtAsImageBlocking(const QString &filename)
const std::string &data_str = reply->message().load_embedded_art_response().data();
ret.loadFromData(QByteArray(data_str.data(), data_str.size()));
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
return ret;
@ -217,7 +217,7 @@ bool TagReaderClient::SaveEmbeddedArtBlocking(const QString &filename, const QBy
if (reply->WaitForFinished()) {
ret = reply->message().save_embedded_art_response().success();
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
return ret;

View File

@ -78,7 +78,7 @@ AlbumCoverLoader::AlbumCoverLoader(QObject *parent)
void AlbumCoverLoader::ExitAsync() {
stop_requested_ = true;
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
@ -310,7 +310,7 @@ quint64 AlbumCoverLoader::EnqueueTask(Task &task) {
tasks_.enqueue(task);
}
metaObject()->invokeMethod(this, "ProcessTasks", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "ProcessTasks", Qt::QueuedConnection);
return task.id;
@ -549,7 +549,7 @@ qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, co
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
metaObject()->invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QString, cover_filename));
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QString, cover_filename));
return id;
}
@ -558,7 +558,7 @@ qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, co
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
metaObject()->invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QImage, image));
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QImage, image));
return id;
}
@ -567,7 +567,7 @@ qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, co
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
metaObject()->invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QByteArray, image_data));
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QByteArray, image_data));
return id;
}
@ -576,7 +576,7 @@ qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const Q
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
metaObject()->invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QString, cover_filename));
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QString, cover_filename));
return id;
}
@ -585,7 +585,7 @@ qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const Q
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
metaObject()->invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QImage, image));
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QImage, image));
return id;
}
@ -594,7 +594,7 @@ qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const Q
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
metaObject()->invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QByteArray, image_data));
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QByteArray, image_data));
return id;
}
@ -710,6 +710,6 @@ void AlbumCoverLoader::SaveEmbeddedArtFinished(const qint64 id, TagReaderReply *
emit SaveEmbeddedCoverAsyncFinished(id, reply->is_successful(), cleared);
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
}

View File

@ -62,7 +62,7 @@ void DeviceDatabaseBackend::Close() {
}
void DeviceDatabaseBackend::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void DeviceDatabaseBackend::Exit() {

View File

@ -73,13 +73,13 @@ void DeviceLister::ThreadStarted() { Init(); }
int DeviceLister::MountDeviceAsync(const QString &id) {
const int request_id = next_mount_request_id_++;
metaObject()->invokeMethod(this, "MountDevice", Qt::QueuedConnection, Q_ARG(QString, id), Q_ARG(int, request_id));
QMetaObject::invokeMethod(this, "MountDevice", Qt::QueuedConnection, Q_ARG(QString, id), Q_ARG(int, request_id));
return request_id;
}
void DeviceLister::UnmountDeviceAsync(const QString &id) {
metaObject()->invokeMethod(this, "UnmountDevice", Qt::QueuedConnection, Q_ARG(QString, id));
QMetaObject::invokeMethod(this, "UnmountDevice", Qt::QueuedConnection, Q_ARG(QString, id));
}
void DeviceLister::MountDevice(const QString &id, const int request_id) {
@ -87,7 +87,7 @@ void DeviceLister::MountDevice(const QString &id, const int request_id) {
}
void DeviceLister::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void DeviceLister::Exit() {

View File

@ -85,7 +85,7 @@ bool FilesystemDevice::Init() {
}
void FilesystemDevice::CloseAsync() {
metaObject()->invokeMethod(this, "Close", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Close", Qt::QueuedConnection);
}
void FilesystemDevice::Close() {

View File

@ -1335,7 +1335,7 @@ void EditTagDialog::SongSaveTagsComplete(TagReaderReply *reply, const QString &f
collection_songs_.insert(song.id(), song);
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
if (save_tag_pending_ <= 0 && save_art_pending_ <= 0) AcceptFinished();
@ -1377,7 +1377,7 @@ void EditTagDialog::SongSaveArtComplete(TagReaderReply *reply, const QString &fi
app_->current_albumcover_loader()->LoadAlbumCover(song);
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
if (save_tag_pending_ <= 0 && save_art_pending_ <= 0) AcceptFinished();

View File

@ -27,7 +27,7 @@
GstElementDeleter::GstElementDeleter(QObject *parent) : QObject(parent) {}
void GstElementDeleter::DeleteElementLater(GstElement *element) {
metaObject()->invokeMethod(this, "DeleteElement", Qt::QueuedConnection, Q_ARG(GstElement*, element));
QMetaObject::invokeMethod(this, "DeleteElement", Qt::QueuedConnection, Q_ARG(GstElement*, element));
}
void GstElementDeleter::DeleteElement(GstElement *element) {

View File

@ -427,7 +427,7 @@ void Playlist::SongSaveComplete(TagReaderReply *reply, const QPersistentModelInd
}
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
}
@ -1472,7 +1472,7 @@ void Playlist::ScheduleSaveAsync() {
ScheduleSave();
}
else {
metaObject()->invokeMethod(this, "ScheduleSave", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "ScheduleSave", Qt::QueuedConnection);
}
}

View File

@ -79,7 +79,7 @@ void PlaylistBackend::Close() {
}
void PlaylistBackend::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void PlaylistBackend::Exit() {
@ -324,7 +324,7 @@ PlaylistItemPtr PlaylistBackend::RestoreCueData(PlaylistItemPtr item, std::share
void PlaylistBackend::SavePlaylistAsync(int playlist, const PlaylistItemList &items, int last_played, PlaylistGeneratorPtr dynamic) {
metaObject()->invokeMethod(this, "SavePlaylist", Qt::QueuedConnection, Q_ARG(int, playlist), Q_ARG(PlaylistItemList, items), Q_ARG(int, last_played), Q_ARG(PlaylistGeneratorPtr, dynamic));
QMetaObject::invokeMethod(this, "SavePlaylist", Qt::QueuedConnection, Q_ARG(int, playlist), Q_ARG(PlaylistItemList, items), Q_ARG(int, last_played), Q_ARG(PlaylistGeneratorPtr, dynamic));
}

View File

@ -46,7 +46,7 @@ void RadioBackend::Close() {
}
void RadioBackend::ExitAsync() {
metaObject()->invokeMethod(this, "Exit", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "Exit", Qt::QueuedConnection);
}
void RadioBackend::Exit() {
@ -59,7 +59,7 @@ void RadioBackend::Exit() {
}
void RadioBackend::AddChannelsAsync(const RadioChannelList &channels) {
metaObject()->invokeMethod(this, "AddChannels", Qt::QueuedConnection, Q_ARG(RadioChannelList, channels));
QMetaObject::invokeMethod(this, "AddChannels", Qt::QueuedConnection, Q_ARG(RadioChannelList, channels));
}
void RadioBackend::AddChannels(const RadioChannelList &channels) {
@ -87,7 +87,7 @@ void RadioBackend::AddChannels(const RadioChannelList &channels) {
void RadioBackend::GetChannelsAsync() {
metaObject()->invokeMethod(this, "GetChannels", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "GetChannels", Qt::QueuedConnection);
}
@ -119,7 +119,7 @@ void RadioBackend::GetChannels() {
}
void RadioBackend::DeleteChannelsAsync() {
metaObject()->invokeMethod(this, "DeleteChannels", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "DeleteChannels", Qt::QueuedConnection);
}
void RadioBackend::DeleteChannels() {