-
Notifications
You must be signed in to change notification settings - Fork 0
/
mappingsmanager.h
64 lines (45 loc) · 1.56 KB
/
mappingsmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef MAPPINGSMANAGER_H
#define MAPPINGSMANAGER_H
#include "mappingsmanager/mapping.h"
#include <coreplugin/id.h>
#include <utils/fileutils.h>
#include <QHash>
#include <QObject>
#include <vector>
QT_BEGIN_NAMESPACE
class QStandardItemModel;
QT_END_NAMESPACE
namespace ProjectExplorer { class Project; }
namespace RemoteDev {
namespace Internal {
class MappingsManager : public QObject
{
Q_OBJECT
public:
explicit MappingsManager(QObject *parent = 0);
const std::vector<Mapping> &mappingsForProject(ProjectExplorer::Project &project);
void createMapping(const ProjectExplorer::Project &project,
const QString &name,
bool isEnabled,
const Core::Id &deviceId,
const QString &remotePath);
void removeMapping(const ProjectExplorer::Project &project,
std::uint16_t index);
private:
friend class ProjectSettingsWidget;
QStandardItemModel &storageForProject(ProjectExplorer::Project &project);
private:
struct MappingsMeta {
QStandardItemModel *storage;
// QVector does not allow emplace_back
std::vector<Mapping> mappings;
};
MappingsMeta readProjectMappings(const ProjectExplorer::Project &project) const;
void saveProjectMappings(ProjectExplorer::Project &project);
MappingsMeta &mappingsMetaForProject(ProjectExplorer::Project &project);
private:
QHash<const ProjectExplorer::Project *, MappingsMeta> m_mappings;
};
} // namespace Internal
} // namespace RemoteDev
#endif // MAPPINGSMANAGER_H