70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QSettings>
|
|
#include <QTimer>
|
|
#include "QtNetwork/QNetworkAccessManager"
|
|
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
|
|
namespace yremote {
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow() override;
|
|
|
|
void setPowerState();
|
|
void updateAVState();
|
|
|
|
private slots:
|
|
void on_btn_onoff_clicked();
|
|
void replyFinished(QNetworkReply *reply);
|
|
|
|
void on_txt_address_textEdited(const QString &arg1);
|
|
void on_dial_valueChanged(int value);
|
|
void on_btn_hdmi1_clicked();
|
|
void on_btn_hdmi2_clicked();
|
|
void on_btn_hdmi3_clicked();
|
|
void on_btn_spotify_clicked();
|
|
void on_btn_airplay_clicked();
|
|
void on_btn_audioin_clicked();
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
|
|
bool mPowered = false;
|
|
int mVolume = 0;
|
|
QString mInput;
|
|
const int TIME_VOL_COLLECT = 400;
|
|
const int TIME_UPDATE_STATE = 10000;
|
|
const int TIME_UPDATE_ADDRESS = 1000;
|
|
|
|
QString mAddress;
|
|
QTimer mTimerValCollect;
|
|
QTimer mTimerUpdateState;
|
|
QTimer mTimerUpdateAddress;
|
|
QSettings* mSettings = nullptr;
|
|
QNetworkAccessManager *mNetworkManager = nullptr;
|
|
|
|
void sendCommand(QString cmd);
|
|
void updateUi();
|
|
void setActiveButton(QString prop);
|
|
void sendVolume();
|
|
|
|
// QWidget interface
|
|
protected:
|
|
void moveEvent(QMoveEvent *) override;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // MAINWINDOW_H
|