Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface for HMI plugins
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_base.h>
|
||||
#include <ProjectConfig/project_defines.h>
|
||||
#include <LtsAppDescriptor/lts_app_descriptor.h>
|
||||
#include <LtsUtilsCore/lts_translatable_identifier.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QFlags>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class LtsBackgroundWidget;
|
||||
class LtsBaseLayoutWidget;
|
||||
}
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace GuiPluginBase
|
||||
{
|
||||
class Interface;
|
||||
|
||||
|
||||
class Plugin // one instance per plugin
|
||||
{
|
||||
public:
|
||||
Plugin() = default;
|
||||
virtual ~Plugin() = default;
|
||||
|
||||
virtual QString pluginName() = 0;
|
||||
virtual std::shared_ptr<Interface> createGuiInterface(LtsSession::LtsSession *session) = 0;
|
||||
virtual bool availableInPartition(IDL::PartitionType partition) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// per session
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
Interface(LtsSession::LtsSession *session, NGL::INGLLogger &logger)
|
||||
: m_hasInit(true)
|
||||
, m_session(session)
|
||||
, m_logger(logger)
|
||||
, m_appId(LtsAppDescriptor::App::Login)
|
||||
{}
|
||||
virtual ~Interface() = default;
|
||||
|
||||
void setFlags(const QFlags<LtsAppDescriptor::PluginInfo::Flag> &flags) { m_flags = flags; }
|
||||
const QFlags<LtsAppDescriptor::PluginInfo::Flag> &getFlags() const { return m_flags; }
|
||||
void setOptions(const QStringList &options) { m_options = options; }
|
||||
const QStringList &getOptions() const { return m_options; }
|
||||
void setAppId(LtsAppDescriptor::App appId) { m_appId = appId; }
|
||||
LtsAppDescriptor::App appId() const { return m_appId; }
|
||||
|
||||
virtual QVector<LtsWidgets::PluginData> getActions() { return QVector<LtsWidgets::PluginData>(); } // only override when default behaviour unwanted or insufficient (when menu items are necessary)
|
||||
|
||||
virtual bool fetchInterfaces() { return true; } // only override when default behaviour unwanted or insufficient (if foreign interfaces must be fetched)
|
||||
virtual void clearInterfaces() {} // only override when default behaviour unwanted or insufficient (if foreign interfaces were fetched)
|
||||
virtual QString menuGroup() const { return {}; }
|
||||
virtual LtsUtils::LtsTranslatableIdentifier menuGroupIdentifier() const { m_hasMenuGroupIdentifier = false; return {}; }
|
||||
virtual bool availableInPartition(IDL::PartitionType partition) const { Q_UNUSED(partition); return true; } // FIXME: remove !
|
||||
virtual void init() { m_hasInit = false; } // called before payloads - needs to be quit with signalInitDone(); !
|
||||
|
||||
// NOTE: parameter 'mainBackground' is deprecated!
|
||||
virtual void executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) { (void)mainBackground; } // must be overridden when executionPriority was overridden
|
||||
virtual int executionPriority() const { return -1; } // only override when default behaviour unwanted or insufficient [smaller = executed sooner, 0 = first, 9999 = unpriorized - see docs!]
|
||||
|
||||
//virtual std::shared_ptr<ForeignDataInterface> getForeignDataInterface() = 0;
|
||||
|
||||
bool m_hasInit;
|
||||
mutable bool m_hasMenuGroupIdentifier = true;
|
||||
|
||||
protected:
|
||||
LtsSession::LtsSession *m_session;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
private:
|
||||
QFlags<LtsAppDescriptor::PluginInfo::Flag> m_flags;
|
||||
QStringList m_options;
|
||||
LtsAppDescriptor::App m_appId;
|
||||
//std::shared_ptr<ForeignDataInterface> m_foreignInterface;
|
||||
};
|
||||
|
||||
} // namespace GuiPluginBase
|
||||
|
||||
Q_DECLARE_INTERFACE(GuiPluginBase::Plugin, "gui")
|
||||
Reference in new issue
Block a user