File indexing completed on 2024-04-28 04:37:24

0001 /*
0002     SPDX-FileCopyrightText: 2008 Andreas Pakulat <apaku@gmx.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_SESSION_H
0008 #define KDEVPLATFORM_SESSION_H
0009 
0010 #include "shellexport.h"
0011 #include <QUuid>
0012 #include <QUrl>
0013 #include <interfaces/isession.h>
0014 
0015 namespace KDevelop
0016 {
0017 
0018 class SessionPrivate;
0019 
0020 struct SessionInfo
0021 {
0022     QString name;
0023     QUuid uuid;
0024     QString description;
0025     QList<QUrl> projects;
0026     QString path;
0027     KSharedConfigPtr config;
0028 };
0029 using SessionInfos = QVector<SessionInfo>;
0030 
0031 class KDEVPLATFORMSHELL_EXPORT Session : public ISession
0032 {
0033     Q_OBJECT
0034 public:
0035     static const QString cfgSessionNameEntry;
0036     static const QString cfgSessionDescriptionEntry;
0037     static const QString cfgSessionProjectsEntry;
0038     static const QString cfgSessionOptionsGroup;
0039 
0040     explicit Session( const QString& id, QObject * parent = nullptr );
0041     ~Session() override;
0042 
0043     QUrl pluginDataArea( const IPlugin* ) override;
0044     KSharedConfigPtr config() override;
0045 
0046     QList<QUrl> containedProjects() const override;
0047     void setContainedProjects( const QList<QUrl>& projects ) override;
0048 
0049     QString name() const override;
0050     void setName( const QString& );
0051 
0052     QUuid id() const override;
0053 
0054     QString description() const override;
0055 
0056     bool isTemporary() const override;
0057     void setTemporary(bool temp) override;
0058 
0059     QString path() const;
0060 
0061     /**
0062      * Generates a @ref SessionInfo by a session @p id.
0063      * @param mkdir Whether to create a session directory if one does not exist.
0064      */
0065     static SessionInfo parse( const QString& id, bool mkdir = false );
0066 
0067 private:
0068     const QScopedPointer<class SessionPrivate> d_ptr;
0069     Q_DECLARE_PRIVATE(Session)
0070     friend class SessionPrivate;
0071 };
0072 
0073 }
0074 
0075 Q_DECLARE_TYPEINFO(KDevelop::SessionInfo, Q_MOVABLE_TYPE);
0076 
0077 #endif
0078