Clang-Tidy and Clazy fixes
This commit is contained in:
@@ -33,8 +33,8 @@ class Application;
|
||||
class DeviceLister;
|
||||
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) {
|
||||
CddaDevice::CddaDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time, QObject *parent)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time, parent), cdda_song_loader_(url) {
|
||||
|
||||
QObject::connect(&cdda_song_loader_, &CddaSongLoader::SongsLoaded, this, &CddaDevice::SongsLoaded);
|
||||
QObject::connect(&cdda_song_loader_, &CddaSongLoader::SongsDurationLoaded, this, &CddaDevice::SongsLoaded);
|
||||
|
||||
@@ -46,7 +46,7 @@ class CddaDevice : public ConnectedDevice {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_INVOKABLE explicit CddaDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time);
|
||||
Q_INVOKABLE explicit CddaDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent = nullptr);
|
||||
|
||||
bool Init() override;
|
||||
void Refresh() override;
|
||||
|
||||
@@ -38,7 +38,7 @@ class CddaLister : public DeviceLister {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CddaLister() {}
|
||||
explicit CddaLister(QObject *parent = nullptr) : DeviceLister(parent) {}
|
||||
|
||||
QStringList DeviceUniqueIDs() override;
|
||||
QVariantList DeviceIcons(const QString &id) override;
|
||||
|
||||
@@ -126,7 +126,8 @@ void CddaSongLoader::LoadSongs() {
|
||||
}
|
||||
|
||||
SongList songs;
|
||||
for (int track_number = 1; track_number <= num_tracks; track_number++) {
|
||||
songs.reserve(num_tracks);
|
||||
for (int track_number = 1; track_number <= num_tracks; ++track_number) {
|
||||
// Init song
|
||||
Song song(Song::Source_CDDA);
|
||||
song.set_id(track_number);
|
||||
@@ -216,8 +217,9 @@ void CddaSongLoader::AudioCDTagsLoaded(const QString &artist, const QString &alb
|
||||
|
||||
MusicBrainzClient *musicbrainz_client = qobject_cast<MusicBrainzClient*>(sender());
|
||||
musicbrainz_client->deleteLater();
|
||||
SongList songs;
|
||||
if (results.empty()) return;
|
||||
SongList songs;
|
||||
songs.reserve(results.count());
|
||||
int track_number = 1;
|
||||
for (const MusicBrainzClient::Result &ret : results) {
|
||||
Song song(Song::Source_CDDA);
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
#include "devicemanager.h"
|
||||
#include "deviceinfo.h"
|
||||
|
||||
ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
: QObject(manager),
|
||||
ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent)
|
||||
: QObject(parent),
|
||||
app_(app),
|
||||
url_(url),
|
||||
first_time_(first_time),
|
||||
|
||||
@@ -43,7 +43,7 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConnectedDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time);
|
||||
explicit ConnectedDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent = nullptr);
|
||||
~ConnectedDevice() override;
|
||||
|
||||
virtual bool Init() = 0;
|
||||
|
||||
@@ -45,6 +45,7 @@ DeviceDatabaseBackend::Device DeviceInfo::SaveToDb() const {
|
||||
ret.transcode_format_ = transcode_format_;
|
||||
|
||||
QStringList unique_ids;
|
||||
unique_ids.reserve(backends_.count());
|
||||
for (const Backend &backend : backends_) {
|
||||
unique_ids << backend.unique_id_;
|
||||
}
|
||||
|
||||
@@ -121,6 +121,8 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
|
||||
bool unmount_;
|
||||
bool forget_;
|
||||
|
||||
Q_DISABLE_COPY(DeviceInfo)
|
||||
|
||||
};
|
||||
|
||||
#endif // DEVICEINFO_H
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
DeviceLister::DeviceLister() :
|
||||
DeviceLister::DeviceLister(QObject *parent) :
|
||||
QObject(parent),
|
||||
thread_(nullptr),
|
||||
original_thread_(nullptr),
|
||||
next_mount_request_id_(0) {
|
||||
|
||||
@@ -40,7 +40,7 @@ class DeviceLister : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceLister();
|
||||
DeviceLister(QObject *parent = nullptr);
|
||||
~DeviceLister() override;
|
||||
|
||||
// Tries to start the thread and initialize the engine. This object will be moved to the new thread.
|
||||
@@ -103,6 +103,9 @@ class DeviceLister : public QObject {
|
||||
|
||||
private slots:
|
||||
void ThreadStarted();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DeviceLister)
|
||||
};
|
||||
|
||||
#endif // DEVICELISTER_H
|
||||
|
||||
@@ -198,7 +198,7 @@ void DeviceManager::CloseBackend() {
|
||||
|
||||
void DeviceManager::BackendClosed() {
|
||||
|
||||
QObject *obj = qobject_cast<QObject*>(sender());
|
||||
QObject *obj = sender();
|
||||
QObject::disconnect(obj, nullptr, this, nullptr);
|
||||
qLog(Debug) << obj << "successfully closed.";
|
||||
wait_for_exit_.removeAll(obj);
|
||||
@@ -248,6 +248,7 @@ void DeviceManager::AddDeviceFromDB(DeviceInfo *info) {
|
||||
|
||||
QStringList icon_names = info->icon_name_.split(',');
|
||||
QVariantList icons;
|
||||
icons.reserve(icon_names.count());
|
||||
for (const QString &icon_name : icon_names) {
|
||||
icons << icon_name;
|
||||
}
|
||||
@@ -548,7 +549,7 @@ void DeviceManager::PhysicalDeviceChanged(const QString &id) {
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<ConnectedDevice> DeviceManager::Connect(QModelIndex idx) {
|
||||
std::shared_ptr<ConnectedDevice> DeviceManager::Connect(const QModelIndex &idx) {
|
||||
|
||||
std::shared_ptr<ConnectedDevice> ret;
|
||||
|
||||
@@ -620,6 +621,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(DeviceInfo *info) {
|
||||
if (device_url.isEmpty()) {
|
||||
// Munge the URL list into a string list
|
||||
QStringList url_strings;
|
||||
url_strings.reserve(urls.count());
|
||||
for (const QUrl &url : urls) {
|
||||
url_strings << url.toString();
|
||||
}
|
||||
@@ -666,7 +668,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(DeviceInfo *info) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::DeviceConnectFinished(const QString &id, bool success) {
|
||||
void DeviceManager::DeviceConnectFinished(const QString &id, const bool success) {
|
||||
|
||||
DeviceInfo *info = FindDeviceById(id);
|
||||
if (!info) return;
|
||||
@@ -706,14 +708,14 @@ void DeviceManager::DeviceCloseFinished(const QString &id) {
|
||||
|
||||
}
|
||||
|
||||
DeviceInfo *DeviceManager::GetDevice(QModelIndex idx) const {
|
||||
DeviceInfo *DeviceManager::GetDevice(const QModelIndex &idx) const {
|
||||
|
||||
DeviceInfo *info = IndexToItem(idx);
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(QModelIndex idx) const {
|
||||
std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(const QModelIndex &idx) const {
|
||||
|
||||
std::shared_ptr<ConnectedDevice> ret;
|
||||
DeviceInfo *info = IndexToItem(idx);
|
||||
@@ -730,7 +732,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(DeviceInfo *i
|
||||
|
||||
}
|
||||
|
||||
int DeviceManager::GetDatabaseId(QModelIndex idx) const {
|
||||
int DeviceManager::GetDatabaseId(const QModelIndex &idx) const {
|
||||
|
||||
if (!idx.isValid()) return -1;
|
||||
|
||||
@@ -740,7 +742,7 @@ int DeviceManager::GetDatabaseId(QModelIndex idx) const {
|
||||
|
||||
}
|
||||
|
||||
DeviceLister *DeviceManager::GetLister(QModelIndex idx) const {
|
||||
DeviceLister *DeviceManager::GetLister(const QModelIndex &idx) const {
|
||||
|
||||
if (!idx.isValid()) return nullptr;
|
||||
|
||||
@@ -750,7 +752,7 @@ DeviceLister *DeviceManager::GetLister(QModelIndex idx) const {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::Disconnect(DeviceInfo *info, QModelIndex idx) {
|
||||
void DeviceManager::Disconnect(DeviceInfo *info, const QModelIndex &idx) {
|
||||
|
||||
Q_UNUSED(idx);
|
||||
|
||||
@@ -758,7 +760,7 @@ void DeviceManager::Disconnect(DeviceInfo *info, QModelIndex idx) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::Forget(QModelIndex idx) {
|
||||
void DeviceManager::Forget(const QModelIndex &idx) {
|
||||
|
||||
if (!idx.isValid()) return;
|
||||
|
||||
@@ -777,7 +779,7 @@ void DeviceManager::Forget(QModelIndex idx) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::RemoveFromDB(DeviceInfo *info, QModelIndex idx) {
|
||||
void DeviceManager::RemoveFromDB(DeviceInfo *info, const QModelIndex &idx) {
|
||||
|
||||
backend_->RemoveDevice(info->database_id_);
|
||||
info->database_id_ = -1;
|
||||
@@ -798,7 +800,7 @@ void DeviceManager::RemoveFromDB(DeviceInfo *info, QModelIndex idx) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::SetDeviceOptions(QModelIndex idx, const QString &friendly_name, const QString &icon_name, MusicStorage::TranscodeMode mode, Song::FileType format) {
|
||||
void DeviceManager::SetDeviceOptions(const QModelIndex &idx, const QString &friendly_name, const QString &icon_name, const MusicStorage::TranscodeMode mode, const Song::FileType format) {
|
||||
|
||||
if (!idx.isValid()) return;
|
||||
|
||||
@@ -817,7 +819,7 @@ void DeviceManager::SetDeviceOptions(QModelIndex idx, const QString &friendly_na
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::DeviceTaskStarted(int id) {
|
||||
void DeviceManager::DeviceTaskStarted(const int id) {
|
||||
|
||||
ConnectedDevice *device = qobject_cast<ConnectedDevice*>(sender());
|
||||
if (!device) return;
|
||||
@@ -873,11 +875,11 @@ void DeviceManager::TasksChanged() {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::UnmountAsync(QModelIndex idx) {
|
||||
void DeviceManager::UnmountAsync(const QModelIndex &idx) {
|
||||
Q_ASSERT(QMetaObject::invokeMethod(this, "Unmount", Q_ARG(QModelIndex, idx)));
|
||||
}
|
||||
|
||||
void DeviceManager::Unmount(QModelIndex idx) {
|
||||
void DeviceManager::Unmount(const QModelIndex &idx) {
|
||||
|
||||
if (!idx.isValid()) return;
|
||||
|
||||
@@ -896,7 +898,7 @@ void DeviceManager::Unmount(QModelIndex idx) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::DeviceSongCountUpdated(int count) {
|
||||
void DeviceManager::DeviceSongCountUpdated(const int count) {
|
||||
|
||||
Q_UNUSED(count);
|
||||
|
||||
|
||||
@@ -92,10 +92,10 @@ class DeviceManager : public SimpleTreeModel<DeviceInfo> {
|
||||
DeviceStateFilterModel *connected_devices_model() const { return connected_devices_model_; }
|
||||
|
||||
// Get info about devices
|
||||
int GetDatabaseId(QModelIndex idx) const;
|
||||
DeviceLister *GetLister(QModelIndex idx) const;
|
||||
DeviceInfo *GetDevice(QModelIndex idx) const;
|
||||
std::shared_ptr<ConnectedDevice> GetConnectedDevice(QModelIndex idx) const;
|
||||
int GetDatabaseId(const QModelIndex &idx) const;
|
||||
DeviceLister *GetLister(const QModelIndex &idx) const;
|
||||
DeviceInfo *GetDevice(const QModelIndex &idx) const;
|
||||
std::shared_ptr<ConnectedDevice> GetConnectedDevice(const QModelIndex &idx) const;
|
||||
std::shared_ptr<ConnectedDevice> GetConnectedDevice(DeviceInfo *info) const;
|
||||
|
||||
DeviceInfo *FindDeviceById(const QString &id) const;
|
||||
@@ -105,18 +105,18 @@ class DeviceManager : public SimpleTreeModel<DeviceInfo> {
|
||||
|
||||
// Actions on devices
|
||||
std::shared_ptr<ConnectedDevice> Connect(DeviceInfo *info);
|
||||
std::shared_ptr<ConnectedDevice> Connect(QModelIndex idx);
|
||||
void Disconnect(DeviceInfo *info, QModelIndex idx);
|
||||
void Forget(QModelIndex idx);
|
||||
void UnmountAsync(QModelIndex idx);
|
||||
std::shared_ptr<ConnectedDevice> Connect(const QModelIndex &idx);
|
||||
void Disconnect(DeviceInfo *info, const QModelIndex &idx);
|
||||
void Forget(const QModelIndex &idx);
|
||||
void UnmountAsync(const QModelIndex &idx);
|
||||
|
||||
void SetDeviceOptions(QModelIndex idx, const QString &friendly_name, const QString &icon_name, MusicStorage::TranscodeMode mode, Song::FileType format);
|
||||
void SetDeviceOptions(const QModelIndex &idx, const QString &friendly_name, const QString &icon_name, const MusicStorage::TranscodeMode mode, const Song::FileType format);
|
||||
|
||||
// QAbstractItemModel
|
||||
QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
|
||||
|
||||
public slots:
|
||||
void Unmount(QModelIndex idx);
|
||||
void Unmount(const QModelIndex &idx);
|
||||
|
||||
signals:
|
||||
void ExitFinished();
|
||||
@@ -128,9 +128,9 @@ class DeviceManager : public SimpleTreeModel<DeviceInfo> {
|
||||
void PhysicalDeviceAdded(const QString &id);
|
||||
void PhysicalDeviceRemoved(const QString &id);
|
||||
void PhysicalDeviceChanged(const QString &id);
|
||||
void DeviceTaskStarted(int id);
|
||||
void DeviceTaskStarted(const int id);
|
||||
void TasksChanged();
|
||||
void DeviceSongCountUpdated(int count);
|
||||
void DeviceSongCountUpdated(const int count);
|
||||
void LoadAllDevices();
|
||||
void DeviceConnectFinished(const QString &id, bool success);
|
||||
void DeviceCloseFinished(const QString &id);
|
||||
@@ -149,7 +149,7 @@ class DeviceManager : public SimpleTreeModel<DeviceInfo> {
|
||||
|
||||
DeviceDatabaseBackend::Device InfoToDatabaseDevice(const DeviceInfo &info) const;
|
||||
|
||||
void RemoveFromDB(DeviceInfo *info, QModelIndex idx);
|
||||
void RemoveFromDB(DeviceInfo *info, const QModelIndex &idx);
|
||||
|
||||
void CloseDevices();
|
||||
void CloseListers();
|
||||
|
||||
@@ -86,7 +86,7 @@ void DeviceProperties::SetDeviceManager(DeviceManager *manager) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceProperties::ShowDevice(QModelIndex idx) {
|
||||
void DeviceProperties::ShowDevice(const QModelIndex &idx) {
|
||||
|
||||
if (ui_->icon->count() == 0) {
|
||||
// Only load the icons the first time the dialog is shown
|
||||
@@ -108,7 +108,7 @@ void DeviceProperties::ShowDevice(QModelIndex idx) {
|
||||
#ifdef HAVE_GSTREAMER
|
||||
// Load the transcode formats the first time the dialog is shown
|
||||
for (const TranscoderPreset &preset : Transcoder::GetAllPresets()) {
|
||||
ui_->transcode_format->addItem(preset.name_, preset.type_);
|
||||
ui_->transcode_format->addItem(preset.name_, preset.filetype_);
|
||||
}
|
||||
ui_->transcode_format->model()->sort(0);
|
||||
#endif
|
||||
@@ -317,7 +317,7 @@ void DeviceProperties::UpdateFormatsFinished() {
|
||||
#ifdef HAVE_GSTREAMER
|
||||
// Set the format combobox item
|
||||
TranscoderPreset preset = Transcoder::PresetForFileType(Song::FileType(index_.data(DeviceManager::Role_TranscodeFormat).toInt()));
|
||||
if (preset.type_ == Song::FileType_Unknown) {
|
||||
if (preset.filetype_ == Song::FileType_Unknown) {
|
||||
// The user hasn't chosen a format for this device yet,
|
||||
// so work our way down a list of some preferred formats, picking the first one that is supported
|
||||
preset = Transcoder::PresetForFileType(Transcoder::PickBestFormat(supported_formats_));
|
||||
|
||||
@@ -46,7 +46,7 @@ class DeviceProperties : public QDialog {
|
||||
~DeviceProperties() override;
|
||||
|
||||
void SetDeviceManager(DeviceManager *manager);
|
||||
void ShowDevice(QModelIndex idx);
|
||||
void ShowDevice(const QModelIndex &idx);
|
||||
|
||||
public slots:
|
||||
void accept() override;
|
||||
|
||||
@@ -44,7 +44,7 @@ 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(QModelIndex, int, int) {
|
||||
void DeviceStateFilterModel::ProxyRowCountChanged(const QModelIndex&, const int, const int) {
|
||||
|
||||
emit IsEmptyChanged(rowCount() == 0);
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ class DeviceStateFilterModel : public QSortFilterProxyModel {
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
|
||||
signals:
|
||||
void IsEmptyChanged(bool is_empty);
|
||||
void IsEmptyChanged(const bool is_empty);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
|
||||
|
||||
private slots:
|
||||
void ProxyReset();
|
||||
void ProxyRowCountChanged(QModelIndex idx, int first, int last);
|
||||
void ProxyRowCountChanged(const QModelIndex &idx, const int first, const int last);
|
||||
|
||||
private:
|
||||
DeviceManager::State state_;
|
||||
|
||||
@@ -301,7 +301,7 @@ void DeviceView::Connect() {
|
||||
app_->device_manager()->data(device_idx, MusicStorage::Role_StorageForceConnect);
|
||||
}
|
||||
|
||||
void DeviceView::DeviceConnected(QModelIndex idx) {
|
||||
void DeviceView::DeviceConnected(const QModelIndex &idx) {
|
||||
|
||||
if (!idx.isValid()) return;
|
||||
|
||||
@@ -322,7 +322,7 @@ void DeviceView::DeviceConnected(QModelIndex idx) {
|
||||
|
||||
}
|
||||
|
||||
void DeviceView::DeviceDisconnected(QModelIndex idx) {
|
||||
void DeviceView::DeviceDisconnected(const QModelIndex &idx) {
|
||||
if (!idx.isValid()) return;
|
||||
merged_model_->RemoveSubModel(sort_model_->mapFromSource(idx));
|
||||
}
|
||||
@@ -430,8 +430,9 @@ void DeviceView::Delete() {
|
||||
|
||||
void DeviceView::Organize() {
|
||||
|
||||
SongList songs = GetSelectedSongs();
|
||||
const SongList songs = GetSelectedSongs();
|
||||
QStringList filenames;
|
||||
filenames.reserve(songs.count());
|
||||
for (const Song &song : songs) {
|
||||
filenames << song.url().toLocalFile();
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ class DeviceView : public AutoExpandingTreeView {
|
||||
void Organize();
|
||||
void Delete();
|
||||
|
||||
void DeviceConnected(QModelIndex idx);
|
||||
void DeviceDisconnected(QModelIndex idx);
|
||||
void DeviceConnected(const QModelIndex &idx);
|
||||
void DeviceDisconnected(const QModelIndex &idx);
|
||||
|
||||
void DeleteFinished(const SongList &songs_with_errors);
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
|
||||
class DeviceLister;
|
||||
|
||||
FilesystemDevice::FilesystemDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
FilesystemDevice::FilesystemDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent)
|
||||
: FilesystemMusicStorage(url.toLocalFile()),
|
||||
ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
||||
ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time, parent),
|
||||
watcher_(new CollectionWatcher(Song::Source_Device)), watcher_thread_(new QThread(this))
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ void FilesystemDevice::Close() {
|
||||
|
||||
void FilesystemDevice::ExitFinished() {
|
||||
|
||||
QObject *obj = qobject_cast<QObject*>(sender());
|
||||
QObject *obj = sender();
|
||||
if (!obj) return;
|
||||
QObject::disconnect(obj, nullptr, this, nullptr);
|
||||
qLog(Debug) << obj << "successfully exited.";
|
||||
|
||||
@@ -43,11 +43,7 @@ class FilesystemDevice : public ConnectedDevice, public virtual FilesystemMusicS
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_INVOKABLE FilesystemDevice(
|
||||
const QUrl &url, DeviceLister *lister,
|
||||
const QString &unique_id, DeviceManager *manager,
|
||||
Application *app,
|
||||
int database_id, bool first_time);
|
||||
Q_INVOKABLE FilesystemDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent = nullptr);
|
||||
~FilesystemDevice() override;
|
||||
|
||||
bool Init() override;
|
||||
|
||||
@@ -182,9 +182,9 @@ QVariantMap GioLister::DeviceHardwareInfo(const QString &id) {
|
||||
if (!devices_.contains(id)) return ret;
|
||||
const DeviceInfo &info = devices_[id];
|
||||
|
||||
ret[QT_TR_NOOP("Mount point")] = info.mount_path;
|
||||
ret[QT_TR_NOOP("Device")] = info.volume_unix_device;
|
||||
ret[QT_TR_NOOP("URI")] = info.mount_uri;
|
||||
ret[QT_TR_NOOP("Mount point")] = info.mount_path; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
ret[QT_TR_NOOP("Device")] = info.volume_unix_device; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
ret[QT_TR_NOOP("URI")] = info.mount_uri; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
return ret;
|
||||
|
||||
}
|
||||
@@ -243,7 +243,7 @@ QList<QUrl> GioLister::MakeDeviceUrls(const QString &id) {
|
||||
url.setQuery(url_query);
|
||||
}
|
||||
|
||||
ret << url;
|
||||
ret << url; // clazy:exclude=reserve-candidates
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class GioLister : public DeviceLister {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GioLister() {}
|
||||
explicit GioLister(QObject *parent = nullptr) : DeviceLister(parent) {}
|
||||
~GioLister() override;
|
||||
|
||||
int priority() const override { return 50; }
|
||||
|
||||
@@ -51,8 +51,8 @@
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
GPodDevice::GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
||||
GPodDevice::GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time, parent),
|
||||
loader_(nullptr),
|
||||
loader_thread_(nullptr),
|
||||
db_(nullptr),
|
||||
|
||||
@@ -51,7 +51,7 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_INVOKABLE GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time);
|
||||
Q_INVOKABLE GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent = nullptr);
|
||||
~GPodDevice() override;
|
||||
|
||||
bool Init() override;
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#include "core/taskmanager.h"
|
||||
#include "gpodloader.h"
|
||||
|
||||
GPodLoader::GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device)
|
||||
: QObject(nullptr),
|
||||
GPodLoader::GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device, QObject *parent)
|
||||
: QObject(parent),
|
||||
device_(device),
|
||||
mount_point_(mount_point),
|
||||
type_(Song::FileType_Unknown),
|
||||
|
||||
@@ -41,7 +41,7 @@ class GPodLoader : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device);
|
||||
explicit GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device, QObject *parent = nullptr);
|
||||
~GPodLoader() override;
|
||||
|
||||
void set_music_path_prefix(const QString &prefix) { path_prefix_ = prefix; }
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
@@ -43,7 +44,7 @@ class MacOsDeviceLister : public DeviceLister {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MacOsDeviceLister();
|
||||
explicit MacOsDeviceLister(QObject *parent = nullptr);
|
||||
~MacOsDeviceLister();
|
||||
|
||||
QStringList DeviceUniqueIDs();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <IOKit/storage/IOMedia.h>
|
||||
#include <IOKit/storage/IOCDMedia.h>
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
@@ -109,7 +109,7 @@ uint qHash(const MacOsDeviceLister::MTPDevice &d) {
|
||||
return qHash(d.vendor_id) ^ qHash(d.product_id);
|
||||
}
|
||||
|
||||
MacOsDeviceLister::MacOsDeviceLister() {}
|
||||
MacOsDeviceLister::MacOsDeviceLister(QObject *parent) : DeviceLister(parent) {}
|
||||
|
||||
MacOsDeviceLister::~MacOsDeviceLister() { CFRelease(loop_session_); }
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "core/logging.h"
|
||||
#include "mtpconnection.h"
|
||||
|
||||
MtpConnection::MtpConnection(const QUrl &url) : device_(nullptr) {
|
||||
MtpConnection::MtpConnection(const QUrl &url, QObject *parent) : QObject(parent), device_(nullptr) {
|
||||
|
||||
QString hostname = url.host();
|
||||
// Parse the URL
|
||||
@@ -72,7 +72,7 @@ MtpConnection::MtpConnection(const QUrl &url) : device_(nullptr) {
|
||||
raw_device->bus_location = bus_location;
|
||||
raw_device->devnum = device_num;
|
||||
|
||||
device_ = LIBMTP_Open_Raw_Device(raw_device);
|
||||
device_ = LIBMTP_Open_Raw_Device(raw_device); // NOLINT(clang-analyzer-unix.Malloc)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,10 @@
|
||||
#include "core/song.h"
|
||||
|
||||
class MtpConnection : public QObject, public std::enable_shared_from_this<MtpConnection> {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MtpConnection(const QUrl &url);
|
||||
explicit MtpConnection(const QUrl &url, QObject *parent = nullptr);
|
||||
~MtpConnection() override;
|
||||
|
||||
bool is_valid() const { return device_; }
|
||||
|
||||
@@ -49,8 +49,8 @@ class DeviceManager;
|
||||
|
||||
bool MtpDevice::sInitializedLibMTP = false;
|
||||
|
||||
MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
||||
MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time, parent),
|
||||
loader_(nullptr),
|
||||
loader_thread_(nullptr),
|
||||
closing_(false) {
|
||||
|
||||
@@ -48,7 +48,7 @@ class MtpDevice : public ConnectedDevice {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_INVOKABLE MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time);
|
||||
Q_INVOKABLE MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent = nullptr);
|
||||
~MtpDevice() override;
|
||||
|
||||
static QStringList url_schemes() { return QStringList() << "mtp"; }
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include "mtpconnection.h"
|
||||
#include "mtploader.h"
|
||||
|
||||
MtpLoader::MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBackend *backend)
|
||||
: QObject(nullptr),
|
||||
MtpLoader::MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBackend *backend, QObject *parent)
|
||||
: QObject(parent),
|
||||
url_(url),
|
||||
task_manager_(task_manager),
|
||||
backend_(backend),
|
||||
|
||||
@@ -39,7 +39,7 @@ class MtpLoader : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBackend *backend);
|
||||
explicit MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBackend *backend, QObject *parent = nullptr);
|
||||
~MtpLoader() override;
|
||||
|
||||
bool Init();
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
constexpr char Udisks2Lister::udisks2_service_[];
|
||||
|
||||
Udisks2Lister::Udisks2Lister() {}
|
||||
Udisks2Lister::Udisks2Lister(QObject *parent) : DeviceLister(parent) {}
|
||||
|
||||
Udisks2Lister::~Udisks2Lister() {}
|
||||
|
||||
@@ -111,11 +111,11 @@ QVariantMap Udisks2Lister::DeviceHardwareInfo(const QString &id) {
|
||||
QVariantMap result;
|
||||
|
||||
const auto &data = device_data_[id];
|
||||
result[QT_TR_NOOP("D-Bus path")] = data.dbus_path;
|
||||
result[QT_TR_NOOP("Serial number")] = data.serial;
|
||||
result[QT_TR_NOOP("Mount points")] = data.mount_paths.join(", ");
|
||||
result[QT_TR_NOOP("Partition label")] = data.label;
|
||||
result[QT_TR_NOOP("UUID")] = data.uuid;
|
||||
result[QT_TR_NOOP("D-Bus path")] = data.dbus_path; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
result[QT_TR_NOOP("Serial number")] = data.serial; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
result[QT_TR_NOOP("Mount points")] = data.mount_paths.join(", "); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
result[QT_TR_NOOP("Partition label")] = data.label; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
result[QT_TR_NOOP("UUID")] = data.uuid; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class Udisks2Lister : public DeviceLister {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Udisks2Lister();
|
||||
explicit Udisks2Lister(QObject *parent = nullptr);
|
||||
~Udisks2Lister() override;
|
||||
|
||||
QStringList DeviceUniqueIDs() override;
|
||||
|
||||
Reference in New Issue
Block a user