Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
f0242a7ad4 | |||
d2b70a89d0 | |||
680d78e173 | |||
42d8cb6d1a |
7 changed files with 188 additions and 111 deletions
BIN
BPM-Studio-Net-Client-16x16.ico
Normal file
BIN
BPM-Studio-Net-Client-16x16.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
BIN
BPM-Studio-Net-Client-32x32.ico
Normal file
BIN
BPM-Studio-Net-Client-32x32.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
|
@ -22,3 +22,8 @@ FORMS += \
|
|||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
RESOURCES += \
|
||||
BPM-Studio-Net-Client.qrc
|
||||
|
||||
RC_ICONS = BPM-Studio-Net-Client-32x32.ico
|
||||
|
|
6
BPM-Studio-Net-Client.qrc
Normal file
6
BPM-Studio-Net-Client.qrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>BPM-Studio-Net-Client-16x16.ico</file>
|
||||
<file>BPM-Studio-Net-Client-32x32.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
125
mainwindow.cpp
125
mainwindow.cpp
|
@ -6,67 +6,124 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
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()
|
||||
{
|
||||
delete timer;
|
||||
delete manager;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::textBrowser_ausgabe(QString befehl){
|
||||
ausgabe=url + befehl + "\n";
|
||||
ui->textBrowser_ausgabe->clear();
|
||||
ui->textBrowser_ausgabe->insertPlainText(ausgabe);
|
||||
void MainWindow::holen_status(){
|
||||
status_loop="ja";
|
||||
//Autoplay
|
||||
befehl=befehl_getauto;
|
||||
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";
|
||||
}
|
||||
|
||||
void MainWindow::sende_befehl(QString befehl){
|
||||
bool MainWindow::sende_befehl(){
|
||||
ausgabe=url + befehl;
|
||||
|
||||
manager = new QNetworkAccessManager(this);
|
||||
QNetworkRequest request(ausgabe);
|
||||
QNetworkReply *reply = manager->get(request);
|
||||
QEventLoop event_loop;
|
||||
QObject::connect(reply, SIGNAL(finished()), &event_loop, SLOT(quit()));
|
||||
event_loop.exec();
|
||||
|
||||
connect(reply, &QNetworkReply::finished, [=]() {
|
||||
if(reply->error() == QNetworkReply::NoError){
|
||||
QByteArray response = reply->readAll();
|
||||
ui->textBrowser_ausgabe->insertPlainText(response+"\n");
|
||||
ui->statusbar->showMessage("Ok.");
|
||||
status = response;
|
||||
return 1;
|
||||
}else{ // handle error
|
||||
ui->textBrowser_ausgabe->insertPlainText(reply->errorString()+"\n");
|
||||
ui->statusbar->showMessage("Fehler.");
|
||||
ui->statusbar->showMessage(reply->errorString());
|
||||
status = reply->errorString();
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_pause_clicked(){
|
||||
befehl=pause1;
|
||||
textBrowser_ausgabe(befehl);
|
||||
sende_befehl(befehl);
|
||||
|
||||
befehl=pause2;
|
||||
textBrowser_ausgabe(befehl);
|
||||
sende_befehl(befehl);
|
||||
if(status_auto=="an"){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
if(status_player1=="play"){
|
||||
befehl=befehl_pause1;
|
||||
sende_befehl();
|
||||
}else if(status_player2=="play"){
|
||||
befehl=befehl_pause2;
|
||||
sende_befehl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_play_clicked(){
|
||||
befehl=play1;
|
||||
textBrowser_ausgabe(befehl);
|
||||
sende_befehl(befehl);
|
||||
|
||||
befehl=pause2;
|
||||
textBrowser_ausgabe(befehl);
|
||||
sende_befehl(befehl);
|
||||
if(status_auto=="an"){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
if(!(status_player1=="play") || !(status_player2=="play")){
|
||||
if(status_player1=="pause"){
|
||||
befehl=befehl_play1;
|
||||
sende_befehl();
|
||||
}else if(status_player2=="pause"){
|
||||
befehl=befehl_play2;
|
||||
sende_befehl();
|
||||
}else{
|
||||
befehl=befehl_play1;
|
||||
sende_befehl();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_fade_clicked(){
|
||||
befehl=fade;
|
||||
textBrowser_ausgabe(befehl);
|
||||
sende_befehl(befehl);
|
||||
if(status_auto=="an"){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
30
mainwindow.h
30
mainwindow.h
|
@ -6,7 +6,7 @@
|
|||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QPalette>
|
||||
#include <QTimer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
|
@ -23,28 +23,36 @@ public:
|
|||
private slots:
|
||||
void on_pushButton_pause_clicked();
|
||||
void on_pushButton_play_clicked();
|
||||
|
||||
void on_pushButton_fade_clicked();
|
||||
|
||||
void on_textBrowser_ausgabe_selectionChanged();
|
||||
void holen_status();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
void textBrowser_ausgabe(QString);
|
||||
void sende_befehl(QString);
|
||||
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;
|
||||
QString status_auto;
|
||||
QString befehl;
|
||||
QString pause1="PAUSE1";
|
||||
QString pause2="PAUSE2";
|
||||
QString play1="PLAY1";
|
||||
QString fade="FADENOW";
|
||||
QString getfile="LIST_GETFILE";
|
||||
QString befehl_getauto="getauto";
|
||||
QString befehl_setauto="setauto1";
|
||||
QString befehl_playstate1="getplaystate1";
|
||||
QString befehl_playstate2="getplaystate2";
|
||||
QString befehl_pause1="pause1";
|
||||
QString befehl_pause2="pause2";
|
||||
QString befehl_play1="play1";
|
||||
QString befehl_play2="play2";
|
||||
QString befehl_fade="fadenow";
|
||||
QString befehl_file="list_getfile";
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -7,32 +7,19 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>302</width>
|
||||
<height>157</height>
|
||||
<height>115</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>BPM-Studio-Net-Client</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(119, 119, 119);</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QTextBrowser" name="textBrowser_ausgabe">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>281</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_pause">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 0, 0);</string>
|
||||
</property>
|
||||
|
@ -40,15 +27,9 @@
|
|||
<string>Pause</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_play">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>10</y>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(0, 255, 0);</string>
|
||||
</property>
|
||||
|
@ -56,15 +37,9 @@
|
|||
<string>Play</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_fade">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>10</y>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 0);</string>
|
||||
</property>
|
||||
|
@ -72,6 +47,32 @@
|
|||
<string>Fade</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_player1">
|
||||
<property name="text">
|
||||
<string>Player 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_auto">
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="checkBox_player2">
|
||||
<property name="text">
|
||||
<string>Player 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEdit_titel"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
|
|
Loading…
Add table
Reference in a new issue