ill-implemented new backend
This commit is contained in:
parent
f874d764db
commit
5c3499b865
@ -22,7 +22,8 @@ public:
|
||||
|
||||
signals:
|
||||
void move(QString windowId, QString targetUrl);
|
||||
void ifaceReq( QString senderId, QString service, QString path
|
||||
void ifaceReq( QString senderId, QString shortName
|
||||
, QString service, QString path
|
||||
, QString interface, QDBusConnection connection );
|
||||
|
||||
public slots:
|
||||
@ -38,7 +39,7 @@ private:
|
||||
|
||||
void open(QString targetUrl);
|
||||
void justMove(QString senderId, QString targetUrl);
|
||||
void collectIfaces(QObject *window);
|
||||
void collectIfaces(QObject *window, QString targetId);
|
||||
|
||||
QHash<QString, QVector<QString>> past;
|
||||
QHash<QString, QVector<QString>> future;
|
||||
|
@ -10,11 +10,12 @@
|
||||
namespace Alterator{
|
||||
class DBusConnector: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DBusConnector(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void pushInLogs(QString targetId, QList<QString> logs);
|
||||
//void pushInLogs(QString targetId, QList<QString> logs);
|
||||
void giveInterface(QString targetId, DBusInterface *iface);
|
||||
|
||||
public slots:
|
||||
|
@ -14,6 +14,9 @@ class DBusInterface: public QObject{
|
||||
public:
|
||||
DBusInterface( DBusPropertyMap *introspection, QDBusInterface *ri,
|
||||
QString iname, QString sname, QObject *parent = 0 );
|
||||
|
||||
QString getShortName();
|
||||
DBusPropertyMap *getProperties();
|
||||
public slots:
|
||||
void propertyUpdatedFromDBus(
|
||||
QDBusArgument ifaceName
|
||||
|
@ -23,6 +23,9 @@ Loader::Loader(QObject *p):QObject(p)
|
||||
open(startingPage);
|
||||
connect(dbus, SIGNAL(giveInterface(QString, DBusInterface *))
|
||||
, this, SLOT(getIface(QString, DBusInterface *)));
|
||||
connect(this, SIGNAL(ifaceReq( QString, QString, QString, QString, QString, QDBusConnection))
|
||||
, dbus, SLOT(ifaceReq( QString, QString, QString, QString, QString, QDBusConnection)));
|
||||
|
||||
}
|
||||
|
||||
void Loader::open(QString targetUrl){
|
||||
@ -31,6 +34,7 @@ void Loader::open(QString targetUrl){
|
||||
QObject *window = engine->rootObjects().last();
|
||||
window->setProperty("url", targetUrl);
|
||||
window->setProperty("windowId", windowId);
|
||||
collectIfaces(window, windowId);
|
||||
past.insert(windowId, QVector<QString>() << targetUrl);
|
||||
future.insert(windowId, QVector<QString>());
|
||||
widgets.insert(windowId, window);
|
||||
@ -89,10 +93,26 @@ void Loader::forvard(QString senderId){
|
||||
}
|
||||
|
||||
void Loader::getIface(QString targetId, DBusInterface *iface){
|
||||
qDebug() << engine->rootContext()->children();
|
||||
QQmlContext *pageContext = new QQmlContext(engine->rootContext());
|
||||
widgets[targetId]->findChild<QQmlComponent *>(
|
||||
"currentPageN", Qt::FindChildrenRecursively)->create(pageContext);
|
||||
pageContext->setContextProperty(iface->getShortName(), iface);
|
||||
QQmlContext *ifaceContext = new QQmlContext(pageContext);
|
||||
widgets[targetId]->findChild<QQmlComponent *>(
|
||||
"currentPageN", Qt::FindChildrenRecursively)->create(ifaceContext);
|
||||
ifaceContext->setContextProperty("properties", iface->getProperties());
|
||||
}
|
||||
|
||||
void Loader::collectIfaces(QObject *window){
|
||||
QList<QVariant> window->property("requiredInterfaces");
|
||||
void Loader::collectIfaces(QObject *window, QString targetId){
|
||||
QList<QVariant> raw = window->property("requiredInterfaces").toList();
|
||||
QVariant i;
|
||||
foreach(i, raw){
|
||||
QHash<QString, QVariant> t = i.toHash();
|
||||
emit(ifaceReq(targetId, t["shortName"].toString()
|
||||
, t["service"].toString(), t["path"].toString()
|
||||
, t["interface"].toString()
|
||||
, t["isSessionBus"].toBool() ? QDBusConnection::sessionBus()
|
||||
: QDBusConnection::systemBus()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,14 @@ DBusInterface::DBusInterface( DBusPropertyMap *introspection, QDBusInterface *ri
|
||||
ifaceName = iname;
|
||||
connect(introspection, SIGNAL(updateDBus()), this, SLOT(updateDBus()));
|
||||
}
|
||||
|
||||
QString DBusInterface::getShortName(){
|
||||
return shortName;
|
||||
}
|
||||
DBusPropertyMap * DBusInterface::getProperties(){
|
||||
return properties;
|
||||
}
|
||||
|
||||
void DBusInterface::propertyUpdatedFromDBus(
|
||||
QDBusArgument ifaceName
|
||||
, QDBusArgument changedProperties
|
||||
|
@ -10,7 +10,7 @@ import shared 1.0
|
||||
ScrollView {
|
||||
id: view
|
||||
|
||||
property var RequiredInterfaces:
|
||||
property var requiredInterfaces:
|
||||
[ {shortname : "hostname"
|
||||
, service : "org.freedesktop.hostname1"
|
||||
, path : "/org/freedesktop/hostname1"
|
||||
|
Loading…
Reference in New Issue
Block a user