0.3
This commit is contained in:
parent
42d8cb6d1a
commit
680d78e173
2 changed files with 16 additions and 5 deletions
|
@ -7,18 +7,23 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setInterval(1000);
|
||||
timer = new QTimer(this);
|
||||
timer->setInterval(5000);
|
||||
connect(timer,&QTimer::timeout,this,&MainWindow::holen_status);
|
||||
timer->start();
|
||||
|
||||
manager = new QNetworkAccessManager();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete timer;
|
||||
delete manager;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::holen_status(){
|
||||
status_loop="ja";
|
||||
//Autoplay
|
||||
befehl=befehl_getauto;
|
||||
sende_befehl();
|
||||
|
@ -55,12 +60,12 @@ void MainWindow::holen_status(){
|
|||
befehl=befehl_file;
|
||||
sende_befehl();
|
||||
ui->lineEdit_titel->setText((status.split("<br>")[0]));
|
||||
status_loop="nein";
|
||||
}
|
||||
|
||||
bool MainWindow::sende_befehl(){
|
||||
ausgabe=url + befehl;
|
||||
|
||||
manager = new QNetworkAccessManager(this);
|
||||
QNetworkRequest request(ausgabe);
|
||||
QNetworkReply *reply = manager->get(request);
|
||||
QEventLoop event_loop;
|
||||
|
@ -80,6 +85,8 @@ bool MainWindow::sende_befehl(){
|
|||
}
|
||||
|
||||
void MainWindow::on_pushButton_pause_clicked(){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
if(status_player1=="play"){
|
||||
befehl=befehl_pause1;
|
||||
sende_befehl();
|
||||
|
@ -91,6 +98,8 @@ void MainWindow::on_pushButton_pause_clicked(){
|
|||
}
|
||||
|
||||
void MainWindow::on_pushButton_play_clicked(){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
if(!(status_player1=="play") || !(status_player2=="play")){
|
||||
if(status_player1=="aus" || status_player1=="pause"){
|
||||
befehl=befehl_play1;
|
||||
|
@ -103,6 +112,8 @@ void MainWindow::on_pushButton_play_clicked(){
|
|||
}
|
||||
|
||||
void MainWindow::on_pushButton_fade_clicked(){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
if(status_player1=="play" || status_player2=="play"){
|
||||
befehl=befehl_fade;
|
||||
sende_befehl();
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QPalette>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
|
@ -33,12 +31,14 @@ private:
|
|||
|
||||
bool sende_befehl();
|
||||
|
||||
QTimer *timer;
|
||||
QNetworkAccessManager *manager;
|
||||
|
||||
QString ip="192.168.100.7";
|
||||
QString port="80";
|
||||
QString url="http://" + ip + ":" + port + "/";
|
||||
QString ausgabe;
|
||||
QString status_loop;
|
||||
QString status;
|
||||
QString status_player1;
|
||||
QString status_player2;
|
||||
|
|
Loading…
Add table
Reference in a new issue