File indexing completed on 2024-05-12 04:59:44

0001 // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0002 // SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
0003 
0004 #pragma once
0005 
0006 #include <span>
0007 
0008 #include <QObject>
0009 
0010 #include "kmtpfile.h"
0011 #include "memory.h"
0012 
0013 class MTPStorage;
0014 
0015 class MTPLister : public QObject
0016 {
0017     Q_OBJECT
0018     Q_CLASSINFO("D-Bus Interface", "org.kde.kmtp.Lister")
0019 public:
0020     explicit MTPLister(std::unique_ptr<uint32_t> children, int childrenCount, LIBMTP_mtpdevice_t *device, const QString &path, MTPStorage *parent = nullptr);
0021 
0022 public Q_SLOTS:
0023     void run();
0024     void abort();
0025 
0026 Q_SIGNALS:
0027     void entry(const KMTPFile &file);
0028     void finished();
0029 
0030 private:
0031     LIBMTP_mtpdevice_t *const m_device;
0032     const QString m_path;
0033     const std::unique_ptr<uint32_t> m_childrenOwner;
0034     const std::span<uint32_t> m_children;
0035     decltype(m_children)::iterator m_it;
0036 };