author | insilmaril |
Tue, 18 Aug 2009 12:39:07 +0000 | |
changeset 788 | 78ba80b54bc4 |
parent 785 | 5987f9f15bac |
child 804 | 14f2b1b15242 |
permissions | -rw-r--r-- |
insilmaril@785 | 1 |
#include "adaptormodel.h" |
insilmaril@785 | 2 |
#include <QtCore/QMetaObject> |
insilmaril@785 | 3 |
#include <QtCore/QString> |
insilmaril@785 | 4 |
#include <QtCore/QVariant> |
insilmaril@785 | 5 |
|
insilmaril@785 | 6 |
#include "vymmodel.h" |
insilmaril@785 | 7 |
|
insilmaril@785 | 8 |
AdaptorModel::AdaptorModel(QObject *obj) |
insilmaril@785 | 9 |
: QDBusAbstractAdaptor(obj) |
insilmaril@785 | 10 |
{ |
insilmaril@785 | 11 |
model=static_cast <VymModel*> (obj); |
insilmaril@785 | 12 |
setAutoRelaySignals (true); |
insilmaril@785 | 13 |
} |
insilmaril@785 | 14 |
|
insilmaril@785 | 15 |
AdaptorModel::~AdaptorModel() |
insilmaril@785 | 16 |
{ |
insilmaril@785 | 17 |
// destructor |
insilmaril@785 | 18 |
} |
insilmaril@785 | 19 |
|
insilmaril@785 | 20 |
void AdaptorModel::setModel(VymModel *vm) |
insilmaril@785 | 21 |
{ |
insilmaril@785 | 22 |
model=vm; |
insilmaril@785 | 23 |
} |
insilmaril@785 | 24 |
|
insilmaril@785 | 25 |
QString AdaptorModel::caption() |
insilmaril@785 | 26 |
{ |
insilmaril@785 | 27 |
return m_caption; |
insilmaril@785 | 28 |
} |
insilmaril@785 | 29 |
|
insilmaril@785 | 30 |
void AdaptorModel::setCaption (const QString &newCaption) |
insilmaril@785 | 31 |
{ |
insilmaril@785 | 32 |
m_caption=newCaption; |
insilmaril@785 | 33 |
} |
insilmaril@785 | 34 |
|
insilmaril@785 | 35 |
QDBusVariant AdaptorModel::query(const QString &query) |
insilmaril@785 | 36 |
{ |
insilmaril@785 | 37 |
QString s; |
insilmaril@785 | 38 |
if (model) |
insilmaril@785 | 39 |
s=model->getHeading(); |
insilmaril@785 | 40 |
else |
insilmaril@785 | 41 |
s="oops, no vymModel?"; |
insilmaril@785 | 42 |
|
insilmaril@785 | 43 |
return QDBusVariant (s); |
insilmaril@785 | 44 |
} |
insilmaril@785 | 45 |
|
insilmaril@785 | 46 |
QDBusVariant AdaptorModel::getHeading() |
insilmaril@785 | 47 |
{ |
insilmaril@785 | 48 |
QString s; |
insilmaril@785 | 49 |
if (model) |
insilmaril@785 | 50 |
s=model->getHeading(); |
insilmaril@785 | 51 |
else |
insilmaril@785 | 52 |
s="oops, no vymModel?"; |
insilmaril@785 | 53 |
|
insilmaril@785 | 54 |
return QDBusVariant (s); |
insilmaril@785 | 55 |
} |
insilmaril@785 | 56 |
|
insilmaril@785 | 57 |