/* * Copyright 2014 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef UCACTIONMANAGER_P_H #define UCACTIONMANAGER_P_H #include #include #include #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include #else #include #endif #include "ucactioncontext_p.h" UT_NAMESPACE_BEGIN class UCAction; class UCActionContext; class LOMIRITOOLKIT_EXPORT UCActionManager : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QQmlListProperty actions READ actions) Q_PROPERTY(QQmlListProperty localContexts READ localContexts) Q_PROPERTY(UT_PREPEND_NAMESPACE(UCActionContext) *globalContext READ globalContext CONSTANT) Q_CLASSINFO("DefaultProperty", "actions") public: explicit UCActionManager(QObject *parent = 0); void classBegin() override {} void componentComplete() override; QQmlListProperty actions(); QQmlListProperty localContexts(); UCActionContext *globalContext() const; Q_SIGNALS: void quit(); public Q_SLOTS: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void addAction(UT_PREPEND_NAMESPACE(UCAction) *action); void removeAction(UT_PREPEND_NAMESPACE(UCAction) *action); void addLocalContext(UT_PREPEND_NAMESPACE(UCActionContext) *context); void removeLocalContext(UT_PREPEND_NAMESPACE(UCActionContext) *context); #endif private: static void contextAppend(QQmlListProperty *list, UCActionContext *context); static void contextClear(QQmlListProperty *list); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) static qsizetype contextCount(QQmlListProperty *list); #else static int contextCount(QQmlListProperty *list); #endif static void actionAppend(QQmlListProperty *list, UCAction *action); static void actionClear(QQmlListProperty *list); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) static qsizetype actionCount(QQmlListProperty *list); #else static int actionCount(QQmlListProperty *list); #endif }; UT_NAMESPACE_END #endif // UCACTIONMANAGER_P_H