added ui reactions
This commit is contained in:
@@ -81,7 +81,6 @@ void MainWindow::replyFinished(QNetworkReply* reply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateUi() {
|
void MainWindow::updateUi() {
|
||||||
ui->btn_onoff->setText(mPowered ? "On" : "Off");
|
|
||||||
ui->dial->setEnabled(mPowered);
|
ui->dial->setEnabled(mPowered);
|
||||||
ui->dial->setValue(mVolume);
|
ui->dial->setValue(mVolume);
|
||||||
ui->lbl_volume->setEnabled(mPowered);
|
ui->lbl_volume->setEnabled(mPowered);
|
||||||
@@ -91,7 +90,30 @@ void MainWindow::updateUi() {
|
|||||||
ui->btn_spotify->setEnabled(mPowered);
|
ui->btn_spotify->setEnabled(mPowered);
|
||||||
ui->btn_airplay->setEnabled(mPowered);
|
ui->btn_airplay->setEnabled(mPowered);
|
||||||
ui->btn_audioin->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)
|
void MainWindow::on_txt_address_textEdited(const QString &arg1)
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ private:
|
|||||||
void sendCommand(QString cmd);
|
void sendCommand(QString cmd);
|
||||||
void updateUi();
|
void updateUi();
|
||||||
void sendVolume();
|
void sendVolume();
|
||||||
|
|
||||||
|
void setActiveButton(QString prop);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
251
mainwindow.ui
251
mainwindow.ui
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>528</width>
|
<width>426</width>
|
||||||
<height>199</height>
|
<height>174</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
@@ -18,95 +18,24 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="0" rowspan="2" colspan="3">
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QPushButton" name="btn_onoff">
|
||||||
<property name="title">
|
<property name="text">
|
||||||
<string>Input</string>
|
<string>On</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QPushButton" name="btn_hdmi1">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>HDMI 1</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="btn_hdmi2">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>60</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>HDMI 2</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="btn_hdmi3">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>HDMI 3</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="btn_spotify">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>110</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Spotify</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="btn_airplay">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>110</x>
|
|
||||||
<y>60</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Airplay</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="btn_audioin">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>110</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Audio In</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="3">
|
<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">
|
<widget class="QLabel" name="lbl_volume">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
@@ -128,14 +57,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="2">
|
||||||
<widget class="QPushButton" name="btn_onoff">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>On</string>
|
<string>Address:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3" rowspan="3">
|
<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">
|
<widget class="QDial" name="dial">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-805</number>
|
<number>-805</number>
|
||||||
@@ -163,31 +105,110 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0" rowspan="2" colspan="3">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Address:</string>
|
<string>Input</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="flat">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item row="1" column="1">
|
|
||||||
<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="0" column="1">
|
|
||||||
<widget class="QLabel" name="lbl_input">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QPushButton" name="btn_hdmi1">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HDMI 1</string>
|
||||||
|
</property>
|
||||||
|
<property name="input" stdset="0">
|
||||||
|
<string>HDMI1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_hdmi2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HDMI 2</string>
|
||||||
|
</property>
|
||||||
|
<property name="input" stdset="0">
|
||||||
|
<string>HDMI2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_hdmi3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>90</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HDMI 3</string>
|
||||||
|
</property>
|
||||||
|
<property name="input" stdset="0">
|
||||||
|
<string>HDMI3</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_spotify">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>110</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Spotify</string>
|
||||||
|
</property>
|
||||||
|
<property name="input" stdset="0">
|
||||||
|
<string>Spotify</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_airplay">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>110</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Airplay</string>
|
||||||
|
</property>
|
||||||
|
<property name="input" stdset="0">
|
||||||
|
<string>IPOD</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_audioin">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>110</x>
|
||||||
|
<y>90</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Audio In</string>
|
||||||
|
</property>
|
||||||
|
<property name="input" stdset="0">
|
||||||
|
<string>AUDIO</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
BIN
yremote.ico
Normal file
BIN
yremote.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
@@ -24,6 +24,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
RC_ICONS = yremote.ico
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
|
|||||||
Reference in New Issue
Block a user