This commit is contained in:
Thomas resiX 2025-02-15 07:33:46 +01:00
parent 32836f0750
commit d208da3b56
3 changed files with 40 additions and 25 deletions

View file

@ -1,4 +1,11 @@
#include <iostream>
#include <QApplication>
#include <QWidget>
#include <QFrame>
#include <QListWidget>
#include <QHBoxLayout>
#include <QFile>
#include "player.h"
@ -7,6 +14,29 @@
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
QWidget window;
window.resize(150,576);
Player player;
QListWidget liste(new QListWidget);
for(int x=1;x<=player.get_Sender();x++){
liste.addItem(player.get_Name(x));
}
QObject::connect(&liste, SIGNAL(itemDoubleClicked(QListWidgetItem*)), &app, SLOT(quit()));
QHBoxLayout layout(&window);
layout.addWidget(&liste);
window.show();
int x = player.get_Sender();
QString name = player.get_Name(1);
QString url = player.get_URL(1);
std::cout << x << std::endl << name.toStdString() << " " << url.toStdString() << std::endl;
//player->play();
return app.exec();
}

View file

@ -8,14 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <QMainWindow>
#include <QFile>
#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include <QListWidget>
#include <QHBoxLayout>
#include "player.h"
@ -24,16 +17,7 @@ Player::Player(){
this->sender_holen();
this->sender_laden();
this->sender_ausgeben();
QWidget *window = new QWidget;
QListWidget *list = new QListWidget();
for(int x=0;x<this->Sender;x++){
list->addItem(this->Name[x]);
}
QHBoxLayout *layout = new QHBoxLayout(window);
layout->addWidget(list);
window->show();
//this->sender_ausgeben();
//this->play();
//this->play();
@ -70,7 +54,7 @@ int Player::sender_holen(void){
}
int Player::sender_laden(void){
int x=0;
this->Sender=0;
this->Sender=1;
QFile file("channels.m3u");
if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
while (!file.atEnd()){
@ -90,6 +74,7 @@ int Player::sender_laden(void){
this->URL[this->Sender++]=string;
}
}
Sender--; //Senderkorrektur
} else {
std::cout << "Fehler channels.m3u" << std::endl;
return 1;
@ -97,7 +82,7 @@ int Player::sender_laden(void){
return 0;
}
int Player::sender_ausgeben(void){
for(int x=0;x<this->Sender;x++){
for(int x=1;x<=this->Sender;x++){
std::cout << x << ". " << this->Name[x].toStdString() << "," << this->URL[x].toStdString() << std::endl;
}
return 0;

View file

@ -1,26 +1,26 @@
#ifndef PLAYER_H
#define PLAYER_H
#include <QMainWindow>
#include <QFile>
#include <QFrame>
#include <QLabel>
#include <QPushButton>
class Player{
public:
Player();
~Player();
int play(void);
int get_Sender() { return this->Sender; }
QString get_Name(int x) { return this->Name[x]; }
QString get_URL(int x) { return this->URL[x]; }
private:
static write_data(void*, size_t, size_t , void*);
int sender_holen(void);
int sender_laden(void);
int sender_ausgeben(void);
int Sender;
QString Name[10000];
QString URL[10000];
int sender_ausgeben(void);
int play(void);
QString URL[10000];
QFrame *videoWidget;
};