File indexing completed on 2024-05-12 15:26:40
0001 /*************************************************************************** 0002 File : Project.h 0003 Project : LabPlot 0004 Description : Represents a LabPlot project. 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2011-2020 Alexander Semke (alexander.semke@web.de) 0007 Copyright : (C) 2007-2008 Tilman Benkert (thzs@gmx.net) 0008 Copyright : (C) 2007 Knut Franke (knut.franke@gmx.de) 0009 0010 ***************************************************************************/ 0011 0012 /*************************************************************************** 0013 * * 0014 * This program is free software; you can redistribute it and/or modify * 0015 * it under the terms of the GNU General Public License as published by * 0016 * the Free Software Foundation; either version 2 of the License, or * 0017 * (at your option) any later version. * 0018 * * 0019 * This program is distributed in the hope that it will be useful, * 0020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0022 * GNU General Public License for more details. * 0023 * * 0024 * You should have received a copy of the GNU General Public License * 0025 * along with this program; if not, write to the Free Software * 0026 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0027 * Boston, MA 02110-1301 USA * 0028 * * 0029 ***************************************************************************/ 0030 #ifndef PROJECT_H 0031 #define PROJECT_H 0032 0033 #include "backend/core/Folder.h" 0034 #include "backend/lib/macros.h" 0035 0036 class AbstractColumn; 0037 class Histogram; 0038 class XYCurve; 0039 class QMimeData; 0040 class QString; 0041 0042 class Project : public Folder { 0043 Q_OBJECT 0044 0045 public: 0046 enum class MdiWindowVisibility { 0047 folderOnly, 0048 folderAndSubfolders, 0049 allMdiWindows 0050 }; 0051 0052 public: 0053 Project(); 0054 ~Project() override; 0055 0056 virtual const Project* project() const { 0057 return this; 0058 } 0059 Project* project() override { 0060 return this; 0061 } 0062 QUndoStack* undoStack() const override; 0063 QString path() const override { 0064 return name(); 0065 } 0066 QMenu* createContextMenu() override; 0067 virtual QMenu* createFolderContextMenu(const Folder*); 0068 0069 void setMdiWindowVisibility(MdiWindowVisibility visibility); 0070 MdiWindowVisibility mdiWindowVisibility() const; 0071 CLASS_D_ACCESSOR_DECL(QString, fileName, FileName) 0072 BASIC_D_ACCESSOR_DECL(QString, version, Version) 0073 CLASS_D_ACCESSOR_DECL(QString, author, Author) 0074 CLASS_D_ACCESSOR_DECL(QDateTime, modificationTime, ModificationTime) 0075 0076 void setChanged(const bool value=true); 0077 bool hasChanged() const; 0078 void navigateTo(const QString& path); 0079 0080 void setSuppressAspectAddedSignal(bool); 0081 bool aspectAddedSignalSuppressed() const; 0082 0083 void save(const QPixmap&, QXmlStreamWriter*) const; 0084 bool load(XmlStreamReader*, bool preview) override; 0085 bool load(const QString&, bool preview = false); 0086 0087 static bool isLabPlotProject(const QString& fileName); 0088 static QString supportedExtensions(); 0089 QVector<quintptr> droppedAspects(const QMimeData*); 0090 0091 class Private; 0092 0093 public slots: 0094 void descriptionChanged(const AbstractAspect*); 0095 void aspectAddedSlot(const AbstractAspect*); 0096 0097 signals: 0098 void authorChanged(const QString&); 0099 void requestSaveState(QXmlStreamWriter*) const; 0100 void requestLoadState(XmlStreamReader*); 0101 void requestProjectContextMenu(QMenu*); 0102 void requestFolderContextMenu(const Folder*, QMenu*); 0103 void mdiWindowVisibilityChanged(); 0104 void changed(); 0105 void requestNavigateTo(const QString& path); 0106 void loaded(); 0107 void closeRequested(); 0108 0109 private: 0110 Private* d; 0111 void updateCurveColumnDependencies(const QVector<XYCurve*>&, const AbstractColumn*) const; 0112 void updateHistogramColumnDependencies(const QVector<Histogram*>&, const AbstractColumn*) const; 0113 bool readProjectAttributes(XmlStreamReader*); 0114 void save(QXmlStreamWriter*) const override; 0115 }; 0116 0117 #endif // ifndef PROJECT_H