~larryprice/libertine/deb-filepicker

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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * Copyright 2017 Canonical Ltd
 *
 * Libertine is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3, as published by the
 * Free Software Foundation.
 *
 * Libertine is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include <QList>
#include <QJsonObject>

class ContainersConfig
{
public:
  explicit ContainersConfig() = default;
  explicit ContainersConfig(QJsonObject const& json);
  virtual ~ContainersConfig() = default;

  QJsonObject dump() const;

  class Container
  {
  public:
    explicit Container(QJsonObject const& json);
    explicit Container(QString const& id = "unknown",
                       QString const& name = "unknown",
                       QString const& type = "unknown",
                       QString const& distro = "unknown",
                       QString const& status = "unknown",
                       QString const& multiarch = "disabled",
                       bool freeze = false);
    virtual ~Container() = default;

    QJsonObject dump() const;

    class InstalledApp
    {
    public:
      explicit InstalledApp(QJsonObject const& json);
      virtual ~InstalledApp() = default;

      QJsonObject dump() const;

    private:
      QString status_; // untranslated

    public:
      QString name;
      QString status;
    };


    class Archive
    {
    public:
      explicit Archive(QJsonObject const& json);
      virtual ~Archive() = default;

      QJsonObject dump() const;

    private:
      QString status_; // untranslated

    public:
      QString name;
      QString status;
    };


    class BindMount
    {
    public:
      explicit BindMount(QString const& json);
      virtual ~BindMount() = default;

      QString dump() const;

    public:
      QString path;
    };

  private:
    QString status_; // untranslated

  public:
    QString             name;
    QString             id;
    QString             distro;
    QString             status;
    QString             type;
    QString             multiarch;
    bool                freeze;
    QList<Archive>      archives;
    QList<BindMount>    mounts;
    QList<InstalledApp> installed_apps;
  };

  QList<Container> containers;
  QString          default_container;
};