Skip to content

Commit 4912ca1

Browse files
committed
Fix some includes
1 parent b1d475e commit 4912ca1

File tree

14 files changed

+30
-31
lines changed

14 files changed

+30
-31
lines changed

src/hyperion-aml/hyperion-aml.cpp

+8-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
// QT includes
33
#include <QCoreApplication>
4+
#include <QTimer>
45
#include <QImage>
56

67
#include <utils/DefaultSignalHandler.h>
@@ -130,36 +131,26 @@ int main(int argc, char ** argv)
130131
}
131132
else
132133
{
133-
QString host;
134-
QString const serviceName {QHostInfo::localHostName()};
134+
QString hostname;
135135
int port{ FLATBUFFER_DEFAULT_PORT };
136136

137137
// Split hostname and port (or use default port)
138138
QString const givenAddress = argAddress.value(parser);
139-
if (!NetUtils::resolveHostPort(givenAddress, host, port))
139+
if (!NetUtils::resolveHostPort(givenAddress, hostname, port))
140140
{
141141
emit errorManager.errorOccurred(QString("Wrong address: unable to parse address (%1)").arg(givenAddress));
142142
}
143143

144144
// Search available Hyperion services via mDNS, if default/localhost IP is given
145-
if (host == "127.0.0.1" || host == "::1")
145+
QHostAddress hostAddress;
146+
if (!NetUtils::resolveHostToAddress(log, hostname, hostAddress, port))
146147
{
147-
#ifndef ENABLE_MDNS
148-
SSDPDiscover discover;
149-
host = discover.getFirstService(searchType::STY_FLATBUFSERVER);
150-
#endif
151-
QHostAddress address;
152-
if (!NetUtils::resolveHostToAddress(log, host, address, port))
153-
{
154-
emit errorManager.errorOccurred(QString("Address could not be resolved for hostname: %2").arg(QSTRING_CSTR(host)));
148+
emit errorManager.errorOccurred(QString("Address could not be resolved for hostname: %2").arg(QSTRING_CSTR(hostAddress.toString())));
155149
}
156-
host = address.toString();
157-
}
158-
159-
Info(log, "Connecting to Hyperion host: %s, port: %u using service: %s", QSTRING_CSTR(host), port, QSTRING_CSTR(serviceName));
150+
Info(log, "Connecting to Hyperion host: %s, port: %u", QSTRING_CSTR(hostAddress.toString()), port);
160151

161152
// Create the Flabuf-connection
162-
FlatBufferConnection const flatbuf(CAPTURE_TYPE + " Standalone", host, argPriority.getInt(parser), parser.isSet(argSkipReply), port);
153+
FlatBufferConnection const flatbuf(CAPTURE_TYPE + " Standalone", hostAddress, argPriority.getInt(parser), parser.isSet(argSkipReply), port);
163154

164155
// Connect the screen capturing to flatbuf connection processing
165156
QObject::connect(&grabber, &AmlogicWrapper::sig_screenshot,

src/hyperion-dispmanx/hyperion-dispmanx.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
// QT includes
33
#include <QCoreApplication>
4+
#include <QTimer>
45
#include <QImage>
56

67
#include <utils/DefaultSignalHandler.h>

src/hyperion-framebuffer/hyperion-framebuffer.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// QT includes
22
#include <QCoreApplication>
3+
#include <QTimer>
34
#include <QImage>
45

56
#include <utils/DefaultSignalHandler.h>

src/hyperion-osx/OsxWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Image<ColorRgb> & OsxWrapper::getScreenshot()
2828
return _screenshot;
2929
}
3030

31-
bool OsxWrapper::displayInit()
31+
bool OsxWrapper::screenInit()
3232
{
3333
return _grabber.setupDisplay();
3434
}

src/hyperion-osx/hyperion-osx.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// QT includes
44
#include <QCoreApplication>
5+
#include <QTimer>
56
#include <QImage>
67

78
#include <utils/DefaultSignalHandler.h>

src/hyperion-qt/QtWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void QtWrapper::stop()
3737
_timer.stop();
3838
}
3939

40-
bool QtWrapper::displayInit()
40+
bool QtWrapper::screenInit()
4141
{
4242
return _grabber.setupDisplay();
4343
}

src/hyperion-qt/QtWrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class QtWrapper : public QObject
2929

3030
void stop();
3131

32-
bool displayInit();
32+
bool screenInit();
3333

3434
signals:
3535
void sig_screenshot(const Image<ColorRgb> & screenshot);

src/hyperion-qt/hyperion-qt.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// QT includes
22
#include <QCoreApplication>
3+
#include <QTimer>
34
#include <QImage>
45

56
#include <utils/DefaultSignalHandler.h>
@@ -108,7 +109,7 @@ int main(int argc, char ** argv)
108109
argCropBottom.getInt(parser)
109110
);
110111

111-
if (!grabber.displayInit())
112+
if (!grabber.screenInit())
112113
{
113114
emit errorManager.errorOccurred("Failed to initialise the screen/display for this grabber");
114115
}

src/hyperion-remote/JsonConnection.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
#include <QColor>
55
#include <QImage>
66
#include <QTcpSocket>
7+
#include <QHostAddress>
78
#include <QJsonObject>
89
#include <QScopedPointer>
9-
#include <qjsonarray.h>
10+
#include <QJsonArray>
1011

1112
//forward class decl
1213
class Logger;

src/hyperion-remote/hyperion-remote.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// Qt includes
88
#include <QCoreApplication>
99
#include <QLocale>
10+
#include <QTimer>
1011

1112
#include <utils/DefaultSignalHandler.h>
1213
#include <utils/ErrorManager.h>

src/hyperion-v4l2/hyperion-v4l2.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// STL includes
22
#include <csignal>
3-
#include <iomanip>
43
#include <clocale>
54

65
// QT includes
76
#include <QCoreApplication>
7+
#include <QTimer>
88

99
#include <utils/DefaultSignalHandler.h>
1010
#include <utils/ErrorManager.h>
@@ -148,6 +148,10 @@ int main(int argc, char** argv)
148148

149149
// initialize the grabber
150150
V4L2Grabber grabber;
151+
if (!grabber.prepare())
152+
{
153+
emit errorManager.errorOccurred("Failed to initialise this grabber");
154+
}
151155

152156
// set device
153157
grabber.setDevice(argDevice.value(parser), "");
@@ -244,8 +248,7 @@ int main(int argc, char** argv)
244248

245249
QString const fileName = "screenshot.png";
246250
ScreenshotHandler handler(fileName, signalDetectionOffset);
247-
QObject::connect(&grabber, SIGNAL(newFrame(Image<ColorRgb>)), &handler, SLOT(receiveImage(Image<ColorRgb>)));
248-
grabber.prepare();
251+
QObject::connect(&grabber, &V4L2Grabber::newFrame, &handler, &ScreenshotHandler::receiveImage);
249252
grabber.start();
250253
QCoreApplication::exec();
251254
grabber.stop();
@@ -278,8 +281,6 @@ int main(int argc, char** argv)
278281
static_cast<void (FlatBufferConnection::*)(const Image<ColorRgb>&)>(&FlatBufferConnection::setImage));
279282

280283
// Start the capturing
281-
if (grabber.prepare())
282-
{
283284
QObject::connect(&flatbuf, &FlatBufferConnection::isReadyToSend, [&]() {
284285
Debug(log,"Start grabber");
285286
grabber.start();
@@ -297,7 +298,6 @@ int main(int argc, char** argv)
297298
});
298299
// Start the application
299300
app.exec();
300-
}
301301
}
302302

303303
Logger::deleteInstance();

src/hyperion-x11/X11Wrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void X11Wrapper::stop()
3636
_timer.stop();
3737
}
3838

39-
bool X11Wrapper::displayInit()
39+
bool X11Wrapper::screenInit()
4040
{
4141
return _grabber.setupDisplay();
4242
}

src/hyperion-x11/hyperion-x11.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
// QT includes
3-
#include <QApplication>
3+
#include <QCoreApplication>
4+
#include <QTimer>
45
#include <QImage>
56

67
#include <utils/DefaultSignalHandler.h>

src/hyperion-xcb/hyperion-xcb.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// QT includes
2-
#include <QApplication>
2+
#include <QCoreApplication>
3+
#include <QTimer>
34
#include <QImage>
45

56
#include <utils/DefaultSignalHandler.h>

0 commit comments

Comments
 (0)