From 1e1b7b7ecea1b93980ef2f2582c4972de69135d3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 8 Feb 2021 14:21:58 +0100 Subject: [PATCH] [libcalamares] Introduce a convenience getter for GlobalStorage --- src/libcalamares/JobQueue.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcalamares/JobQueue.h b/src/libcalamares/JobQueue.h index 92468d535..699f52e42 100644 --- a/src/libcalamares/JobQueue.h +++ b/src/libcalamares/JobQueue.h @@ -27,7 +27,22 @@ public: explicit JobQueue( QObject* parent = nullptr ); ~JobQueue() override; + /** @brief Returns the most-recently-created instance. + * + * It is possible for instance() to be @c nullptr, since you must + * call the constructor explicitly first. + */ static JobQueue* instance(); + /* @brief Returns the GlobalStorage object for the instance. + * + * It is possible for instanceGlobalStorage() to be @c nullptr, + * since there might not be an instance to begin with. + */ + static GlobalStorage* instanceGlobalStorage() + { + auto* jq = instance(); + return jq ? jq->globalStorage() : nullptr; + } GlobalStorage* globalStorage() const;