-
Notifications
You must be signed in to change notification settings - Fork 7
/
adaptormodel.cpp
76 lines (60 loc) · 1.53 KB
/
adaptormodel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "adaptormodel.h"
#include <QtCore/QMetaObject>
#include <QtCore/QString>
#include <QtCore/QVariant>
#include "branchitem.h"
#include "command.h"
#include "mainwindow.h"
#include "vymmodel.h"
extern QString vymInstanceName;
extern Main *mainWindow;
extern QList <Command*> modelCommands;
AdaptorModel::AdaptorModel(QObject *obj)
: QDBusAbstractAdaptor(obj)
{
model=static_cast <VymModel*> (obj);
setAutoRelaySignals (true);
}
void AdaptorModel::setModel(VymModel *vm)
{
model=vm;
}
QString AdaptorModel::caption()
{
return m_caption;
}
void AdaptorModel::setCaption (const QString &newCaption)
{
m_caption=newCaption;
}
QDBusVariant AdaptorModel::getCurrentModelID()
{
return QDBusVariant (mainWindow->currentModelID());
}
QDBusVariant AdaptorModel::branchCount()
{
BranchItem *selbi=model->getSelectedBranch();
if (selbi)
return QDBusVariant (selbi->branchCount() );
else
return QDBusVariant (-1 );
}
QDBusVariant AdaptorModel::execute (const QString &s)
{
return QDBusVariant (model->execute (s));
}
QDBusVariant AdaptorModel::errorLevel()
{
return QDBusVariant (); // model->parser.errorLevel() ); // FIXME-2 really still needed?
}
QDBusVariant AdaptorModel::errorDescription()
{
return QDBusVariant (); // model->parser.errorDescription() );// FIXME-2 really still needed?
}
QDBusVariant AdaptorModel::listCommands ()
{
QStringList list;
foreach(Command *command, modelCommands)
list << command->getName();
return QDBusVariant (list.join(",") );
}