dark mode
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
|
||||
@@ -23,6 +24,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
sendCommand("<YAMAHA_AV cmd=\"GET\"><System><Power_Control><Power>GetParam</Power></Power_Control></System></YAMAHA_AV>");
|
||||
sendCommand("<YAMAHA_AV cmd=\"GET\"><Main_Zone><Volume><Lvl>GetParam</Lvl></Volume></Main_Zone></YAMAHA_AV>");
|
||||
sendCommand("<YAMAHA_AV cmd=\"GET\"><Main_Zone><Input><Input_Sel>GetParam</Input_Sel></Input></Main_Zone></YAMAHA_AV>");
|
||||
|
||||
QFile css(":style.css");
|
||||
if (css.open(QFile::ReadOnly | QFile::Text))
|
||||
this->setStyleSheet(css.readAll());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -92,15 +97,7 @@ void MainWindow::updateUi() {
|
||||
ui->btn_audioin->setEnabled(mPowered);
|
||||
|
||||
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("");
|
||||
}
|
||||
setPowerState();
|
||||
}
|
||||
|
||||
void MainWindow::setActiveButton(QString prop)
|
||||
@@ -109,13 +106,31 @@ void MainWindow::setActiveButton(QString prop)
|
||||
QPushButton *b = dynamic_cast<QPushButton*>(q);
|
||||
if (b){
|
||||
if (b->property("input") == prop)
|
||||
b->setStyleSheet("background-color: SpringGreen");
|
||||
b->setStyleSheet("background-color: #24e895; color: #404040;");
|
||||
else
|
||||
b->setStyleSheet("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setPowerState()
|
||||
{
|
||||
if (mPowered) {
|
||||
ui->btn_onoff->setText("On");
|
||||
ui->btn_onoff->setStyleSheet("background-color: #24e895; color: #404040;");
|
||||
ui->lbl_volume->setStyleSheet("color: #24e895");
|
||||
ui->dial->setStyleSheet("background-color: #24e895");
|
||||
} else {
|
||||
ui->btn_onoff->setText("Off");
|
||||
ui->btn_onoff->setStyleSheet("");
|
||||
ui->lbl_volume->setStyleSheet("");
|
||||
ui->dial->setStyleSheet("");
|
||||
setActiveButton("");
|
||||
}
|
||||
qDebug() << ui->btn_onoff->isEnabled(); // rogo: delete
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_txt_address_textEdited(const QString &arg1)
|
||||
{
|
||||
mAddress = arg1;
|
||||
|
||||
Reference in New Issue
Block a user