Execute, up and down methods added to Telldus Center
This commit is contained in:
parent
75af4fb7fa
commit
0433062d89
5 changed files with 54 additions and 2 deletions
|
@ -159,6 +159,18 @@ void Device::bell() {
|
|||
triggerEvent( tdBell( d->id ) );
|
||||
}
|
||||
|
||||
void Device::execute() {
|
||||
triggerEvent( tdExecute( d->id ) );
|
||||
}
|
||||
|
||||
void Device::up() {
|
||||
triggerEvent( tdUp( d->id ) );
|
||||
}
|
||||
|
||||
void Device::down() {
|
||||
triggerEvent( tdDown( d->id ) );
|
||||
}
|
||||
|
||||
void Device::dim(unsigned char level) {
|
||||
triggerEvent( tdDim( d->id, level ) );
|
||||
}
|
||||
|
|
|
@ -44,6 +44,9 @@ public slots:
|
|||
void turnOn();
|
||||
void bell();
|
||||
void dim(unsigned char level);
|
||||
void execute();
|
||||
void up();
|
||||
void down();
|
||||
void learn();
|
||||
|
||||
signals:
|
||||
|
|
|
@ -13,7 +13,7 @@ inline double round(double x) {
|
|||
}
|
||||
#endif
|
||||
|
||||
const int SUPPORTED_METHODS = TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_BELL | TELLSTICK_DIM | TELLSTICK_LEARN;
|
||||
const int SUPPORTED_METHODS = TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_BELL | TELLSTICK_DIM | TELLSTICK_LEARN | TELLSTICK_EXECUTE | TELLSTICK_UP | TELLSTICK_DOWN;
|
||||
|
||||
|
||||
DeviceModel::DeviceModel(QObject *parent)
|
||||
|
@ -64,6 +64,10 @@ QVariant DeviceModel::data(const QModelIndex &index, int role) const {
|
|||
return tr("on");
|
||||
case TELLSTICK_TURNOFF:
|
||||
return tr("off");
|
||||
case TELLSTICK_UP:
|
||||
return tr("up");
|
||||
case TELLSTICK_DOWN:
|
||||
return tr("down");
|
||||
case TELLSTICK_DIM:
|
||||
int value = (int)round(device->lastSentValue().toFloat()/255*100);
|
||||
return tr("%1%").arg(value);
|
||||
|
|
|
@ -12,7 +12,8 @@ class MethodWidget::PrivateData {
|
|||
public:
|
||||
Device *device;
|
||||
QToolButton *turnOff, *turnOn, *bell, *learn,
|
||||
*dim25, *dim50, *dim75;
|
||||
*dim25, *dim50, *dim75,
|
||||
*execute, *up, *down, *stop;
|
||||
};
|
||||
|
||||
MethodWidget::MethodWidget( Device *device, QWidget *parent )
|
||||
|
@ -27,6 +28,10 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
|
|||
d->turnOn = new QToolButton( this );
|
||||
d->bell = new QToolButton( this );
|
||||
d->learn = new QToolButton( this );
|
||||
d->execute = new QToolButton( this );
|
||||
d->up = new QToolButton( this );
|
||||
d->down = new QToolButton( this );
|
||||
d->stop = new QToolButton( this );
|
||||
|
||||
// this->setAutoFillBackground( true );
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
|
@ -57,6 +62,22 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
|
|||
d->bell->setIcon( QIcon(":/images/bell.png") );
|
||||
d->bell->setVisible( false );
|
||||
layout->addWidget( d->bell );
|
||||
|
||||
d->execute->setIcon( QIcon(":/images/execute.png") );
|
||||
d->execute->setVisible( false );
|
||||
layout->addWidget( d->execute );
|
||||
|
||||
d->up->setIcon( QIcon(":/images/up.png") );
|
||||
d->up->setVisible( false );
|
||||
layout->addWidget( d->up );
|
||||
|
||||
d->down->setIcon( QIcon(":/images/down.png") );
|
||||
d->down->setVisible( false );
|
||||
layout->addWidget( d->down );
|
||||
|
||||
d->stop->setIcon( QIcon(":/images/state_2.png") ); //TODO
|
||||
d->stop->setVisible( false );
|
||||
layout->addWidget( d->stop );
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
|
@ -72,6 +93,11 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
|
|||
connect(d->turnOn, SIGNAL(clicked()), device, SLOT(turnOn()));
|
||||
connect(d->bell, SIGNAL(clicked()), device, SLOT(bell()));
|
||||
connect(d->learn, SIGNAL(clicked()), device, SLOT(learn()));
|
||||
connect(d->execute, SIGNAL(clicked()), device, SLOT(execute()));
|
||||
connect(d->up, SIGNAL(clicked()), device, SLOT(up()));
|
||||
connect(d->down, SIGNAL(clicked()), device, SLOT(down()));
|
||||
connect(d->stop, SIGNAL(clicked()), device, SLOT(turnOff()));
|
||||
|
||||
|
||||
updateMethods(device->methods());
|
||||
}
|
||||
|
@ -88,6 +114,10 @@ void MethodWidget::updateMethods(int newMethods) {
|
|||
d->turnOn->setVisible( newMethods & TELLSTICK_TURNON );
|
||||
d->bell->setVisible( newMethods & TELLSTICK_BELL );
|
||||
d->learn->setVisible( newMethods & TELLSTICK_LEARN );
|
||||
d->execute->setVisible( newMethods & TELLSTICK_EXECUTE );
|
||||
d->up->setVisible( newMethods & TELLSTICK_UP );
|
||||
d->down->setVisible( newMethods & TELLSTICK_DOWN );
|
||||
d->stop->setVisible( newMethods & TELLSTICK_STOP );
|
||||
}
|
||||
|
||||
void MethodWidget::dim() {
|
||||
|
|
|
@ -10,5 +10,8 @@
|
|||
<file>images/state_dimmed_25.png</file>
|
||||
<file>images/state_dimmed_50.png</file>
|
||||
<file>images/state_dimmed_75.png</file>
|
||||
<file>images/execute.png</file>
|
||||
<file>images/up.png</file>
|
||||
<file>images/down.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue