Compare commits

..

No commits in common. "0.5" and "0.1" have entirely different histories.
0.5 ... 0.1

7 changed files with 111 additions and 188 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View file

@ -22,8 +22,3 @@ FORMS += \
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
RESOURCES += \
BPM-Studio-Net-Client.qrc
RC_ICONS = BPM-Studio-Net-Client-32x32.ico

View file

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/">
<file>BPM-Studio-Net-Client-16x16.ico</file>
<file>BPM-Studio-Net-Client-32x32.ico</file>
</qresource>
</RCC>

View file

@ -6,124 +6,67 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
timer = new QTimer(this);
timer->setInterval(5000);
connect(timer,&QTimer::timeout,this,&MainWindow::holen_status);
timer->start();
manager = new QNetworkAccessManager();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete timer;
delete manager;
delete ui; delete ui;
} }
void MainWindow::holen_status(){ void MainWindow::textBrowser_ausgabe(QString befehl){
status_loop="ja"; ausgabe=url + befehl + "\n";
//Autoplay ui->textBrowser_ausgabe->clear();
befehl=befehl_getauto; ui->textBrowser_ausgabe->insertPlainText(ausgabe);
sende_befehl();
if(status=="0"){
status_auto="aus";
}else{
status_auto="an";
}
//Player1
befehl=befehl_playstate1;
sende_befehl();
if(status=="0"){
status_player1="aus";
}else if(status=="1"){
status_player1="play";
}else if(status=="2"){
status_player1="pause";
}
//Player2
befehl=befehl_playstate2;
sende_befehl();
if(status=="0"){
status_player2="aus";
}else if(status=="1"){
status_player2="play";
}else if(status=="2"){
status_player2="pause";
}
//Anzeige
if(status_player1=="play") ui->checkBox_player1->setChecked(1); else ui->checkBox_player1->setChecked(0);
if(status_auto=="an") ui->checkBox_auto->setChecked(1); else ui->checkBox_auto->setChecked(0);
if(status_player2=="play") ui->checkBox_player2->setChecked(1); else ui->checkBox_player2->setChecked(0);
//Playlist
befehl=befehl_file;
sende_befehl();
ui->lineEdit_titel->setText((status.split("<br>")[0]));
status_loop="nein";
} }
bool MainWindow::sende_befehl(){ void MainWindow::sende_befehl(QString befehl){
ausgabe=url + befehl; ausgabe=url + befehl;
manager = new QNetworkAccessManager(this);
QNetworkRequest request(ausgabe); QNetworkRequest request(ausgabe);
QNetworkReply *reply = manager->get(request); QNetworkReply *reply = manager->get(request);
QEventLoop event_loop;
QObject::connect(reply, SIGNAL(finished()), &event_loop, SLOT(quit()));
event_loop.exec();
if(reply->error() == QNetworkReply::NoError){ connect(reply, &QNetworkReply::finished, [=]() {
QByteArray response = reply->readAll(); if(reply->error() == QNetworkReply::NoError){
ui->statusbar->showMessage("Ok."); QByteArray response = reply->readAll();
status = response; ui->textBrowser_ausgabe->insertPlainText(response+"\n");
return 1; ui->statusbar->showMessage("Ok.");
}else{ // handle error }else{ // handle error
ui->statusbar->showMessage(reply->errorString()); ui->textBrowser_ausgabe->insertPlainText(reply->errorString()+"\n");
status = reply->errorString(); ui->statusbar->showMessage("Fehler.");
return 0; }
} });
} }
void MainWindow::on_pushButton_pause_clicked(){ void MainWindow::on_pushButton_pause_clicked(){
if(status_auto=="an"){ befehl=pause1;
while(status_loop=="ja") textBrowser_ausgabe(befehl);
ui->statusbar->showMessage("~"); sende_befehl(befehl);
if(status_player1=="play"){
befehl=befehl_pause1; befehl=pause2;
sende_befehl(); textBrowser_ausgabe(befehl);
}else if(status_player2=="play"){ sende_befehl(befehl);
befehl=befehl_pause2;
sende_befehl();
}
}
} }
void MainWindow::on_pushButton_play_clicked(){ void MainWindow::on_pushButton_play_clicked(){
if(status_auto=="an"){ befehl=play1;
while(status_loop=="ja") textBrowser_ausgabe(befehl);
ui->statusbar->showMessage("~"); sende_befehl(befehl);
if(!(status_player1=="play") || !(status_player2=="play")){
if(status_player1=="pause"){ befehl=pause2;
befehl=befehl_play1; textBrowser_ausgabe(befehl);
sende_befehl(); sende_befehl(befehl);
}else if(status_player2=="pause"){
befehl=befehl_play2;
sende_befehl();
}else{
befehl=befehl_play1;
sende_befehl();
}
}
}
} }
void MainWindow::on_pushButton_fade_clicked(){ void MainWindow::on_pushButton_fade_clicked(){
if(status_auto=="an"){ befehl=fade;
while(status_loop=="ja") textBrowser_ausgabe(befehl);
ui->statusbar->showMessage("~"); sende_befehl(befehl);
if(status_player1=="play" || status_player2=="play"){
befehl=befehl_fade;
sende_befehl();
}
}
} }
void MainWindow::on_textBrowser_ausgabe_selectionChanged(){
befehl=getfile;
textBrowser_ausgabe(befehl);
sende_befehl(befehl);
}

View file

@ -6,7 +6,7 @@
#include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkReply>
#include <QTimer> #include <QPalette>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
@ -23,36 +23,28 @@ public:
private slots: private slots:
void on_pushButton_pause_clicked(); void on_pushButton_pause_clicked();
void on_pushButton_play_clicked(); void on_pushButton_play_clicked();
void on_pushButton_fade_clicked(); void on_pushButton_fade_clicked();
void holen_status();
void on_textBrowser_ausgabe_selectionChanged();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
bool sende_befehl(); void textBrowser_ausgabe(QString);
void sende_befehl(QString);
QTimer *timer;
QNetworkAccessManager *manager; QNetworkAccessManager *manager;
QString ip="192.168.100.7"; QString ip="192.168.100.7";
QString port="80"; QString port="80";
QString url="http://" + ip + ":" + port + "/"; QString url="http://" + ip + ":" + port + "/";
QString ausgabe; QString ausgabe;
QString status_loop;
QString status;
QString status_player1;
QString status_player2;
QString status_auto;
QString befehl; QString befehl;
QString befehl_getauto="getauto"; QString pause1="PAUSE1";
QString befehl_setauto="setauto1"; QString pause2="PAUSE2";
QString befehl_playstate1="getplaystate1"; QString play1="PLAY1";
QString befehl_playstate2="getplaystate2"; QString fade="FADENOW";
QString befehl_pause1="pause1"; QString getfile="LIST_GETFILE";
QString befehl_pause2="pause2";
QString befehl_play1="play1";
QString befehl_play2="play2";
QString befehl_fade="fadenow";
QString befehl_file="list_getfile";
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -7,72 +7,71 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>302</width> <width>302</width>
<height>115</height> <height>157</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>BPM-Studio-Net-Client</string> <string>BPM-Studio-Net-Client</string>
</property> </property>
<property name="styleSheet">
<string notr="true">background-color: rgb(119, 119, 119);</string>
</property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"> <widget class="QTextBrowser" name="textBrowser_ausgabe">
<item row="0" column="0"> <property name="geometry">
<widget class="QPushButton" name="pushButton_pause"> <rect>
<property name="styleSheet"> <x>10</x>
<string notr="true">background-color: rgb(255, 0, 0);</string> <y>40</y>
</property> <width>281</width>
<property name="text"> <height>71</height>
<string>Pause</string> </rect>
</property> </property>
</widget> </widget>
</item> <widget class="QPushButton" name="pushButton_pause">
<item row="0" column="1"> <property name="geometry">
<widget class="QPushButton" name="pushButton_play"> <rect>
<property name="styleSheet"> <x>10</x>
<string notr="true">background-color: rgb(0, 255, 0);</string> <y>10</y>
</property> <width>80</width>
<property name="text"> <height>24</height>
<string>Play</string> </rect>
</property> </property>
</widget> <property name="styleSheet">
</item> <string notr="true">background-color: rgb(255, 0, 0);</string>
<item row="0" column="2"> </property>
<widget class="QPushButton" name="pushButton_fade"> <property name="text">
<property name="styleSheet"> <string>Pause</string>
<string notr="true">background-color: rgb(255, 255, 0);</string> </property>
</property> </widget>
<property name="text"> <widget class="QPushButton" name="pushButton_play">
<string>Fade</string> <property name="geometry">
</property> <rect>
</widget> <x>110</x>
</item> <y>10</y>
<item row="1" column="0"> <width>80</width>
<widget class="QCheckBox" name="checkBox_player1"> <height>24</height>
<property name="text"> </rect>
<string>Player 1</string> </property>
</property> <property name="styleSheet">
</widget> <string notr="true">background-color: rgb(0, 255, 0);</string>
</item> </property>
<item row="1" column="1"> <property name="text">
<widget class="QCheckBox" name="checkBox_auto"> <string>Play</string>
<property name="text"> </property>
<string>Auto</string> </widget>
</property> <widget class="QPushButton" name="pushButton_fade">
</widget> <property name="geometry">
</item> <rect>
<item row="1" column="2"> <x>210</x>
<widget class="QCheckBox" name="checkBox_player2"> <y>10</y>
<property name="text"> <width>80</width>
<string>Player 2</string> <height>24</height>
</property> </rect>
</widget> </property>
</item> <property name="styleSheet">
<item row="2" column="0" colspan="3"> <string notr="true">background-color: rgb(255, 255, 0);</string>
<widget class="QLineEdit" name="lineEdit_titel"/> </property>
</item> <property name="text">
</layout> <string>Fade</string>
</property>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">