Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
f0242a7ad4 | |||
d2b70a89d0 | |||
680d78e173 | |||
42d8cb6d1a | |||
6db8aa36ee |
8 changed files with 324 additions and 0 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 |
29
BPM-Studio-Net-Client.pro
Normal file
29
BPM-Studio-Net-Client.pro
Normal file
|
@ -0,0 +1,29 @@
|
|||
QT += core gui network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++17
|
||||
|
||||
# You can make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
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>
|
11
main.cpp
Normal file
11
main.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
129
mainwindow.cpp
Normal file
129
mainwindow.cpp
Normal file
|
@ -0,0 +1,129 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(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::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";
|
||||
}
|
||||
|
||||
bool MainWindow::sende_befehl(){
|
||||
ausgabe=url + befehl;
|
||||
|
||||
QNetworkRequest request(ausgabe);
|
||||
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){
|
||||
QByteArray response = reply->readAll();
|
||||
ui->statusbar->showMessage("Ok.");
|
||||
status = response;
|
||||
return 1;
|
||||
}else{ // handle error
|
||||
ui->statusbar->showMessage(reply->errorString());
|
||||
status = reply->errorString();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_pause_clicked(){
|
||||
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(){
|
||||
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(){
|
||||
if(status_auto=="an"){
|
||||
while(status_loop=="ja")
|
||||
ui->statusbar->showMessage("~");
|
||||
if(status_player1=="play" || status_player2=="play"){
|
||||
befehl=befehl_fade;
|
||||
sende_befehl();
|
||||
}
|
||||
}
|
||||
}
|
58
mainwindow.h
Normal file
58
mainwindow.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QTimer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_pause_clicked();
|
||||
void on_pushButton_play_clicked();
|
||||
void on_pushButton_fade_clicked();
|
||||
void holen_status();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
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 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
|
91
mainwindow.ui
Normal file
91
mainwindow.ui
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>302</width>
|
||||
<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">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_pause">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_play">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(0, 255, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_fade">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<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">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>302</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Add table
Reference in a new issue