Added settingswidget DeviceSettingUnitcode
This commit is contained in:
parent
511d06b909
commit
b4abbbe3bb
4 changed files with 117 additions and 1 deletions
|
@ -24,6 +24,7 @@ SET( telldus-gui_SRCS
|
|||
devicesettingnexabell.cpp
|
||||
devicesettingrisingsun.cpp
|
||||
devicesettingsartano.cpp
|
||||
devicesettingunitcode.cpp
|
||||
devicesettingupm.cpp
|
||||
devicesetting.cpp
|
||||
methodwidget.cpp
|
||||
|
@ -50,6 +51,7 @@ SET( telldus-gui_MOC_HDRS
|
|||
devicesettingnexabell.h
|
||||
devicesettingrisingsun.h
|
||||
devicesettingsartano.h
|
||||
devicesettingunitcode.h
|
||||
devicesettingupm.h
|
||||
devicesetting.h
|
||||
methodwidget.h
|
||||
|
@ -60,6 +62,8 @@ QT4_WRAP_CPP( telldus-gui_MOC_SRCS ${telldus-gui_MOC_HDRS} )
|
|||
QT4_AUTOMOC ( ${telldus-gui_SRCS} )
|
||||
QT4_ADD_RESOURCES (telldus-gui_RSRCS telldusgui.qrc data/${BRANDING}/resources.qrc )
|
||||
|
||||
LIST(APPEND telldus-gui_RSRCS data/${BRANDING}/devices.xml)
|
||||
|
||||
SET( telldus-gui_LIBRARIES
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
|
67
telldus-gui/TelldusGui/devicesettingunitcode.cpp
Normal file
67
telldus-gui/TelldusGui/devicesettingunitcode.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
//
|
||||
// C++ Implementation: devicesettingnexa
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Micke Prag <micke.prag@telldus.se>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "devicesettingunitcode.h"
|
||||
#include "device.h"
|
||||
#include <QGridLayout>
|
||||
#include <QDial>
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
|
||||
DeviceSettingUnitcode::DeviceSettingUnitcode(Device *device, QWidget *parent)
|
||||
: DeviceSetting(device, parent),
|
||||
dialCode(0)
|
||||
{
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
|
||||
QLabel *labelCodeTitle = new QLabel(this);
|
||||
labelCodeTitle->setObjectName(QString::fromUtf8("labelCodeTitle"));
|
||||
labelCodeTitle->setAlignment(Qt::AlignCenter);
|
||||
labelCodeTitle->setText( tr("Unit code") );
|
||||
gridLayout->addWidget(labelCodeTitle, 0, 0, 1, 1);
|
||||
|
||||
dialCode = new QDial(this);
|
||||
dialCode->setObjectName(QString::fromUtf8("dialCode"));
|
||||
dialCode->setMinimum(1);
|
||||
dialCode->setMaximum(4);
|
||||
dialCode->setPageStep(1);
|
||||
dialCode->setOrientation(Qt::Horizontal);
|
||||
dialCode->setNotchesVisible(true);
|
||||
gridLayout->addWidget(dialCode, 1, 0, 1, 1);
|
||||
connect(dialCode, SIGNAL(valueChanged(int)), this, SLOT(codeChanged(int) ) );
|
||||
|
||||
|
||||
labelCode = new QLabel(this);
|
||||
labelCode->setObjectName(QString::fromUtf8("labelCode"));
|
||||
labelCode->setAlignment(Qt::AlignCenter);
|
||||
labelCode->setText( "1" );
|
||||
gridLayout->addWidget(labelCode, 2, 0, 1, 1);
|
||||
|
||||
this->setValue( "unit", device->parameter("unit", "1") );
|
||||
}
|
||||
|
||||
|
||||
DeviceSettingUnitcode::~DeviceSettingUnitcode() {
|
||||
}
|
||||
|
||||
void DeviceSettingUnitcode::saveParameters() {
|
||||
p_device->setParameter( "unit", QString::number(dialCode->value()) );
|
||||
}
|
||||
|
||||
void DeviceSettingUnitcode::setValue( const QString &name, const QString &value ) {
|
||||
if (name == "unit") {
|
||||
dialCode->setValue(value.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSettingUnitcode::codeChanged(int code) {
|
||||
labelCode->setText(QString("%1").arg(dialCode->value()));
|
||||
}
|
43
telldus-gui/TelldusGui/devicesettingunitcode.h
Normal file
43
telldus-gui/TelldusGui/devicesettingunitcode.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// C++ Interface: devicesettingnexa
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Micke Prag <micke.prag@telldus.se>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef DEVICESETTINGUNITCODE_H
|
||||
#define DEVICESETTINGUNITCODE_H
|
||||
|
||||
#include "devicesetting.h"
|
||||
|
||||
class QDial;
|
||||
class QLabel;
|
||||
|
||||
/**
|
||||
@author Micke Prag <micke.prag@telldus.se>
|
||||
*/
|
||||
class DeviceSettingUnitcode : public DeviceSetting
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeviceSettingUnitcode(Device *device, QWidget *parent = 0);
|
||||
|
||||
virtual ~DeviceSettingUnitcode();
|
||||
|
||||
public slots:
|
||||
virtual void saveParameters();
|
||||
virtual void setValue( const QString &name, const QString &value );
|
||||
|
||||
private slots:
|
||||
void codeChanged(int);
|
||||
|
||||
protected:
|
||||
QDial *dialCode;
|
||||
QLabel *labelCode;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -12,6 +12,7 @@
|
|||
#include "devicesettingnexabell.h"
|
||||
#include "devicesettingrisingsun.h"
|
||||
#include "devicesettingsartano.h"
|
||||
#include "devicesettingunitcode.h"
|
||||
#include "devicesettingupm.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
@ -157,7 +158,8 @@ EditDeviceDialog::EditDeviceDialog(Device *device, QWidget *parent, Qt::WFlags f
|
|||
d->deviceSettings[12] = new DeviceSettingArctechSelflearning(device, this);
|
||||
((DeviceSettingArctechSelflearning *)d->deviceSettings[12])->setRemoteMinMax(1,33554432);
|
||||
((DeviceSettingArctechSelflearning *)d->deviceSettings[12])->setUnitMinMax(1,16);
|
||||
|
||||
d->deviceSettings[13] = new DeviceSettingUnitcode(device, this);
|
||||
|
||||
foreach( DeviceSetting *s, d->deviceSettings ) {
|
||||
connect(d->filteredModel, SIGNAL(setParameter(const QString&, const QString&)), s, SLOT(setValue(const QString&, const QString&)));
|
||||
d->settingsLayout->addWidget( s );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue