Fix use of emit

Adds missing emits.

QTreeView::collapse and QTreeView::expand are slots, not signals. So
remove emit.
This commit is contained in:
Jonas Kvinge 2021-07-14 00:57:48 +02:00 committed by John Maguire
parent 1d1d3b157f
commit f379ad84d4
8 changed files with 30 additions and 29 deletions

View File

@ -119,7 +119,7 @@ void GlobalShortcuts::AddRatingShortcut(const QString& id, const QString& name,
const QKeySequence& default_key) {
Shortcut shortcut = AddShortcut(id, name, default_key);
connect(shortcut.action, &QAction::triggered,
[this, rating]() { RateCurrentSong(rating); });
[this, rating]() { emit RateCurrentSong(rating); });
}
GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut(

View File

@ -681,7 +681,7 @@ void DeviceManager::Forget(QModelIndex idx) {
info->LoadIcon(info->BestBackend()->lister_->DeviceIcons(id),
info->friendly_name_);
dataChanged(idx, idx);
emit dataChanged(idx, idx);
}
}

View File

@ -132,7 +132,7 @@ void Udisks2Lister::UnmountDevice(const QString& id) {
}
device_data_.remove(id);
DeviceRemoved(id);
emit DeviceRemoved(id);
}
}
@ -251,7 +251,7 @@ void Udisks2Lister::RemoveDevice(const QDBusObjectPath& device_path) {
qLog(Debug) << "UDisks2 device removed: " << device_path.path();
device_data_.remove(id);
DeviceRemoved(id);
emit DeviceRemoved(id);
}
QList<QDBusObjectPath> Udisks2Lister::GetMountedPartitionsFromDBusArgument(
@ -297,7 +297,7 @@ void Udisks2Lister::HandleFinishedMountJob(
<< " | Partition = " << partition_data.dbus_path;
QWriteLocker locker(&device_data_lock_);
device_data_[partition_data.unique_id()] = partition_data;
DeviceAdded(partition_data.unique_id());
emit DeviceAdded(partition_data.unique_id());
}
void Udisks2Lister::HandleFinishedUnmountJob(
@ -320,7 +320,7 @@ void Udisks2Lister::HandleFinishedUnmountJob(
qLog(Debug) << "Partition " << partition_data.dbus_path
<< " has no more mount points, removing it from device list";
device_data_.remove(id);
DeviceRemoved(id);
emit DeviceRemoved(id);
}
}

View File

@ -57,7 +57,7 @@ UrlHandler::LoadResult DigitallyImportedUrlHandler::StartLoading(
}
if (!service_->is_premium_account()) {
service_->StreamError(tr("A premium account is required"));
emit service_->StreamError(tr("A premium account is required"));
return LoadResult(url, LoadResult::Error);
}
@ -91,7 +91,7 @@ void DigitallyImportedUrlHandler::LoadPlaylistFinished(QIODevice* device) {
// Failed to get playlist?
if (songs.count() == 0) {
service_->StreamError(tr("Error loading di.fm playlist"));
emit service_->StreamError(tr("Error loading di.fm playlist"));
emit AsyncLoadComplete(LoadResult(last_original_url_, LoadResult::Error));
return;
}

View File

@ -283,16 +283,16 @@ bool LibraryView::RestoreLevelFocus(const QModelIndex& parent) {
model()->data(current, LibraryModel::Role_Key).toString();
if (!last_selected_container_.isEmpty() &&
last_selected_container_ == text) {
emit expand(current);
expand(current);
setCurrentIndex(current);
return true;
} else if (last_selected_path_.contains(text)) {
emit expand(current);
expand(current);
// If a selected container or song were not found, we've got into a
// wrong subtree
// (happens with "unknown" all the time)
if (!RestoreLevelFocus(current)) {
emit collapse(current);
collapse(current);
} else {
return true;
}

View File

@ -242,7 +242,7 @@ void Queue::Clear() {
}
void Queue::Move(const QList<int>& proxy_rows, int pos) {
layoutAboutToBeChanged();
emit layoutAboutToBeChanged();
QList<QPersistentModelIndex> moved_items;
// Take the items out of the list first, keeping track of whether the
@ -279,7 +279,7 @@ void Queue::Move(const QList<int>& proxy_rows, int pos) {
}
}
layoutChanged();
emit layoutChanged();
}
void Queue::MoveUp(int row) { Move(QList<int>() << row, row - 1); }
@ -400,7 +400,7 @@ void Queue::Remove(QList<int>& proxy_rows) {
std::stable_sort(proxy_rows.begin(), proxy_rows.end());
// reflects immediately changes in the playlist
layoutAboutToBeChanged();
emit layoutAboutToBeChanged();
int removed_rows = 0;
for (int row : proxy_rows) {
@ -412,5 +412,5 @@ void Queue::Remove(QList<int>& proxy_rows) {
removed_rows++;
}
layoutChanged();
emit layoutChanged();
}

View File

@ -107,7 +107,7 @@ void Ripper::Cancel() {
}
transcoder_->Cancel();
RemoveTemporaryDirectory();
emit(Cancelled());
emit Cancelled();
}
void Ripper::TranscodingJobComplete(const QString& input, const QString& output,
@ -235,7 +235,7 @@ void Ripper::Rip() {
it->transcoded_filename);
}
transcoder_->Start();
emit(RippingComplete());
emit RippingComplete();
}
// The progress interval is [0, 200*AddedTracks()], where the first
@ -289,7 +289,7 @@ void Ripper::FileTagged(TagReaderReply* reply) {
<< "files";
if (files_tagged_ == tracks_.length()) {
qLog(Debug) << "CD ripper finished.";
emit(Finished());
emit Finished();
}
reply->deleteLater();

View File

@ -146,18 +146,18 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type,
GstElement* bin) {
SuitableElement best = FindBestElementForMimeType(element_type, mime_type);
if (best.name_.isEmpty()) {
LogLine(tr("Suitable element not found"));
emit LogLine(tr("Suitable element not found"));
return nullptr;
}
LogLine(QString("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
emit LogLine(QString("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
if (best.name_ == "lamemp3enc") {
// Special case: we need to add xingmux and id3v2mux to the pipeline when
// using lamemp3enc because it doesn't write the VBR or ID3v2 headers
// itself.
LogLine("Adding xingmux and id3v2mux to the pipeline");
emit LogLine("Adding xingmux and id3v2mux to the pipeline");
// Create the bin
GstElement* mp3bin = gst_bin_new("mp3bin");
@ -461,16 +461,17 @@ bool Transcoder::StartJob(const Job& job) {
if (!src || !decode || !convert || !sink) return false;
if (!codec && !job.preset.codec_mimetype_.isEmpty()) {
LogLine(tr("Couldn't find an encoder for %1, check you have the correct "
"GStreamer plugins installed")
.arg(job.preset.codec_mimetype_));
emit LogLine(
tr("Couldn't find an encoder for %1, check you have the correct "
"GStreamer plugins installed")
.arg(job.preset.codec_mimetype_));
return false;
}
if (!muxer && !job.preset.muxer_mimetype_.isEmpty()) {
LogLine(tr("Couldn't find a muxer for %1, check you have the correct "
"GStreamer plugins installed")
.arg(job.preset.muxer_mimetype_));
emit LogLine(tr("Couldn't find a muxer for %1, check you have the correct "
"GStreamer plugins installed")
.arg(job.preset.muxer_mimetype_));
return false;
}
@ -618,8 +619,8 @@ void Transcoder::SetElementProperties(const QString& name, GObject* object) {
const QVariant value = s.value(property->name);
if (value.isNull()) continue;
LogLine(QString("Setting %1 property: %2 = %3")
.arg(name, property->name, value.toString()));
emit LogLine(QString("Setting %1 property: %2 = %3")
.arg(name, property->name, value.toString()));
switch (property->value_type) {
case G_TYPE_DOUBLE: