WIP: Visual plugin interface
This is largely a WIP, but it's a start. This MR is for architectural discussions, I do not want to merge this as is (so refrain of comments about code style / const correctness)
Main Idea:
A plugin that allow us to add elements into 5 zones of Kirogi Pages, plus Configuration Pages:
> ______________________
> |___HORIZONTAL_TOP____|
> | | | |
> | | | |
> | | | |
> | | | |
> | | | |
> |___|______________|__|
> |__HORIZONTAL_BOTTOM__|
>
> Plus center, Vertical Left and Vertical Right
Possible pages currently are Video, Map.
On the plugin constructor you register the types you have to register, if any and return the Qml elements for the interface, based on the Page:
QList<QUrl> VisualPluginExample::topElements(Page page)
{
if (page == Page::Map) {
auto resultUrls = QList<QUrl>({
QUrl::fromUserInput(":/visualplugin/MapItemExampleTop.qml")
});
qDebug() << "Returning" << resultUrls;
return resultUrls;
}
return {};
}
The Qml code deal with this loading the specific code where it wants:
Connections {
target: kirogi.interfacePlugins
onPluginLoaded: {
var elements = plugin.topElements(InterfaceElementPlugin.Map)
for (var i = 0; i < elements.length; i++) {
var component = Qt.createComponent(elements[i]);
if (component.status === Component.Ready){
component.createObject(horizontalLayoutTop);
}
}
}
}