20#include "lomirimenumodelcache.h"
21#include <ayatanamenumodel.h>
25QPointer<LomiriMenuModelCache> LomiriMenuModelCache::theCache =
nullptr;
27LomiriMenuModelCache* LomiriMenuModelCache::singleton()
29 if (theCache.isNull()) {
30 theCache =
new LomiriMenuModelCache();
32 return theCache.data();
35LomiriMenuModelCache::LomiriMenuModelCache(QObject* parent)
40QSharedPointer<AyatanaMenuModel> LomiriMenuModelCache::model(
const QByteArray& path)
42 if (m_registry.contains(path))
43 return m_registry[path];
45 AyatanaMenuModel* model =
new AyatanaMenuModel;
46 QQmlEngine::setObjectOwnership(model, QQmlEngine::CppOwnership);
48 QSharedPointer<AyatanaMenuModel> menuModel(model);
56 m_registry[path] = menuModel;
58 menuModel->setMenuObjectPath(path);
62bool LomiriMenuModelCache::contains(
const QByteArray& path)
64 return m_registry.contains(path);