Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
willigarneau committed May 13, 2018
0 parents commit db02d50
Show file tree
Hide file tree
Showing 11 changed files with 802 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build-TheStreamer-client-Desktop_Qt_5_11_0_GCC_64bit-Debug
22 changes: 22 additions & 0 deletions Client/TheStreamer-client.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-04-22T14:25:25
#
#-------------------------------------------------

QT += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = TheStreamer-client
TEMPLATE = app


SOURCES += main.cpp\
streamerclient.cpp \
streamerthread.cpp

HEADERS += streamerclient.h \
streamerthread.h

FORMS += streamerclient.ui
336 changes: 336 additions & 0 deletions Client/TheStreamer-client.pro.user

Large diffs are not rendered by default.

276 changes: 276 additions & 0 deletions Client/TheStreamer-client.pro.user.a607fbd

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Client/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "streamerclient.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
TheStreamerClient w;
w.show();

return a.exec();
}
46 changes: 46 additions & 0 deletions Client/streamerclient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "streamerclient.h"
#include "ui_streamerclient.h"
#include "streamerthread.h"

#include <QTime>

TheStreamerClient::TheStreamerClient(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TheStreamerClient)
{
ui->setupUi(this);

StreamerThread *thread = new StreamerThread(this);
connect(thread, SIGNAL(signalNouvelleImage(QByteArray)), this, SLOT(slotNouvelleImage(QByteArray)));
connect(this, SIGNAL(signalQuit()), thread, SLOT(slotQuit()));
thread->start();
}

TheStreamerClient::~TheStreamerClient()
{
emit(signalQuit());

QTime dieTime = QTime::currentTime().addMSecs( 100 );
while( QTime::currentTime() < dieTime )
{
QCoreApplication::processEvents( QEventLoop::AllEvents, 100 );
}

delete ui;
}

void TheStreamerClient::slotNouvelleImage(QByteArray baImage)
{
QPixmap pixImage;
QImage image;

if (!pixImage.loadFromData(baImage, "JPG"))
return;
image = pixImage.toImage();
if (image.pixel(image.width() - 1, image.height() - 1 ) == 4286611584 &&
image.pixel(image.width() / 2, image.height() - 1) == 4286611584 &&
image.pixel(0, image.height() - 1) == 4286611584)
return;

ui->lblImage->setPixmap(pixImage);
}
28 changes: 28 additions & 0 deletions Client/streamerclient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef STREAMERCLIENT_H
#define STREAMERCLIENT_H

#include <QMainWindow>

namespace Ui {
class TheStreamerClient;
}

class TheStreamerClient : public QMainWindow
{
Q_OBJECT

public:
explicit TheStreamerClient(QWidget *parent = 0);
~TheStreamerClient();

private:
Ui::TheStreamerClient *ui;

private slots:
void slotNouvelleImage(QByteArray baImage); // Slot appelé lors de la réception d'une nouvelle image.

signals:
void signalQuit(); // Signal émis lors de la fermeture de l'application.
};

#endif // STREAMERCLIENT_H
38 changes: 38 additions & 0 deletions Client/streamerclient.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TheStreamerClient</class>
<widget class="QMainWindow" name="TheStreamerClient">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1290</width>
<height>729</height>
</rect>
</property>
<property name="windowTitle">
<string>TheStreamer-client</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QLabel" name="lblImage">
<property name="geometry">
<rect>
<x>5</x>
<y>4</y>
<width>1280</width>
<height>720</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: black</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
15 changes: 15 additions & 0 deletions Client/streamerthread.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "streamerthread.h"

StreamerThread::StreamerThread(QObject *parent)
{
m_quit = 0;
}

void StreamerThread::run()
{
}

void StreamerThread::slotQuit()
{
m_quit = 1;
}
28 changes: 28 additions & 0 deletions Client/streamerthread.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef STREAMERTHREAD_H
#define STREAMERTHREAD_H

#include <QObject>
#include <QThread>
#include <QTcpSocket>

class StreamerThread : public QThread
{
Q_OBJECT

public:
StreamerThread(QObject *parent);
void run();

private:
QByteArray m_baImage; // Variable contenant l'image reçue.
bool m_quit; // Variable permettant de savoir que l'application est en cours de fermeture.

private slots:
void slotQuit(); // Slot appelé lors de la fermeture de l'application.

signals:
void signalNouvelleImage(QByteArray baImage); // Signal émis lors de la réception d'une nouvelle image.

};

#endif // STREAMERTHREAD_H
1 change: 1 addition & 0 deletions Server
Submodule Server added at 88ba85

0 comments on commit db02d50

Please sign in to comment.