Connection syntax migration (#637)

This commit is contained in:
Jonas Kvinge
2021-01-26 16:48:04 +01:00
committed by GitHub
parent d57f6303f4
commit bf7c8df353
362 changed files with 2452 additions and 2434 deletions

View File

@@ -35,10 +35,10 @@ class DeviceManager;
CddaDevice::CddaDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), cdda_song_loader_(url) {
connect(&cdda_song_loader_, SIGNAL(SongsLoaded(SongList)), this, SLOT(SongsLoaded(SongList)));
connect(&cdda_song_loader_, SIGNAL(SongsDurationLoaded(SongList)), this, SLOT(SongsLoaded(SongList)));
connect(&cdda_song_loader_, SIGNAL(SongsMetadataLoaded(SongList)), this, SLOT(SongsLoaded(SongList)));
connect(this, SIGNAL(SongsDiscovered(SongList)), model_, SLOT(SongsDiscovered(SongList)));
QObject::connect(&cdda_song_loader_, &CddaSongLoader::SongsLoaded, this, &CddaDevice::SongsLoaded);
QObject::connect(&cdda_song_loader_, &CddaSongLoader::SongsDurationLoaded, this, &CddaDevice::SongsLoaded);
QObject::connect(&cdda_song_loader_, &CddaSongLoader::SongsMetadataLoaded, this, &CddaDevice::SongsLoaded);
QObject::connect(this, &CddaDevice::SongsDiscovered, model_, &CollectionModel::SongsDiscovered);
}

View File

@@ -55,7 +55,7 @@ class CddaDevice : public ConnectedDevice {
static QStringList url_schemes() { return QStringList() << "cdda"; }
signals:
void SongsDiscovered(const SongList &songs);
void SongsDiscovered(SongList songs);
private slots:
void SongsLoaded(const SongList &songs);
@@ -64,5 +64,4 @@ class CddaDevice : public ConnectedDevice {
CddaSongLoader cdda_song_loader_;
};
#endif
#endif // CDDADEVICE_H

View File

@@ -57,4 +57,5 @@ class CddaLister : public DeviceLister {
private:
QStringList devices_list_;
};
#endif // CDDALISTER_H

View File

@@ -195,7 +195,7 @@ void CddaSongLoader::LoadSongs() {
qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid;
MusicBrainzClient *musicbrainz_client = new MusicBrainzClient;
connect(musicbrainz_client, SIGNAL(Finished(QString, QString, MusicBrainzClient::ResultList)), SLOT(AudioCDTagsLoaded(QString, QString, MusicBrainzClient::ResultList)));
QObject::connect(musicbrainz_client, &MusicBrainzClient::DiscIdFinished, this, &CddaSongLoader::AudioCDTagsLoaded);
musicbrainz_client->StartDiscIdRequest(musicbrainz_discid);
g_free(string_mb);
gst_message_unref(msg_tag);

View File

@@ -56,10 +56,10 @@ class CddaSongLoader : public QObject {
QUrl GetUrlFromTrack(const int track_number) const;
signals:
void SongsLoadError(const QString &error);
void SongsLoaded(const SongList &songs);
void SongsDurationLoaded(const SongList &songs, const QString &error = QString());
void SongsMetadataLoaded(const SongList &songs);
void SongsLoadError(QString error);
void SongsLoaded(SongList songs);
void SongsDurationLoaded(SongList songs, QString error = QString());
void SongsMetadataLoaded(SongList songs);
private slots:
#ifdef HAVE_CHROMAPRINT
@@ -73,4 +73,4 @@ class CddaSongLoader : public QObject {
QMutex mutex_load_;
};
#endif // CDDASONGLOADER_H
#endif // CDDASONGLOADER_H

View File

@@ -59,7 +59,7 @@ ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QS
qLog(Debug) << backend_ << "for device" << unique_id_ << "moved to thread" << app_->database()->thread();
if (url_.scheme() != "cdda") {
connect(backend_, SIGNAL(TotalSongCountUpdated(int)), SLOT(BackendTotalSongCountUpdated(int)));
QObject::connect(backend_, &CollectionBackend::TotalSongCountUpdated, this, &ConnectedDevice::BackendTotalSongCountUpdated);
}
backend_->Init(app_->database(),
@@ -105,18 +105,18 @@ void ConnectedDevice::InitBackendDirectory(const QString &mount_point, const boo
}
void ConnectedDevice::ConnectAsync() { emit ConnectFinished(unique_id_, true); }
void ConnectedDevice::ConnectAsync() { emit DeviceConnectFinished(unique_id_, true); }
void ConnectedDevice::Close() {
connect(backend_, SIGNAL(ExitFinished()), this, SLOT(CloseFinished()));
QObject::connect(backend_, &CollectionBackend::ExitFinished, this, &ConnectedDevice::BackendCloseFinished);
backend_->ExitAsync();
}
void ConnectedDevice::CloseFinished() {
void ConnectedDevice::BackendCloseFinished() {
emit CloseFinished(unique_id_);
emit DeviceCloseFinished(unique_id_);
}

View File

@@ -70,13 +70,13 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
virtual void Close();
public slots:
void CloseFinished();
void BackendCloseFinished();
signals:
void TaskStarted(int id);
void SongCountUpdated(int count);
void ConnectFinished(const QString& id, bool success);
void CloseFinished(const QString& id);
void DeviceConnectFinished(QString id, bool success);
void DeviceCloseFinished(QString id);
protected:
void InitBackendDirectory(const QString &mount_point, const bool first_time, const bool rewrite_path = true);
@@ -101,4 +101,3 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
};
#endif // CONNECTEDDEVICE_H

View File

@@ -59,7 +59,7 @@ DeviceLister::~DeviceLister() {
void DeviceLister::Start() {
thread_ = new QThread;
connect(thread_, SIGNAL(started()), SLOT(ThreadStarted()));
QObject::connect(thread_, &QThread::started, this, &DeviceLister::ThreadStarted);
moveToThread(thread_);
thread_->start();

View File

@@ -79,10 +79,10 @@ class DeviceLister : public QObject {
virtual void Exit();
signals:
void DeviceAdded(const QString &id);
void DeviceRemoved(const QString &id);
void DeviceChanged(const QString &id);
void DeviceMounted(const QString &id, int request_id, bool success);
void DeviceAdded(QString id);
void DeviceRemoved(QString id);
void DeviceChanged(QString id);
void DeviceMounted(QString id, int request_id, bool success);
void ExitFinished();
protected:
@@ -103,4 +103,3 @@ class DeviceLister : public QObject {
};
#endif // DEVICELISTER_H

View File

@@ -92,14 +92,14 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
not_connected_overlay_(IconLoader::Load("edit-delete")) {
thread_pool_.setMaxThreadCount(1);
connect(app_->task_manager(), SIGNAL(TasksChanged()), SLOT(TasksChanged()));
QObject::connect(app_->task_manager(), &TaskManager::TasksChanged, this, &DeviceManager::TasksChanged);
// Create the backend in the database thread
backend_ = new DeviceDatabaseBackend;
backend_->moveToThread(app_->database()->thread());
backend_->Init(app_->database());
connect(this, SIGNAL(DeviceCreatedFromDB(DeviceInfo*)), SLOT(AddDeviceFromDB(DeviceInfo*)));
QObject::connect(this, &DeviceManager::DeviceCreatedFromDB, this, &DeviceManager::AddDeviceFromDB);
// This reads from the database and contents on the database mutex, which can be very slow on startup.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -168,7 +168,7 @@ void DeviceManager::CloseDevices() {
if (!info->device_) continue;
if (wait_for_exit_.contains(info->device_.get())) continue;
wait_for_exit_ << info->device_.get();
connect(info->device_.get(), SIGNAL(destroyed()), SLOT(DeviceDestroyed()));
QObject::connect(info->device_.get(), &ConnectedDevice::destroyed, this, &DeviceManager::DeviceDestroyed);
info->device_->Close();
}
if (wait_for_exit_.isEmpty()) CloseListers();
@@ -180,7 +180,7 @@ void DeviceManager::CloseListers() {
for (DeviceLister *lister : listers_) {
if (wait_for_exit_.contains(lister)) continue;
wait_for_exit_ << lister;
connect(lister, SIGNAL(ExitFinished()), this, SLOT(ListerClosed()));
QObject::connect(lister, &DeviceLister::ExitFinished, this, &DeviceManager::ListerClosed);
lister->ExitAsync();
}
if (wait_for_exit_.isEmpty()) CloseBackend();
@@ -191,7 +191,7 @@ void DeviceManager::CloseBackend() {
if (!backend_ || wait_for_exit_.contains(backend_)) return;
wait_for_exit_ << backend_;
connect(backend_, SIGNAL(ExitFinished()), this, SLOT(BackendClosed()));
QObject::connect(backend_, &DeviceDatabaseBackend::ExitFinished, this, &DeviceManager::BackendClosed);
backend_->ExitAsync();
}
@@ -199,7 +199,7 @@ void DeviceManager::CloseBackend() {
void DeviceManager::BackendClosed() {
QObject *obj = qobject_cast<QObject*>(sender());
disconnect(obj, nullptr, this, nullptr);
QObject::disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully closed.";
wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) emit ExitFinished();
@@ -211,7 +211,7 @@ void DeviceManager::ListerClosed() {
DeviceLister *lister = qobject_cast<DeviceLister*>(sender());
if (!lister) return;
disconnect(lister, nullptr, this, nullptr);
QObject::disconnect(lister, nullptr, this, nullptr);
qLog(Debug) << lister << "successfully closed.";
wait_for_exit_.removeAll(lister);
@@ -389,9 +389,9 @@ QVariant DeviceManager::data(const QModelIndex &idx, int role) const {
void DeviceManager::AddLister(DeviceLister *lister) {
listers_ << lister;
connect(lister, SIGNAL(DeviceAdded(QString)), SLOT(PhysicalDeviceAdded(QString)));
connect(lister, SIGNAL(DeviceRemoved(QString)), SLOT(PhysicalDeviceRemoved(QString)));
connect(lister, SIGNAL(DeviceChanged(QString)), SLOT(PhysicalDeviceChanged(QString)));
QObject::connect(lister, &DeviceLister::DeviceAdded, this, &DeviceManager::PhysicalDeviceAdded);
QObject::connect(lister, &DeviceLister::DeviceRemoved, this, &DeviceManager::PhysicalDeviceRemoved);
QObject::connect(lister, &DeviceLister::DeviceChanged, this, &DeviceManager::PhysicalDeviceChanged);
lister->Start();
@@ -657,10 +657,10 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(DeviceInfo *info) {
emit dataChanged(idx, idx);
connect(info->device_.get(), SIGNAL(TaskStarted(int)), SLOT(DeviceTaskStarted(int)));
connect(info->device_.get(), SIGNAL(SongCountUpdated(int)), SLOT(DeviceSongCountUpdated(int)));
connect(info->device_.get(), SIGNAL(ConnectFinished(QString, bool)), SLOT(DeviceConnectFinished(QString, bool)));
connect(info->device_.get(), SIGNAL(CloseFinished(QString)), SLOT(DeviceCloseFinished(QString)));
QObject::connect(info->device_.get(), &ConnectedDevice::TaskStarted, this, &DeviceManager::DeviceTaskStarted);
QObject::connect(info->device_.get(), &ConnectedDevice::SongCountUpdated, this, &DeviceManager::DeviceSongCountUpdated);
QObject::connect(info->device_.get(), &ConnectedDevice::DeviceConnectFinished, this, &DeviceManager::DeviceConnectFinished);
QObject::connect(info->device_.get(), &ConnectedDevice::DeviceCloseFinished, this, &DeviceManager::DeviceCloseFinished);
ret->ConnectAsync();
return ret;

View File

@@ -65,15 +65,14 @@ DeviceProperties::DeviceProperties(QWidget *parent)
ui_(new Ui_DeviceProperties),
manager_(nullptr),
updating_formats_(false) {
ui_->setupUi(this);
connect(ui_->open_device, SIGNAL(clicked()), SLOT(OpenDevice()));
QObject::connect(ui_->open_device, &QPushButton::clicked, this, &DeviceProperties::OpenDevice);
// Maximum height of the icon widget
ui_->icon->setMaximumHeight(
ui_->icon->iconSize().height() +
ui_->icon->horizontalScrollBar()->sizeHint().height() +
ui_->icon->spacing() * 2 + 5);
ui_->icon->setMaximumHeight(ui_->icon->iconSize().height() + ui_->icon->horizontalScrollBar()->sizeHint().height() + ui_->icon->spacing() * 2 + 5);
}
DeviceProperties::~DeviceProperties() { delete ui_; }
@@ -81,9 +80,9 @@ DeviceProperties::~DeviceProperties() { delete ui_; }
void DeviceProperties::SetDeviceManager(DeviceManager *manager) {
manager_ = manager;
connect(manager_, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(ModelChanged()));
connect(manager_, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(ModelChanged()));
connect(manager_, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(ModelChanged()));
QObject::connect(manager_, &DeviceManager::dataChanged, this, &DeviceProperties::ModelChanged);
QObject::connect(manager_, &DeviceManager::rowsInserted, this, &DeviceProperties::ModelChanged);
QObject::connect(manager_, &DeviceManager::rowsRemoved, this, &DeviceProperties::ModelChanged);
}
@@ -136,7 +135,7 @@ void DeviceProperties::ShowDevice(QModelIndex idx) {
}
void DeviceProperties::AddHardwareInfo(int row, const QString &key, const QString &value) {
void DeviceProperties::AddHardwareInfo(const int row, const QString &key, const QString &value) {
ui_->hardware_info->setItem(row, 0, new QTableWidgetItem(key));
ui_->hardware_info->setItem(row, 1, new QTableWidgetItem(value));
}
@@ -240,11 +239,14 @@ void DeviceProperties::UpdateFormats() {
}
if (!updating_formats_) {
// Get the device's supported formats list. This takes a long time and it
// blocks, so do it in the background.
// Get the device's supported formats list. This takes a long time and it blocks, so do it in the background.
supported_formats_.clear();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFuture<bool> future = QtConcurrent::run(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_);
#else
QFuture<bool> future = QtConcurrent::run(std::bind(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_));
#endif
NewClosure(future, this, SLOT(UpdateFormatsFinished(QFuture<bool>)), future);
ui_->formats_stack->setCurrentWidget(ui_->formats_page_loading);

View File

@@ -53,7 +53,7 @@ class DeviceProperties : public QDialog {
private:
void UpdateHardwareInfo();
void AddHardwareInfo(int row, const QString &key, const QString &value);
void AddHardwareInfo(const int row, const QString &key, const QString &value);
void UpdateFormats();
private slots:

View File

@@ -33,9 +33,9 @@ DeviceStateFilterModel::DeviceStateFilterModel(QObject *parent, DeviceManager::S
: QSortFilterProxyModel(parent),
state_(state) {
connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(ProxyRowCountChanged(QModelIndex, int, int)));
connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(ProxyRowCountChanged(QModelIndex, int, int)));
connect(this, SIGNAL(modelReset()), this, SLOT(ProxyRowCountChanged()));
QObject::connect(this, &DeviceStateFilterModel::rowsInserted, this, &DeviceStateFilterModel::ProxyRowCountChanged);
QObject::connect(this, &DeviceStateFilterModel::rowsRemoved, this, &DeviceStateFilterModel::ProxyRowCountChanged);
QObject::connect(this, &DeviceStateFilterModel::modelReset, this, &DeviceStateFilterModel::ProxyReset);
}
@@ -43,15 +43,14 @@ bool DeviceStateFilterModel::filterAcceptsRow(int row, const QModelIndex&) const
return sourceModel()->index(row, 0).data(DeviceManager::Role_State).toInt() != state_ && sourceModel()->index(row, 0).data(DeviceManager::Role_CopyMusic).toBool();
}
void DeviceStateFilterModel::ProxyRowCountChanged() {
void DeviceStateFilterModel::ProxyRowCountChanged(QModelIndex, int, int) {
emit IsEmptyChanged(rowCount() == 0);
}
void DeviceStateFilterModel::ProxyRowCountChanged(QModelIndex index, int first, int last) {
void DeviceStateFilterModel::ProxyReset() {
Q_UNUSED(index);
Q_UNUSED(first);
Q_UNUSED(last);
emit IsEmptyChanged(rowCount() == 0);
}

View File

@@ -47,12 +47,11 @@ class DeviceStateFilterModel : public QSortFilterProxyModel {
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
private slots:
void ProxyRowCountChanged();
void ProxyRowCountChanged(QModelIndex index, int first, int last);
void ProxyReset();
void ProxyRowCountChanged(QModelIndex idx, int first, int last);
private:
DeviceManager::State state_;
};
#endif // DEVICESTATEFILTERMODEL_H

View File

@@ -72,11 +72,11 @@ const int DeviceItemDelegate::kIconPadding = 6;
DeviceItemDelegate::DeviceItemDelegate(QObject *parent) : CollectionItemDelegate(parent) {}
void DeviceItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
void DeviceItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const {
// Is it a device or a collection item?
if (index.data(DeviceManager::Role::Role_State).isNull()) {
CollectionItemDelegate::paint(painter, option, index);
if (idx.data(DeviceManager::Role::Role_State).isNull()) {
CollectionItemDelegate::paint(painter, option, idx);
return;
}
@@ -111,14 +111,14 @@ void DeviceItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
}
// Draw the icon
painter->drawPixmap(option.rect.topLeft(), index.data(Qt::DecorationRole).value<QPixmap>());
painter->drawPixmap(option.rect.topLeft(), idx.data(Qt::DecorationRole).value<QPixmap>());
// Draw the first line (device name)
painter->drawText(line1, Qt::AlignLeft | Qt::AlignTop, index.data().toString());
painter->drawText(line1, Qt::AlignLeft | Qt::AlignTop, idx.data().toString());
// Draw the second line (status)
DeviceManager::State state = static_cast<DeviceManager::State>(index.data(DeviceManager::Role_State).toInt());
QVariant progress = index.data(DeviceManager::Role_UpdatingPercentage);
DeviceManager::State state = static_cast<DeviceManager::State>(idx.data(DeviceManager::Role_State).toInt());
QVariant progress = idx.data(DeviceManager::Role_UpdatingPercentage);
QString status_text;
if (progress.isValid()) {
@@ -139,13 +139,13 @@ void DeviceItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
break;
case DeviceManager::State_Connected: {
QVariant song_count = index.data(DeviceManager::Role_SongCount);
QVariant song_count = idx.data(DeviceManager::Role_SongCount);
if (song_count.isValid()) {
int count = song_count.toInt();
status_text = tr("%1 song%2").arg(count).arg(count == 1 ? "" : "s");
}
else {
status_text = index.data(DeviceManager::Role_MountPath).toString();
status_text = idx.data(DeviceManager::Role_MountPath).toString();
}
break;
}
@@ -196,8 +196,8 @@ void DeviceView::SetApplication(Application *app) {
Q_ASSERT(app_ == nullptr);
app_ = app;
connect(app_->device_manager(), SIGNAL(DeviceConnected(QModelIndex)), SLOT(DeviceConnected(QModelIndex)));
connect(app_->device_manager(), SIGNAL(DeviceDisconnected(QModelIndex)), SLOT(DeviceDisconnected(QModelIndex)));
QObject::connect(app_->device_manager(), &DeviceManager::DeviceConnected, this, &DeviceView::DeviceConnected);
QObject::connect(app_->device_manager(), &DeviceManager::DeviceDisconnected, this, &DeviceView::DeviceDisconnected);
sort_model_ = new QSortFilterProxyModel(this);
sort_model_->setSourceModel(app_->device_manager());
@@ -209,7 +209,7 @@ void DeviceView::SetApplication(Application *app) {
merged_model_->setSourceModel(sort_model_);
setModel(merged_model_);
connect(merged_model_, SIGNAL(SubModelReset(QModelIndex, QAbstractItemModel*)), SLOT(RecursivelyExpand(QModelIndex)));
QObject::connect(merged_model_, &MergedProxyModel::SubModelReset, this, &AutoExpandingTreeView::RecursivelyExpandSlot);
properties_dialog_->SetDeviceManager(app_->device_manager());
@@ -225,19 +225,19 @@ void DeviceView::contextMenuEvent(QContextMenuEvent *e) {
collection_menu_ = new QMenu(this);
// Device menu
eject_action_ = device_menu_->addAction(IconLoader::Load("media-eject"), tr("Safely remove device"), this, SLOT(Unmount()));
forget_action_ = device_menu_->addAction(IconLoader::Load("list-remove"), tr("Forget device"), this, SLOT(Forget()));
eject_action_ = device_menu_->addAction(IconLoader::Load("media-eject"), tr("Safely remove device"), this, &DeviceView::Unmount);
forget_action_ = device_menu_->addAction(IconLoader::Load("list-remove"), tr("Forget device"), this, &DeviceView::Forget);
device_menu_->addSeparator();
properties_action_ = device_menu_->addAction(IconLoader::Load("configure"), tr("Device properties..."), this, SLOT(Properties()));
properties_action_ = device_menu_->addAction(IconLoader::Load("configure"), tr("Device properties..."), this, &DeviceView::Properties);
// Collection menu
add_to_playlist_action_ = collection_menu_->addAction(IconLoader::Load("media-playback-start"), tr("Append to current playlist"), this, SLOT(AddToPlaylist()));
load_action_ = collection_menu_->addAction(IconLoader::Load("media-playback-start"), tr("Replace current playlist"), this, SLOT(Load()));
open_in_new_playlist_ = collection_menu_->addAction(IconLoader::Load("document-new"), tr("Open in new playlist"), this, SLOT(OpenInNewPlaylist()));
add_to_playlist_action_ = collection_menu_->addAction(IconLoader::Load("media-playback-start"), tr("Append to current playlist"), this, &DeviceView::AddToPlaylist);
load_action_ = collection_menu_->addAction(IconLoader::Load("media-playback-start"), tr("Replace current playlist"), this, &DeviceView::Load);
open_in_new_playlist_ = collection_menu_->addAction(IconLoader::Load("document-new"), tr("Open in new playlist"), this, &DeviceView::OpenInNewPlaylist);
collection_menu_->addSeparator();
organize_action_ = collection_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, SLOT(Organize()));
delete_action_ = collection_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from device..."), this, SLOT(Delete()));
organize_action_ = collection_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, &DeviceView::Organize);
delete_action_ = collection_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from device..."), this, &DeviceView::Delete);
}
menu_index_ = currentIndex();
@@ -280,9 +280,9 @@ QModelIndex DeviceView::MapToDevice(const QModelIndex &merged_model_index) const
QModelIndex DeviceView::FindParentDevice(const QModelIndex &merged_model_index) const {
QModelIndex index = merged_model_->FindSourceParent(merged_model_index);
if (index.model() != sort_model_) return QModelIndex();
return sort_model_->mapToSource(index);
QModelIndex idx = merged_model_->FindSourceParent(merged_model_index);
if (idx.model() != sort_model_) return QModelIndex();
return sort_model_->mapToSource(idx);
}
@@ -350,11 +350,11 @@ void DeviceView::Properties() {
properties_dialog_->ShowDevice(MapToDevice(menu_index_));
}
void DeviceView::mouseDoubleClickEvent(QMouseEvent *event) {
void DeviceView::mouseDoubleClickEvent(QMouseEvent *e) {
AutoExpandingTreeView::mouseDoubleClickEvent(event);
AutoExpandingTreeView::mouseDoubleClickEvent(e);
QModelIndex merged_index = indexAt(event->pos());
QModelIndex merged_index = indexAt(e->pos());
QModelIndex device_index = MapToDevice(merged_index);
if (device_index.isValid()) {
if (!app_->device_manager()->GetConnectedDevice(device_index)) {
@@ -422,7 +422,7 @@ void DeviceView::Delete() {
std::shared_ptr<MusicStorage> storage = device_index.data(MusicStorage::Role_Storage).value<std::shared_ptr<MusicStorage>>();
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, false);
connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList)));
QObject::connect(delete_files, &DeleteFiles::Finished, this, &DeviceView::DeleteFinished);
delete_files->Start(GetSelectedSongs());
}

View File

@@ -57,7 +57,7 @@ class DeviceItemDelegate : public CollectionItemDelegate {
static const int kIconPadding;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
};
@@ -72,7 +72,7 @@ class DeviceView : public AutoExpandingTreeView {
protected:
void contextMenuEvent(QContextMenuEvent*) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *e) override;
private slots:
// Device menu actions

View File

@@ -54,15 +54,15 @@ FilesystemDevice::FilesystemDevice(const QUrl &url, DeviceLister *lister, const
watcher_->set_backend(backend_);
watcher_->set_task_manager(app_->task_manager());
connect(backend_, SIGNAL(DirectoryDiscovered(Directory, SubdirectoryList)), watcher_, SLOT(AddDirectory(Directory, SubdirectoryList)));
connect(backend_, SIGNAL(DirectoryDeleted(Directory)), watcher_, SLOT(RemoveDirectory(Directory)));
connect(watcher_, SIGNAL(NewOrUpdatedSongs(SongList)), backend_, SLOT(AddOrUpdateSongs(SongList)));
connect(watcher_, SIGNAL(SongsMTimeUpdated(SongList)), backend_, SLOT(UpdateMTimesOnly(SongList)));
connect(watcher_, SIGNAL(SongsDeleted(SongList)), backend_, SLOT(DeleteSongs(SongList)));
connect(watcher_, SIGNAL(SubdirsDiscovered(SubdirectoryList)), backend_, SLOT(AddOrUpdateSubdirs(SubdirectoryList)));
connect(watcher_, SIGNAL(SubdirsMTimeUpdated(SubdirectoryList)), backend_, SLOT(AddOrUpdateSubdirs(SubdirectoryList)));
connect(watcher_, SIGNAL(CompilationsNeedUpdating()), backend_, SLOT(UpdateCompilations()));
connect(watcher_, SIGNAL(ScanStarted(int)), SIGNAL(TaskStarted(int)));
QObject::connect(backend_, &CollectionBackend::DirectoryDiscovered, watcher_, &CollectionWatcher::AddDirectory);
QObject::connect(backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
QObject::connect(watcher_, &CollectionWatcher::NewOrUpdatedSongs, backend_, &CollectionBackend::AddOrUpdateSongs);
QObject::connect(watcher_, &CollectionWatcher::SongsMTimeUpdated, backend_, &CollectionBackend::UpdateMTimesOnly);
QObject::connect(watcher_, &CollectionWatcher::SongsDeleted, backend_, &CollectionBackend::DeleteSongs);
QObject::connect(watcher_, &CollectionWatcher::SubdirsDiscovered, backend_, &CollectionBackend::AddOrUpdateSubdirs);
QObject::connect(watcher_, &CollectionWatcher::SubdirsMTimeUpdated, backend_, &CollectionBackend::AddOrUpdateSubdirs);
QObject::connect(watcher_, &CollectionWatcher::CompilationsNeedUpdating, backend_, &CollectionBackend::CompilationsNeedUpdating);
QObject::connect(watcher_, &CollectionWatcher::ScanStarted, this, &FilesystemDevice::TaskStarted);
}
@@ -93,11 +93,11 @@ void FilesystemDevice::Close() {
wait_for_exit_ << backend_ << watcher_;
disconnect(backend_, nullptr, watcher_, nullptr);
disconnect(watcher_, nullptr, backend_, nullptr);
QObject::disconnect(backend_, nullptr, watcher_, nullptr);
QObject::disconnect(watcher_, nullptr, backend_, nullptr);
connect(backend_, SIGNAL(ExitFinished()), this, SLOT(ExitFinished()));
connect(watcher_, SIGNAL(ExitFinished()), this, SLOT(ExitFinished()));
QObject::connect(backend_, &CollectionBackend::ExitFinished, this, &FilesystemDevice::ExitFinished);
QObject::connect(watcher_, &CollectionWatcher::ExitFinished, this, &FilesystemDevice::ExitFinished);
backend_->ExitAsync();
watcher_->ExitAsync();
@@ -107,11 +107,11 @@ void FilesystemDevice::ExitFinished() {
QObject *obj = qobject_cast<QObject*>(sender());
if (!obj) return;
disconnect(obj, nullptr, this, nullptr);
QObject::disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully exited.";
wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) {
emit CloseFinished(unique_id());
emit DeviceCloseFinished(unique_id());
}
}

View File

@@ -63,10 +63,10 @@ bool GPodDevice::Init() {
loader_thread_ = new QThread();
loader_->moveToThread(loader_thread_);
connect(loader_, SIGNAL(Error(QString)), SLOT(LoaderError(QString)));
connect(loader_, SIGNAL(TaskStarted(int)), SIGNAL(TaskStarted(int)));
connect(loader_, SIGNAL(LoadFinished(Itdb_iTunesDB*, bool)), SLOT(LoadFinished(Itdb_iTunesDB*, bool)));
connect(loader_thread_, SIGNAL(started()), loader_, SLOT(LoadDatabase()));
QObject::connect(loader_, &GPodLoader::Error, this, &GPodDevice::LoaderError);
QObject::connect(loader_, &GPodLoader::TaskStarted, this, &GPodDevice::TaskStarted);
QObject::connect(loader_, &GPodLoader::LoadFinished, this, &GPodDevice::LoadFinished);
QObject::connect(loader_thread_, &QThread::started, loader_, &GPodLoader::LoadDatabase);
return true;
@@ -123,7 +123,7 @@ void GPodDevice::LoadFinished(Itdb_iTunesDB *db, bool success) {
ConnectedDevice::Close();
}
else {
emit ConnectFinished(unique_id_, success);
emit DeviceConnectFinished(unique_id_, success);
}
}

View File

@@ -73,4 +73,3 @@ class GPodLoader : public QObject {
};
#endif // GPODLOADER_H

View File

@@ -118,4 +118,4 @@ inline bool operator==(const MacOsDeviceLister::MTPDevice& a, const MacOsDeviceL
return (a.vendor_id == b.vendor_id) && (a.product_id == b.product_id);
}
#endif
#endif // MACDEVICELISTER_H

View File

@@ -83,10 +83,10 @@ bool MtpDevice::Init() {
loader_thread_ = new QThread();
loader_->moveToThread(loader_thread_);
connect(loader_, SIGNAL(Error(QString)), SLOT(LoaderError(QString)));
connect(loader_, SIGNAL(TaskStarted(int)), SIGNAL(TaskStarted(int)));
connect(loader_, SIGNAL(LoadFinished(bool, MtpConnection*)), SLOT(LoadFinished(bool, MtpConnection*)));
connect(loader_thread_, SIGNAL(started()), loader_, SLOT(LoadDatabase()));
QObject::connect(loader_, &MtpLoader::Error, this, &MtpDevice::LoaderError);
QObject::connect(loader_, &MtpLoader::TaskStarted, this, &MtpDevice::TaskStarted);
QObject::connect(loader_, &MtpLoader::LoadFinished, this, &MtpDevice::LoadFinished);
QObject::connect(loader_thread_, &QThread::started, loader_, &MtpLoader::LoadDatabase);
return true;
@@ -124,7 +124,7 @@ void MtpDevice::LoadFinished(bool success, MtpConnection *connection) {
ConnectedDevice::Close();
}
else {
emit ConnectFinished(unique_id_, success);
emit DeviceConnectFinished(unique_id_, success);
}
}

View File

@@ -49,7 +49,7 @@ class MtpLoader : public QObject {
void LoadDatabase();
signals:
void Error(const QString &message);
void Error(QString message);
void TaskStarted(int task_id);
void LoadFinished(bool success, MtpConnection*);

View File

@@ -202,8 +202,8 @@ bool Udisks2Lister::Init() {
emit DeviceAdded(id);
}
connect(udisks2_interface_.get(), SIGNAL(InterfacesAdded(QDBusObjectPath, InterfacesAndProperties)), SLOT(DBusInterfaceAdded(QDBusObjectPath, InterfacesAndProperties)));
connect(udisks2_interface_.get(), SIGNAL(InterfacesRemoved(QDBusObjectPath, QStringList)), SLOT(DBusInterfaceRemoved(QDBusObjectPath, QStringList)));
QObject::connect(udisks2_interface_.get(), &OrgFreedesktopDBusObjectManagerInterface::InterfacesAdded, this, &Udisks2Lister::DBusInterfaceAdded);
QObject::connect(udisks2_interface_.get(), &OrgFreedesktopDBusObjectManagerInterface::InterfacesRemoved, this, &Udisks2Lister::DBusInterfaceRemoved);
return true;
@@ -243,7 +243,7 @@ void Udisks2Lister::DBusInterfaceAdded(const QDBusObjectPath &path, const Interf
mounting_jobs_[path].dbus_interface = job;
mounting_jobs_[path].is_mount = is_mount_job;
mounting_jobs_[path].mounted_partitions = mounted_partitions;
connect(job.get(), SIGNAL(Completed(bool, QString)), SLOT(JobCompleted(bool, QString)));
QObject::connect(job.get(), &OrgFreedesktopUDisks2JobInterface::Completed, this, &Udisks2Lister::JobCompleted);
}
}
}