0.5
This commit is contained in:
parent
32836f0750
commit
d208da3b56
3 changed files with 40 additions and 25 deletions
30
main.cpp
30
main.cpp
|
@ -1,4 +1,11 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
|
@ -7,6 +14,29 @@
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
QWidget window;
|
||||||
|
window.resize(150,576);
|
||||||
|
|
||||||
Player player;
|
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();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
23
player.cpp
23
player.cpp
|
@ -8,14 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFrame>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
|
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
|
@ -24,16 +17,7 @@ Player::Player(){
|
||||||
|
|
||||||
this->sender_holen();
|
this->sender_holen();
|
||||||
this->sender_laden();
|
this->sender_laden();
|
||||||
this->sender_ausgeben();
|
//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->play();
|
//this->play();
|
||||||
//this->play();
|
//this->play();
|
||||||
|
@ -70,7 +54,7 @@ int Player::sender_holen(void){
|
||||||
}
|
}
|
||||||
int Player::sender_laden(void){
|
int Player::sender_laden(void){
|
||||||
int x=0;
|
int x=0;
|
||||||
this->Sender=0;
|
this->Sender=1;
|
||||||
QFile file("channels.m3u");
|
QFile file("channels.m3u");
|
||||||
if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||||
while (!file.atEnd()){
|
while (!file.atEnd()){
|
||||||
|
@ -90,6 +74,7 @@ int Player::sender_laden(void){
|
||||||
this->URL[this->Sender++]=string;
|
this->URL[this->Sender++]=string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Sender--; //Senderkorrektur
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Fehler channels.m3u" << std::endl;
|
std::cout << "Fehler channels.m3u" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -97,7 +82,7 @@ int Player::sender_laden(void){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int Player::sender_ausgeben(void){
|
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;
|
std::cout << x << ". " << this->Name[x].toStdString() << "," << this->URL[x].toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
12
player.h
12
player.h
|
@ -1,26 +1,26 @@
|
||||||
#ifndef PLAYER_H
|
#ifndef PLAYER_H
|
||||||
#define PLAYER_H
|
#define PLAYER_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
class Player{
|
class Player{
|
||||||
public:
|
public:
|
||||||
Player();
|
Player();
|
||||||
~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:
|
private:
|
||||||
static write_data(void*, size_t, size_t , void*);
|
static write_data(void*, size_t, size_t , void*);
|
||||||
int sender_holen(void);
|
int sender_holen(void);
|
||||||
int sender_laden(void);
|
int sender_laden(void);
|
||||||
|
int sender_ausgeben(void);
|
||||||
int Sender;
|
int Sender;
|
||||||
QString Name[10000];
|
QString Name[10000];
|
||||||
QString URL[10000];
|
QString URL[10000];
|
||||||
int sender_ausgeben(void);
|
|
||||||
int play(void);
|
|
||||||
QFrame *videoWidget;
|
QFrame *videoWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue