From d208da3b568c990583fe47a637b40921bb401d83 Mon Sep 17 00:00:00 2001 From: Thomas resiX Date: Sat, 15 Feb 2025 07:33:46 +0100 Subject: [PATCH] 0.5 --- main.cpp | 30 ++++++++++++++++++++++++++++++ player.cpp | 23 ++++------------------- player.h | 12 ++++++------ 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/main.cpp b/main.cpp index 94f820a..8fe0746 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,11 @@ +#include + #include +#include +#include +#include +#include +#include #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(); } diff --git a/player.cpp b/player.cpp index 46be3ea..96056cd 100644 --- a/player.cpp +++ b/player.cpp @@ -8,14 +8,7 @@ #include #include -#include #include -#include -#include -#include -#include -#include - #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;xSender;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;xSender;x++){ + for(int x=1;x<=this->Sender;x++){ std::cout << x << ". " << this->Name[x].toStdString() << "," << this->URL[x].toStdString() << std::endl; } return 0; diff --git a/player.h b/player.h index 18053e3..de559fa 100644 --- a/player.h +++ b/player.h @@ -1,26 +1,26 @@ #ifndef PLAYER_H #define PLAYER_H -#include #include #include -#include -#include 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; };