MeshLib Documentation
Loading...
Searching...
No Matches
MRViewerSettingsManager.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRViewerFwd.h"
4#include <string>
5#include <vector>
6
7namespace MR
8{
9
10// This class manages local user settings of viewer
11// loading it when the app starts and saving it when it ends
13{
14public:
15 virtual ~IViewerSettingsManager() = default;
16
17 virtual int loadInt( const std::string& name, int def = 0 ) = 0;
18 virtual void saveInt( const std::string& name, int value ) = 0;
19
20 virtual std::string loadString( const std::string& name, const std::string& def = "" ) = 0;
21 virtual void saveString( const std::string& name, const std::string& value ) = 0;
22
23 virtual bool loadBool( const std::string& name, bool def = false ) = 0;
24 virtual void saveBool( const std::string& name, bool value ) = 0;
25
26 virtual void resetSettings( Viewer& ) = 0;
27 virtual void loadSettings( Viewer& ) = 0;
28 virtual void saveSettings( const Viewer& ) = 0;
29};
30
31class MRVIEWER_CLASS ViewerSettingsManager : public IViewerSettingsManager
32{
33public:
34 MRVIEWER_API ViewerSettingsManager();
35
36 MRVIEWER_API virtual int loadInt( const std::string& name, int def ) override;
37 MRVIEWER_API virtual void saveInt( const std::string& name, int value ) override;
38 MRVIEWER_API virtual std::string loadString( const std::string& name, const std::string& def ) override;
39 MRVIEWER_API virtual void saveString( const std::string& name, const std::string& value ) override;
40 MRVIEWER_API virtual bool loadBool( const std::string& name, bool def ) override;
41 MRVIEWER_API virtual void saveBool( const std::string& name, bool value ) override;
42
43 MRVIEWER_API virtual void resetSettings( Viewer& ) override;
44 MRVIEWER_API virtual void loadSettings( Viewer& viewer ) override;
45 MRVIEWER_API virtual void saveSettings( const Viewer& viewer ) override;
46
47 enum class ObjType
48 {
49 Mesh = 0,
50 Lines,
51 Points,
52 Voxels,
54 Count
55 };
56 MRVIEWER_API const std::string & getLastExtention( ObjType objType );
57 MRVIEWER_API void setLastExtention( ObjType objType, std::string ext );
58private:
59 std::vector<std::string> lastExtentions_;
60};
61}
Points
Definition MRObjectLinesHolder.h:10
Definition MRDistanceMap.h:24
Definition MRViewerSettingsManager.h:13
virtual bool loadBool(const std::string &name, bool def=false)=0
virtual ~IViewerSettingsManager()=default
virtual void loadSettings(Viewer &)=0
virtual void saveString(const std::string &name, const std::string &value)=0
virtual void saveBool(const std::string &name, bool value)=0
virtual void resetSettings(Viewer &)=0
virtual int loadInt(const std::string &name, int def=0)=0
virtual std::string loadString(const std::string &name, const std::string &def="")=0
virtual void saveSettings(const Viewer &)=0
virtual void saveInt(const std::string &name, int value)=0
Definition MRViewerSettingsManager.h:32
virtual MRVIEWER_API void saveBool(const std::string &name, bool value) override
ObjType
Definition MRViewerSettingsManager.h:48
virtual MRVIEWER_API int loadInt(const std::string &name, int def) override
virtual MRVIEWER_API void saveString(const std::string &name, const std::string &value) override
virtual MRVIEWER_API void resetSettings(Viewer &) override
virtual MRVIEWER_API void saveInt(const std::string &name, int value) override
MRVIEWER_API ViewerSettingsManager()
virtual MRVIEWER_API bool loadBool(const std::string &name, bool def) override
virtual MRVIEWER_API void saveSettings(const Viewer &viewer) override
virtual MRVIEWER_API std::string loadString(const std::string &name, const std::string &def) override
virtual MRVIEWER_API void loadSettings(Viewer &viewer) override
MRVIEWER_API void setLastExtention(ObjType objType, std::string ext)
MRVIEWER_API const std::string & getLastExtention(ObjType objType)
Definition MRCameraOrientationPlugin.h:8
Definition Viewer.dox.py:1
Definition MRMesh/MRMesh.h:23