File indexing completed on 2024-05-12 16:01:54

0001 /*
0002  *  SPDX-FileCopyrightText: 2018 Jouni Pentikäinen <joupent@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISSESSIONRESOURCE_H
0008 #define KISSESSIONRESOURCE_H
0009 
0010 #include "KisWindowLayoutResource.h"
0011 
0012 #include "kritaui_export.h"
0013 
0014 class KRITAUI_EXPORT KisSessionResource : public KisWindowLayoutResource
0015 {
0016 public:
0017     KisSessionResource(const QString &filename);
0018     ~KisSessionResource();
0019     KisSessionResource(const KisSessionResource &rhs);
0020     KisSessionResource &operator=(const KisSessionResource &rhs) = delete;
0021     KoResourceSP clone() const override;
0022 
0023     void storeCurrentWindows();
0024 
0025 
0026     QString defaultFileExtension() const override;
0027 
0028 protected:
0029     void saveXml(QDomDocument &doc, QDomElement &root) const override;
0030 
0031     void loadXml(const QDomElement &root) const override;
0032 
0033     QPair<QString, QString> resourceType() const override
0034     {
0035         return QPair<QString, QString>(ResourceType::Sessions, "");
0036     }
0037 
0038 private:
0039 
0040     // Only KisPart should be able to call restore() to make sure it contains the pointer to it
0041     void restore();
0042     friend class KisPart;
0043 
0044     struct Private;
0045     QScopedPointer<Private> d;
0046 };
0047 
0048 
0049 typedef QSharedPointer<KisSessionResource> KisSessionResourceSP;
0050 
0051 #endif