added ui reactions
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user