summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/ComponentList_p.h
blob: 7a3d498b8c397f687e75b6e20a7b6454674131de (plain)
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
#pragma once

#include "Component.h"
#include <map>
#include <QTimer>
#include <QList>
#include <QMap>

class MinecraftInstance;
using ComponentContainer = QList<ComponentPtr>;
using ComponentIndex = QMap<QString, ComponentPtr>;
using ConnectionList = QList<QMetaObject::Connection>;

struct ComponentListData
{
    // the instance this belongs to
    MinecraftInstance *m_instance;

    // the launch profile (volatile, temporary thing created on demand)
    std::shared_ptr<LaunchProfile> m_profile;

    // version information migrated from instance.cfg file. Single use on migration!
    std::map<QString, QString> m_oldConfigVersions;
    QString getOldConfigVersion(const QString& uid) const
    {
        const auto iter = m_oldConfigVersions.find(uid);
        if(iter != m_oldConfigVersions.cend())
        {
            return (*iter).second;
        }
        return QString();
    }

    // persistent list of components and related machinery
    ComponentContainer components;
    ComponentIndex componentIndex;
    bool dirty = false;
    QTimer m_saveTimer;
    shared_qobject_ptr<Task> m_updateTask;
    bool loaded = false;
    bool interactionDisabled = true;
};