Added settings widget for RisingSun
This commit is contained in:
parent
d7009dce43
commit
2015f68fb2
4 changed files with 166 additions and 0 deletions
|
@ -15,6 +15,7 @@ SOURCES += telldusgui.cpp \
|
|||
devicesettingikea.cpp \
|
||||
devicesettingnexa.cpp \
|
||||
devicesettingnexabell.cpp \
|
||||
devicesettingrisingsun.cpp \
|
||||
devicesettingsartano.cpp \
|
||||
devicesetting.cpp \
|
||||
methodwidget.cpp \
|
||||
|
@ -30,6 +31,7 @@ HEADERS += telldusgui.h \
|
|||
devicesettingikea.h \
|
||||
devicesettingnexa.h \
|
||||
devicesettingnexabell.h \
|
||||
devicesettingrisingsun.h \
|
||||
devicesettingsartano.h \
|
||||
devicesetting.h \
|
||||
methodwidget.h \
|
||||
|
|
122
telldus-gui/TelldusGui/devicesettingrisingsun.cpp
Normal file
122
telldus-gui/TelldusGui/devicesettingrisingsun.cpp
Normal file
|
@ -0,0 +1,122 @@
|
|||
//
|
||||
// C++ Implementation: devicesettingnexa
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Micke Prag <micke.prag@telldus.se>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "devicesettingrisingsun.h"
|
||||
#include "device.h"
|
||||
#include <QGridLayout>
|
||||
#include <QDial>
|
||||
#include <QLabel>
|
||||
|
||||
DeviceSettingRisingSun::DeviceSettingRisingSun(Device *device, QWidget *parent)
|
||||
: DeviceSetting(device, parent),
|
||||
dialHouse(0),
|
||||
dialUnit(0)
|
||||
{
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->addSpacerItem( new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding) );
|
||||
|
||||
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
||||
verticalLayout->addLayout(horizontalLayout);
|
||||
verticalLayout->addSpacerItem( new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding) );
|
||||
|
||||
QGridLayout *gridLayoutLeft = new QGridLayout;
|
||||
horizontalLayout->addSpacerItem( new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum) );
|
||||
horizontalLayout->addLayout( gridLayoutLeft );
|
||||
|
||||
horizontalLayout->addSpacerItem( new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum) );
|
||||
|
||||
QGridLayout *gridLayoutRight = new QGridLayout;
|
||||
horizontalLayout->addLayout( gridLayoutRight );
|
||||
horizontalLayout->addSpacerItem( new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum) );
|
||||
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
|
||||
QLabel *houseNotchLabel = new QLabel("I", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutLeft->addWidget(houseNotchLabel, 1, 0, 2, 1);
|
||||
|
||||
houseNotchLabel = new QLabel("II", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutLeft->addWidget(houseNotchLabel, 0, 1, 1, 2);
|
||||
|
||||
houseNotchLabel = new QLabel("III", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutLeft->addWidget(houseNotchLabel, 1, 3, 2, 1);
|
||||
|
||||
houseNotchLabel = new QLabel("IV", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutLeft->addWidget(houseNotchLabel, 3, 1, 1, 2);
|
||||
|
||||
dialHouse = new QDial(this);
|
||||
dialHouse->setObjectName(QString::fromUtf8("dialHouse"));
|
||||
dialHouse->setSizePolicy(sizePolicy);
|
||||
dialHouse->setMinimum(0);
|
||||
dialHouse->setMaximum(4);
|
||||
dialHouse->setPageStep(1);
|
||||
dialHouse->setOrientation(Qt::Horizontal);
|
||||
dialHouse->setNotchesVisible(true);
|
||||
dialHouse->setWrapping(true);
|
||||
gridLayoutLeft->addWidget(dialHouse, 1, 1, 1, 2);
|
||||
|
||||
houseNotchLabel = new QLabel("1", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutRight->addWidget(houseNotchLabel, 1, 0, 2, 1);
|
||||
|
||||
houseNotchLabel = new QLabel("2", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutRight->addWidget(houseNotchLabel, 0, 1, 1, 2);
|
||||
|
||||
houseNotchLabel = new QLabel("3", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutRight->addWidget(houseNotchLabel, 1, 3, 2, 1);
|
||||
|
||||
houseNotchLabel = new QLabel("4", this);
|
||||
houseNotchLabel->setSizePolicy(sizePolicy);
|
||||
houseNotchLabel->setAlignment(Qt::AlignCenter);
|
||||
gridLayoutRight->addWidget(houseNotchLabel, 3, 1, 1, 2);
|
||||
|
||||
|
||||
dialUnit = new QDial(this);
|
||||
dialUnit->setObjectName(QString::fromUtf8("dialHouse"));
|
||||
dialUnit->setSizePolicy(sizePolicy);
|
||||
dialUnit->setMinimum(0);
|
||||
dialUnit->setMaximum(4);
|
||||
dialUnit->setPageStep(1);
|
||||
dialUnit->setOrientation(Qt::Horizontal);
|
||||
dialUnit->setNotchesVisible(true);
|
||||
dialUnit->setWrapping(true);
|
||||
gridLayoutRight->addWidget(dialUnit, 1, 1, 1, 2);
|
||||
|
||||
dialHouse->setValue( device->parameter("nexa_house", "1").toInt() );
|
||||
dialUnit->setValue( device->parameter("nexa_unit", "1").toInt() );
|
||||
}
|
||||
|
||||
|
||||
DeviceSettingRisingSun::~DeviceSettingRisingSun()
|
||||
{
|
||||
}
|
||||
|
||||
void DeviceSettingRisingSun::saveParameters() {
|
||||
int house = (dialHouse->value() == 0 ? 4 : dialHouse->value());
|
||||
int unit = (dialUnit->value() == 0 ? 4 : dialUnit->value());
|
||||
p_device->setParameter( "nexa_house", QString::number(house) );
|
||||
p_device->setParameter( "nexa_unit", QString::number(unit) );
|
||||
}
|
||||
|
40
telldus-gui/TelldusGui/devicesettingrisingsun.h
Normal file
40
telldus-gui/TelldusGui/devicesettingrisingsun.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// C++ Interface: devicesettingnexa
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Micke Prag <micke.prag@telldus.se>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef DEVICESETTINGRISINGSUN_H
|
||||
#define DEVICESETTINGRISINGSUN_H
|
||||
|
||||
#include "devicesetting.h"
|
||||
|
||||
class QGridLayout;
|
||||
class QDial;
|
||||
class QLabel;
|
||||
|
||||
/**
|
||||
@author Micke Prag <micke.prag@telldus.se>
|
||||
*/
|
||||
class DeviceSettingRisingSun : public DeviceSetting
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeviceSettingRisingSun(Device *device, QWidget *parent = 0);
|
||||
|
||||
virtual ~DeviceSettingRisingSun();
|
||||
|
||||
public slots:
|
||||
virtual void saveParameters();
|
||||
|
||||
protected:
|
||||
QDial *dialHouse;
|
||||
QDial *dialUnit;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -6,6 +6,7 @@
|
|||
#include "devicesettingikea.h"
|
||||
#include "devicesettingnexa.h"
|
||||
#include "devicesettingnexabell.h"
|
||||
#include "devicesettingrisingsun.h"
|
||||
#include "devicesettingsartano.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
@ -98,6 +99,7 @@ EditDeviceDialog::EditDeviceDialog(Device *d, QWidget *parent, Qt::WFlags flags)
|
|||
deviceSettings[2] = new DeviceSettingSartano(device, this);
|
||||
deviceSettings[3] = new DeviceSettingIkea(device, this);
|
||||
deviceSettings[4] = new DeviceSettingNexaBell(device, this);
|
||||
deviceSettings[5] = new DeviceSettingRisingSun(device, this);
|
||||
foreach( DeviceSetting *s, deviceSettings ) {
|
||||
settingsLayout->addWidget( s );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue