1 #include "adaptormodel.h"
2 #include <QtCore/QMetaObject>
3 #include <QtCore/QString>
4 #include <QtCore/QVariant>
6 #include "mainwindow.h"
9 extern QString vymInstanceName;
10 extern Main *mainWindow;
12 AdaptorModel::AdaptorModel(QObject *obj)
13 : QDBusAbstractAdaptor(obj)
15 model=static_cast <VymModel*> (obj);
16 setAutoRelaySignals (true);
19 AdaptorModel::~AdaptorModel()
24 void AdaptorModel::setModel(VymModel *vm)
29 QString AdaptorModel::caption()
34 void AdaptorModel::setCaption (const QString &newCaption)
39 QDBusVariant AdaptorModel::query(const QString &query)
43 s=model->getHeading();
45 s="oops, no vymModel?";
47 return QDBusVariant (s);
50 QDBusVariant AdaptorModel::getCurrentModelID()
52 return QDBusVariant (mainWindow->currentModelID());
55 QDBusVariant AdaptorModel::getHeading()
59 s=model->getHeading();
61 s="oops, no vymModel?";
63 return QDBusVariant (s);
67 void AdaptorModel::setHeading (const QString &s)
72 QDBusVariant AdaptorModel::getInstanceName()
74 return QDBusVariant (vymInstanceName);
77 QDBusVariant AdaptorModel::execute (const QString &s)
80 return QDBusVariant (model->runScript (s));
82 return QDBusVariant ("No model.");