Implemented tdStop() in our devicewidget

This commit is contained in:
Micke Prag 2011-02-25 16:33:55 +00:00
parent f82768b7b6
commit fc0f379af8
2 changed files with 8 additions and 6 deletions

View file

@ -13,7 +13,7 @@ inline double round(double x) {
}
#endif
const int SUPPORTED_METHODS = TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_BELL | TELLSTICK_DIM | TELLSTICK_LEARN | TELLSTICK_EXECUTE | TELLSTICK_UP | TELLSTICK_DOWN;
const int SUPPORTED_METHODS = TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_BELL | TELLSTICK_DIM | TELLSTICK_LEARN | TELLSTICK_EXECUTE | TELLSTICK_UP | TELLSTICK_DOWN | TELLSTICK_STOP;
DeviceModel::DeviceModel(QObject *parent)
@ -69,6 +69,8 @@ QVariant DeviceModel::data(const QModelIndex &index, int role) const {
return tr("up");
case TELLSTICK_DOWN:
return tr("down");
case TELLSTICK_STOP:
return tr("stopped");
case TELLSTICK_DIM:
int value = (int)round(device->lastSentValue().toFloat()/255*100);
return tr("%1%").arg(value);

View file

@ -12,7 +12,7 @@ class MethodWidget::PrivateData {
public:
Device *device;
QToolButton *turnOff, *turnOn, *bell, *learn,
*dim25, *dim50, *dim75,
*dim25, *dim50, *dim75,
*execute, *up, *down, *stop;
};
@ -37,7 +37,7 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
d->turnOff->setIcon( QIcon(":/images/state_2.png") );
d->turnOff->setVisible( false );
layout->addWidget( d->turnOff );
@ -58,7 +58,7 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
d->turnOn->setIcon( QIcon(":/images/state_1.png") );
d->turnOn->setVisible( false );
layout->addWidget( d->turnOn );
d->bell->setIcon( QIcon(":/images/bell.png") );
d->bell->setVisible( false );
layout->addWidget( d->bell );
@ -78,7 +78,7 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
d->stop->setIcon( QIcon(":/images/state_2.png") ); //TODO
d->stop->setVisible( false );
layout->addWidget( d->stop );
layout->addStretch();
d->learn->setText( tr("Learn") );
@ -96,7 +96,7 @@ MethodWidget::MethodWidget( Device *device, QWidget *parent )
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()));
connect(d->stop, SIGNAL(clicked()), device, SLOT(stop()));
updateMethods(device->methods());