Add multizone support for LIFX devices
This commit is contained in:
parent
fc6306f44a
commit
e4c43548eb
7 changed files with 710 additions and 164 deletions
|
|
@ -15,6 +15,8 @@ LIFXSettingsEntry::LIFXSettingsEntry(QWidget *parent) :
|
|||
ui(new Ui::LIFXSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->MultizoneCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_MultizoneCheckBox_stateChanged(int)));
|
||||
}
|
||||
|
||||
LIFXSettingsEntry::~LIFXSettingsEntry()
|
||||
|
|
@ -40,13 +42,23 @@ void LIFXSettingsEntry::loadFromSettings(const json& data)
|
|||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
if(data.contains("multizone") && data["multizone"].is_boolean())
|
||||
{
|
||||
ui->MultizoneCheckBox->setCheckState(data["multizone"] == true ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||
}
|
||||
if(data.contains("extended_multizone") && data["extended_multizone"].is_boolean())
|
||||
{
|
||||
ui->ExtendedMultizoneCheckBox->setCheckState(data["extended_multizone"] == true ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
json LIFXSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["multizone"] = ui->MultizoneCheckBox->checkState() == Qt::Checked;
|
||||
result["extended_multizone"] = ui->ExtendedMultizoneCheckBox->checkState() == Qt::Checked;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +67,19 @@ void LIFXSettingsEntry::setName(QString name)
|
|||
ui->NameEdit->setText(name);
|
||||
}
|
||||
|
||||
void LIFXSettingsEntry::on_MultizoneCheckBox_stateChanged(int checkState)
|
||||
{
|
||||
if (checkState == Qt::Checked)
|
||||
{
|
||||
ui->ExtendedMultizoneCheckBox->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->ExtendedMultizoneCheckBox->setEnabled(false);
|
||||
ui->ExtendedMultizoneCheckBox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
bool LIFXSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
|
|
|
|||
|
|
@ -31,5 +31,6 @@ private:
|
|||
Ui::LIFXSettingsEntry *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event) override;
|
||||
void changeEvent(QEvent *event);
|
||||
void on_MultizoneCheckBox_stateChanged(int arg1);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>216</width>
|
||||
<width>605</width>
|
||||
<height>89</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -26,8 +26,15 @@
|
|||
<string>LIFX Device</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="5">
|
||||
<widget class="QLineEdit" name="NameEdit"/>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="IPEdit"/>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QCheckBox" name="MultizoneCheckBox">
|
||||
<property name="text">
|
||||
<string>Multizone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="IPLabel">
|
||||
|
|
@ -36,9 +43,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="IPEdit"/>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="NameLabel">
|
||||
<property name="text">
|
||||
|
|
@ -46,6 +50,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QLineEdit" name="NameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QCheckBox" name="ExtendedMultizoneCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extended Multizone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue