~larryprice/libertine/deb-filepicker

« back to all changes in this revision

Viewing changes to common/ContainersConfig.cpp

  • Committer: Larry Price
  • Date: 2017-03-08 15:07:57 UTC
  • mfrom: (388.2.44 devel)
  • Revision ID: larry.price@canonical.com-20170308150757-glgl6bjs6qjtqoys
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
  auto value = object.value(key);
49
49
  return value.isUndefined() ? fallback : value.toString();
50
50
}
 
51
 
 
52
 
 
53
bool try_get_bool(QJsonObject object, QString const& key)
 
54
{
 
55
  auto value = object.value(key);
 
56
  return value.isUndefined() ? false : value.toBool();
 
57
}
51
58
}
52
59
 
53
60
 
104
111
 
105
112
ContainersConfig::Container::
106
113
Container(QString const& id, QString const& name, QString const& type,
107
 
          QString const& distro, QString const& status, QString const& multiarch)
 
114
          QString const& distro, QString const& status, QString const& multiarch,
 
115
          bool freeze)
108
116
  : status_(status)
109
117
  , name(name)
110
118
  , id(id)
112
120
  , status(translate_status(status_))
113
121
  , type(type)
114
122
  , multiarch(multiarch)
 
123
  , freeze(freeze)
115
124
{ }
116
125
 
117
126
 
119
128
Container(QJsonObject const& json)
120
129
: Container(try_get_string(json, "id"), try_get_string(json, "name"), try_get_string(json, "type"),
121
130
            try_get_string(json, "distro"), try_get_string(json, "installStatus"),
122
 
            try_get_string(json, "multiarch", "disabled"))
 
131
            try_get_string(json, "multiarch", "disabled"), try_get_bool(json, "freezeOnStop"))
123
132
{
124
133
  for (auto const& archive: json["extraArchives"].toArray())
125
134
  {
148
157
  object["installStatus"] = status_;
149
158
  object["multiarch"] = multiarch;
150
159
  object["type"] = type;
 
160
  object["freezeOnStop"] = freeze;
151
161
 
152
162
  QJsonArray archives_list;
153
163
  for (auto const& archive: archives)