added ui reactions

This commit is contained in:
2018-10-20 16:41:19 +02:00
parent f1d9a08a84
commit e462c3d749
5 changed files with 163 additions and 117 deletions

View File

@@ -81,7 +81,6 @@ void MainWindow::replyFinished(QNetworkReply* reply)
}
void MainWindow::updateUi() {
ui->btn_onoff->setText(mPowered ? "On" : "Off");
ui->dial->setEnabled(mPowered);
ui->dial->setValue(mVolume);
ui->lbl_volume->setEnabled(mPowered);
@@ -91,7 +90,30 @@ void MainWindow::updateUi() {
ui->btn_spotify->setEnabled(mPowered);
ui->btn_airplay->setEnabled(mPowered);
ui->btn_audioin->setEnabled(mPowered);
ui->lbl_input->setText(mInput);
setActiveButton(mInput);
if (mPowered) {
ui->btn_onoff->setText("On");
ui->btn_onoff->setStyleSheet("background-color: SpringGreen");
} else {
ui->btn_onoff->setText("Off");
ui->btn_onoff->setStyleSheet("background-color: DarkRed");
setActiveButton("");
}
}
void MainWindow::setActiveButton(QString prop)
{
for (QObject *q : ui->groupBox->children()) {
QPushButton *b = dynamic_cast<QPushButton*>(q);
if (b){
if (b->property("input") == prop)
b->setStyleSheet("background-color: SpringGreen");
else
b->setStyleSheet("");
}
}
}
void MainWindow::on_txt_address_textEdited(const QString &arg1)