-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit db02d50
Showing
11 changed files
with
802 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build-TheStreamer-client-Desktop_Qt_5_11_0_GCC_64bit-Debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Submodule Server
added at
88ba85