dark mode
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtNetwork/QNetworkReply>
|
#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\"><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><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>");
|
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()
|
MainWindow::~MainWindow()
|
||||||
@@ -92,15 +97,7 @@ void MainWindow::updateUi() {
|
|||||||
ui->btn_audioin->setEnabled(mPowered);
|
ui->btn_audioin->setEnabled(mPowered);
|
||||||
|
|
||||||
setActiveButton(mInput);
|
setActiveButton(mInput);
|
||||||
|
setPowerState();
|
||||||
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)
|
void MainWindow::setActiveButton(QString prop)
|
||||||
@@ -109,13 +106,31 @@ void MainWindow::setActiveButton(QString prop)
|
|||||||
QPushButton *b = dynamic_cast<QPushButton*>(q);
|
QPushButton *b = dynamic_cast<QPushButton*>(q);
|
||||||
if (b){
|
if (b){
|
||||||
if (b->property("input") == prop)
|
if (b->property("input") == prop)
|
||||||
b->setStyleSheet("background-color: SpringGreen");
|
b->setStyleSheet("background-color: #24e895; color: #404040;");
|
||||||
else
|
else
|
||||||
b->setStyleSheet("");
|
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)
|
void MainWindow::on_txt_address_textEdited(const QString &arg1)
|
||||||
{
|
{
|
||||||
mAddress = arg1;
|
mAddress = arg1;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public:
|
|||||||
explicit MainWindow(QWidget *parent = 0);
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
void setPowerState();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_btn_onoff_clicked();
|
void on_btn_onoff_clicked();
|
||||||
void replyFinished(QNetworkReply *reply);
|
void replyFinished(QNetworkReply *reply);
|
||||||
|
|||||||
208
mainwindow.ui
208
mainwindow.ui
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>359</width>
|
<width>359</width>
|
||||||
<height>161</height>
|
<height>170</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
@@ -16,105 +16,21 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>yremote</string>
|
<string>yremote</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<property name="autoFillBackground">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="btn_onoff">
|
|
||||||
<property name="text">
|
|
||||||
<string>On</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4">
|
|
||||||
<widget class="QLineEdit" name="txt_address">
|
|
||||||
<property name="text">
|
|
||||||
<string>10.0.0.227</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="4">
|
|
||||||
<widget class="QLabel" name="lbl_volume">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Source Code Pro Medium</family>
|
|
||||||
<pointsize>16</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Sunken</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>-400</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Address:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="4">
|
|
||||||
<widget class="QDial" name="dial">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-805</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>-200</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>-400</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="invertedAppearance">
|
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="notchTarget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<double>10.000000000000000</double>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
</property>
|
|
||||||
<property name="notchesVisible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" rowspan="2" colspan="3">
|
<item row="2" column="0" rowspan="2" colspan="3">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Input</string>
|
<string>Input</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
|
||||||
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QPushButton" name="btn_hdmi1">
|
<widget class="QPushButton" name="btn_hdmi1">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@@ -125,9 +41,15 @@
|
|||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>HDMI 1</string>
|
<string>HDMI 1</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="input" stdset="0">
|
<property name="input" stdset="0">
|
||||||
<string>HDMI1</string>
|
<string>HDMI1</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -214,6 +136,108 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Address:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<widget class="QDial" name="dial">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-805</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>-200</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>-400</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="notchTarget">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="notchesVisible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="btn_onoff">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>On</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QLineEdit" name="txt_address">
|
||||||
|
<property name="text">
|
||||||
|
<string>10.0.0.227</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="4">
|
||||||
|
<widget class="QLabel" name="lbl_volume">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Source Code Pro Medium</family>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-400</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
5
resources.qrc
Normal file
5
resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>style.css</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
47
style.css
Normal file
47
style.css
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
QMainWindow {
|
||||||
|
background-color: #404040;
|
||||||
|
border-color: #edf2f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton {
|
||||||
|
background-color: #404040;
|
||||||
|
color: #edf2f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*QPushbutton:disabled {
|
||||||
|
background-color: #24e895;
|
||||||
|
color: #404040;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
QPushButton:hover {
|
||||||
|
border: 1px solid #0077fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit {
|
||||||
|
background-color: #404040;
|
||||||
|
color: #edf2f4;
|
||||||
|
border: 1px solid #0077fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLabel {
|
||||||
|
color: #edf2f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
QGroupBox {
|
||||||
|
color: #edf2f4;
|
||||||
|
border: 1px solid #0077fd;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QGroupBox::title {
|
||||||
|
subcontrol-origin: margin;
|
||||||
|
left: 5px;
|
||||||
|
padding: 0px 5px 0px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDial:hover {
|
||||||
|
border: 1px solid #0077fd;
|
||||||
|
}
|
||||||
|
QLabel#lbl_volume:hover {
|
||||||
|
border: 1px solid #0077fd;
|
||||||
|
}
|
||||||
@@ -33,3 +33,7 @@ HEADERS += \
|
|||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
|
||||||
|
RESOURCES = resources.qrc \
|
||||||
|
resources.qrc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user