/* * This file is part of the Flowee project * Copyright (C) 2025 Tom Zander * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef QMLDATA_H #define QMLDATA_H #include #include class SeedsBackup; /** * Class pushed to be data-source for a QML page we open from our module, * typically as a result of NFC based events. */ class QMLData : public QObject { Q_OBJECT // true if the imported NFC tag had a seed one of the wallets uses. Q_PROPERTY(bool seedKnown READ seedKnown CONSTANT FINAL) Q_PROPERTY(QList matchingAccounts READ matchingAccounts CONSTANT FINAL) Q_PROPERTY(QString seed READ seed CONSTANT FINAL) Q_PROPERTY(QString backupName READ backupName CONSTANT FINAL) Q_PROPERTY(int numberOfPaths READ numberOfPaths CONSTANT FINAL) public: explicit QMLData(QObject *parent = nullptr); ~QMLData(); void addWallet(const std::shared_ptr &wallet, bool fullMatch); bool seedKnown() const; QList matchingAccounts() const; Q_INVOKABLE bool fullMatch(int id) const; Q_INVOKABLE QString derivationPath(int index) const; Q_INVOKABLE QString pathName(int index) const; Q_INVOKABLE int pathStartingHeight(int index) const; int numberOfPaths() const; SeedsBackup *seeds() const; void setSeeds(SeedsBackup *backup); QString seed() const; void setSeed(const QString &newSeed); QString backupName() const; private: struct Matches { std::shared_ptr wallet; bool fullMatch = false; }; QList m_matches; SeedsBackup *m_backup = nullptr; QString m_seed; }; #endif