Qt-Advanced-Docking-System/examples/dockindock/perspectives.h
jporcher 0e8e563654
Add dockindock example (#308)
* Add dockdepth1 example

* Fix compilation (include assert.h)

* Replace dockdepth1 by dockindock
2021-04-21 06:37:19 +02:00

60 lines
1.4 KiB
C++

#pragma once
#include <QObject>
#include <QMap>
#include <QString>
#include <memory>
class QMenu;
class QSettings;
namespace QtAdsUtl
{
class DockInDockWidget;
class PerspectivesManager : public QObject
{
Q_OBJECT
public:
PerspectivesManager( const QString& perspectivesFolder );
virtual ~PerspectivesManager();
QStringList perspectiveNames() const;
void addPerspective( const QString& name, DockInDockWidget& widget );
void openPerspective( const QString& name, DockInDockWidget& widget );
void removePerspectives();
void removePerspective( const QString& name );
void loadPerspectives();
void savePerspectives() const;
signals:
void perspectivesListChanged();
void openingPerspective();
void openedPerspective();
private:
// Partially bypass ADS perspective management, store list here
// and then ADS will only have one perspective loaded
// this is because all docking widgets must exist when a perspective is loaded
// we will guarantee that!
class PerspectiveInfo
{
public:
std::shared_ptr<QSettings> settings;
QMap<QString,QStringList> groups;
};
QMap<QString,PerspectiveInfo> m_perspectives;
QString m_perspectivesFolder;
QString getSettingsFileName( const QString& perspective, bool temp ) const;
std::shared_ptr<QSettings> getSettingsObject( const QString& filePath ) const;
};
}