File indexing completed on 2024-05-26 03:51:19

0001 /*
0002     File                 : ProjectParser.h
0003     Project              : LabPlot
0004     Description          : base class for project parsers
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2017-2024 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef PROJECTPARSER_H
0011 #define PROJECTPARSER_H
0012 
0013 #include <QObject>
0014 
0015 class Folder;
0016 class Project;
0017 class QAbstractItemModel;
0018 class QString;
0019 
0020 enum class AspectType : quint64;
0021 
0022 class ProjectParser : public QObject {
0023     Q_OBJECT
0024 
0025 public:
0026     ProjectParser();
0027     ~ProjectParser() override;
0028 
0029     void setProjectFileName(const QString&);
0030     const QString& projectFileName() const;
0031 
0032     QAbstractItemModel* model();
0033     void importTo(Folder*, const QStringList&);
0034 
0035     QList<AspectType> topLevelClasses() const;
0036 
0037 protected:
0038     virtual bool load(Project*, bool preview) = 0;
0039 
0040     QString m_projectFileName;
0041     Project* m_previewProject{nullptr};
0042     QList<AspectType> m_topLevelClasses;
0043 
0044 private:
0045     void moveFolder(Folder* targetParentFolder, Folder* sourceChildFolderToMove) const;
0046 
0047 Q_SIGNALS:
0048     void completed(int);
0049 };
0050 
0051 #endif // PROJECTPARSER_H