diff --git a/telldus-gui/TelldusGui/device.cpp b/telldus-gui/TelldusGui/device.cpp index b46bffc4..58d4e568 100644 --- a/telldus-gui/TelldusGui/device.cpp +++ b/telldus-gui/TelldusGui/device.cpp @@ -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 ) ); } diff --git a/telldus-gui/TelldusGui/device.h b/telldus-gui/TelldusGui/device.h index 2e48bf15..38f370bf 100644 --- a/telldus-gui/TelldusGui/device.h +++ b/telldus-gui/TelldusGui/device.h @@ -44,6 +44,9 @@ public slots: void turnOn(); void bell(); void dim(unsigned char level); + void execute(); + void up(); + void down(); void learn(); signals: diff --git a/telldus-gui/TelldusGui/devicemodel.cpp b/telldus-gui/TelldusGui/devicemodel.cpp index a2b50989..ade2ff80 100644 --- a/telldus-gui/TelldusGui/devicemodel.cpp +++ b/telldus-gui/TelldusGui/devicemodel.cpp @@ -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); diff --git a/telldus-gui/TelldusGui/methodwidget.cpp b/telldus-gui/TelldusGui/methodwidget.cpp index 2001f757..3b0c7186 100644 --- a/telldus-gui/TelldusGui/methodwidget.cpp +++ b/telldus-gui/TelldusGui/methodwidget.cpp @@ -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() { diff --git a/telldus-gui/TelldusGui/telldusgui.qrc b/telldus-gui/TelldusGui/telldusgui.qrc index 3cada74a..418c89b8 100644 --- a/telldus-gui/TelldusGui/telldusgui.qrc +++ b/telldus-gui/TelldusGui/telldusgui.qrc @@ -10,5 +10,8 @@ images/state_dimmed_25.png images/state_dimmed_50.png images/state_dimmed_75.png + images/execute.png + images/up.png + images/down.png