Compare commits

..

No commits in common. "0.13" and "0.11" have entirely different histories.
0.13 ... 0.11

4 changed files with 39 additions and 60 deletions

View file

@ -6,6 +6,7 @@
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include <curl/curl.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <stdio.h> #include <stdio.h>
@ -18,7 +19,6 @@
#include <QStringList> #include <QStringList>
#include <QTextStream> #include <QTextStream>
#include <QMessageBox> #include <QMessageBox>
#include <QtNetwork>
player_gui::player_gui(QWidget *parent) : player_gui::player_gui(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
@ -100,34 +100,27 @@ size_t player_gui::write_data(void *ptr, size_t size, size_t nmemb, void *stream
return written; return written;
} }
int player_gui::sender_holen(void){ int player_gui::sender_holen(void){
CURL *curl;
manager = new QNetworkAccessManager(); FILE *file;
CURLcode res;
QString url = "http://" + ip + "/channels.m3u"; curl_global_init(CURL_GLOBAL_ALL);
QNetworkRequest request(url); curl = curl_easy_init();
QNetworkReply *reply = manager->get(request); if(curl){
QString url = "http://" + ip + "/channels.m3u";
connect(reply, &QNetworkReply::finished, [=]() { std::string urls = url.toStdString();
if(reply->error() == QNetworkReply::NoError) const char *cstr = urls.c_str();
{ curl_easy_setopt(curl, CURLOPT_URL, cstr);
QByteArray response = reply->readAll(); file = fopen("channels.m3u", "wb");
std::string Daten = response.toStdString(); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, this->write_data);
std::cout << Daten << std::endl; curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
// do something with the data... res = curl_easy_perform(curl);
FILE *file = fopen("channels.m3u", "wb"); if(res != CURLE_OK)
if (file!=NULL) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
{ else
std::fputs(response,file); std::cout << "Sender holen und in channels.m3u speichern..." << std::endl;
} curl_easy_cleanup(curl);
fclose(file); }
} fclose(file);
else // handle error
{
ui->statusbar->showMessage(reply->errorString().toUtf8().constData());
std::cout << reply->errorString().toUtf8().constData() << std::endl;
}
});
return 0; return 0;
} }
int player_gui::sender_laden(void){ int player_gui::sender_laden(void){
@ -170,13 +163,13 @@ void player_gui::on_lineEdit_textChanged(const QString &arg1){
std::cout << "suchen" << std::endl; std::cout << "suchen" << std::endl;
ui->listWidget->clear(); ui->listWidget->clear();
for(int x=1;x<=this->Sender;x++){ for(int x=1;x<=this->Sender;x++){
this->Name_tmp = this->Name[x].toLower(); if(this->Name[x].contains(arg1)){
if(this->Name_tmp.contains(arg1.toLower())){
ui->listWidget->addItem(this->Name[x]); ui->listWidget->addItem(this->Name[x]);
} }
} }
} }
void player_gui::on_listWidget_itemClicked(QListWidgetItem *item){ void player_gui::on_listWidget_itemClicked(QListWidgetItem *item)
{
std::cout << item->text().toStdString() << std::endl; std::cout << item->text().toStdString() << std::endl;
this->play(item); this->play(item);
} }

View file

@ -6,7 +6,6 @@
#include <QFile> #include <QFile>
#include <QFrame> #include <QFrame>
#include <QListWidget> #include <QListWidget>
#include <QtNetwork>
#include <vlc/vlc.h> #include <vlc/vlc.h>
namespace Ui { namespace Ui {
@ -37,10 +36,8 @@ private:
int sender_ausgeben(void); int sender_ausgeben(void);
int Sender; int Sender;
QString Name[10000]; QString Name[10000];
QString Name_tmp;
QString URL[10000]; QString URL[10000];
QString ip; QString ip;
QNetworkAccessManager *manager;
QFrame *videoWidget; QFrame *videoWidget;
libvlc_instance_t * inst; libvlc_instance_t * inst;
libvlc_media_player_t *mp=0; libvlc_media_player_t *mp=0;

View file

@ -80,8 +80,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1160</width> <width>1210</width>
<height>20</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuProgramm"> <widget class="QMenu" name="menuProgramm">

View file

@ -1,30 +1,19 @@
QT += \
core \
gui \
widgets \
network
QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer QT += core gui
QMAKE_LFLAGS += -static -static-libgcc greaterThan(QT_MAJOR_VERSION, 4) : QT += widgets
CONFIG += \ SOURCES += \
c++11 \ main.cpp \
static player_gui.cpp
DEFINES += \ LIBS += -lcurl -lvlc
VLC_STATICLIB \ DEFINES += CURL_STATICLIB VLC_STATICLIB
QT_STATIC_BUILD
LIBS += \ HEADERS += \
-lvlc.dll player_gui.h
SOURCES += \ #CONFIG+= static
main.cpp \
player_gui.cpp
HEADERS += \ FORMS += \
player_gui.h player_gui.ui
FORMS += \
player_gui.ui