From a50da395dbd4f5ce39fabdb1017fc62097888c55 Mon Sep 17 00:00:00 2001
From: ge022 <23706821+ge022@users.noreply.github.com>
Date: Wed, 28 Sep 2022 20:54:43 -0700
Subject: [PATCH 01/23] Bible & songs over http with websocket
---
biblewidget.cpp | 2 +-
generalsettingwidget.cpp | 11 ++
generalsettingwidget.ui | 223 ++++++++++++++++++++++++++-------
httpserver.cpp | 91 ++++++++++++++
httpserver.hpp | 52 ++++++++
httpserver.html | 263 +++++++++++++++++++++++++++++++++++++++
settings.cpp | 18 +++
settings.hpp | 4 +
settingsdialog.cpp | 13 ++
settingsdialog.hpp | 5 +
softProjector.pro | 13 +-
softprojector.cpp | 52 +++++++-
softprojector.hpp | 5 +
softprojector.qrc | 1 +
softprojector.ui | 2 +-
websocketserver.cpp | 131 +++++++++++++++++++
websocketserver.hpp | 74 +++++++++++
17 files changed, 911 insertions(+), 49 deletions(-)
create mode 100644 httpserver.cpp
create mode 100644 httpserver.hpp
create mode 100644 httpserver.html
create mode 100644 websocketserver.cpp
create mode 100644 websocketserver.hpp
diff --git a/biblewidget.cpp b/biblewidget.cpp
index 85e89e3..169f845 100644
--- a/biblewidget.cpp
+++ b/biblewidget.cpp
@@ -376,7 +376,7 @@ void BibleWidget::on_search_button_clicked()
if (!search_results.isEmpty()) // If have results, then show them
{
- if( not ui->result_label->isVisible() )
+ if( ! ui->result_label->isVisible() )
{
ui->lineEditBook->clear();
hidden_splitter_state = ui->results_splitter->saveState();
diff --git a/generalsettingwidget.cpp b/generalsettingwidget.cpp
index e582cb6..7f87285 100644
--- a/generalsettingwidget.cpp
+++ b/generalsettingwidget.cpp
@@ -101,6 +101,12 @@ void GeneralSettingWidget::loadSettings()
ui->comboBoxControlsAlignV->setCurrentIndex(mySettings.displayControls.alignmentV);
ui->comboBoxControlsAlignH->setCurrentIndex(mySettings.displayControls.alignmentH);
ui->horizontalSliderOpacity->setValue(mySettings.displayControls.opacity*100);
+
+ // HTTP server
+ ui->checkBoxEnableHttpServer->setChecked(mySettings.httpServerEnabled);
+ ui->spinBoxHttpPort->setValue(mySettings.httpServerPort);
+ ui->spinBoxWebSocketPort->setValue(mySettings.webSocketServerPort);
+ ui->checkBoxDisableScreens->setChecked(mySettings.disableScreens);
}
void GeneralSettingWidget::loadThemes()
@@ -139,6 +145,11 @@ GeneralSettings GeneralSettingWidget::getSettings()
r = r/100;
mySettings.displayControls.opacity = r;
+ mySettings.httpServerEnabled = ui->checkBoxEnableHttpServer->isChecked();
+ mySettings.httpServerPort = ui->spinBoxHttpPort->value();
+ mySettings.webSocketServerPort = ui->spinBoxWebSocketPort->value();
+ mySettings.disableScreens = ui->checkBoxDisableScreens->isChecked();
+
return mySettings;
}
diff --git a/generalsettingwidget.ui b/generalsettingwidget.ui
index f2d843a..c98a28a 100644
--- a/generalsettingwidget.ui
+++ b/generalsettingwidget.ui
@@ -6,8 +6,8 @@
0
0
- 412
- 440
+ 354
+ 448
@@ -59,31 +59,21 @@
Display Screen Selection
- -
-
-
- Primary Display Screen:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ Qt::Horizontal
-
- Select onto which screen to display
+
+
+ 162
+ 20
+
-
+
- -
-
+
-
+
Qt::Horizontal
@@ -95,10 +85,10 @@
- -
-
+
-
+
- Secondary Display Screen:
+ Primary Display Screen:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -118,18 +108,28 @@
- -
-
-
- Qt::Horizontal
+
-
+
+
+
+ 0
+ 0
+
-
-
- 162
- 20
-
+
+ Select onto which screen to display
-
+
+
+ -
+
+
+ Secondary Display Screen:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
-
@@ -147,6 +147,16 @@
Primary Display Screen Controls
+
-
+
+
+ NOTE: Display screen controls will be visible on the primary display screen only when one monitor is avaliable.
+
+
+ true
+
+
+
-
-
@@ -285,14 +295,143 @@
- -
-
+
+
+
+ -
+
+
+ HTTP Server
+
+
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 60
+ 0
+
+
+
+ true
+
+
+ QAbstractSpinBox::NoButtons
+
+
+ 9999
+
+
+ 8087
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777213
+ 16777215
+
+
- NOTE: Display screen controls will be visible on the primary display screen only when one monitor is avaliable.
+ HTTP Port:
-
+
+
+ -
+
+
+ Enable HTTP Server
+
+
+
+ -
+
+
+ Disable display forms for HTTP-only use (restart required).
+
+
+ Disable Screens
+
+
+
+ -
+
+
+
+ 60
+ 0
+
+
+
true
+
+ QAbstractSpinBox::NoButtons
+
+
+ 9999
+
+
+ 8089
+
+
+
+ -
+
+
+ WebSocket Port:
+
@@ -306,7 +445,7 @@
20
- 14
+ 40
diff --git a/httpserver.cpp b/httpserver.cpp
new file mode 100644
index 0000000..cbcbefb
--- /dev/null
+++ b/httpserver.cpp
@@ -0,0 +1,91 @@
+/***************************************************************************
+//
+// softProjector - an open source media projection software
+// Copyright (C) 2022 Vladislav Kobzar
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+***************************************************************************/
+
+#include "httpserver.hpp"
+
+#include
+#include
+#include
+
+HttpServer::HttpServer() { }
+
+void HttpServer::startServer(quint16 httpServerPort, quint16 webSocketServerPort)
+{
+ httpPort = httpServerPort;
+ webSocketPort = webSocketServerPort;
+ server = new QTcpServer();
+
+ // waiting for the web brower to make contact, this will emit signal
+ connect(server, SIGNAL(newConnection()), this, SLOT(startConnection()));
+
+ if(server->listen(QHostAddress::Any, httpPort)) {
+ isRunning = true;
+ qDebug() << "HTTP server listening on port: " << httpPort;
+ } else {
+ qDebug() << "HTTP server failed to start on port:" << httpPort;
+ }
+}
+
+void HttpServer::startConnection()
+{
+ QTcpSocket *socket = server->nextPendingConnection();
+ connect(socket, SIGNAL(readyRead()), this, SLOT(sendData()));
+ connect(socket, SIGNAL(disconnected()), this, SLOT(closingClient()));
+}
+
+void HttpServer::closingClient()
+{
+ QTcpSocket* socket = (QTcpSocket*)sender();
+ socket->deleteLater();
+}
+
+void HttpServer::sendData()
+{
+ QTcpSocket* socket = (QTcpSocket*)sender();
+
+ QFile file(":/httpserver.html");
+ if(!file.open(QFile::ReadOnly |
+ QFile::Text))
+ {
+ qDebug() << "Could not open httpserver.html for reading";
+ return;
+ }
+
+ QTextStream in(&file);
+ QString html = in.readAll();
+ file.close();
+
+ html.replace("${webSocketPort}", QString::number(webSocketPort));
+
+ socket->write("HTTP/1.1 200 OK\r\n"); // \r needs to be before \n
+ socket->write("Content-Type: text/html\r\n");
+ socket->write("Connection: close\r\n"); // Require two \r\n.
+ socket->write("\r\n");
+
+ socket->write(html.toUtf8());
+
+ socket->disconnectFromHost();
+}
+
+void HttpServer::stopServer()
+{
+ server->close();
+ delete server;
+ isRunning = false;
+}
diff --git a/httpserver.hpp b/httpserver.hpp
new file mode 100644
index 0000000..9c95061
--- /dev/null
+++ b/httpserver.hpp
@@ -0,0 +1,52 @@
+/***************************************************************************
+//
+// softProjector - an open source media projection software
+// Copyright (C) 2022 Vladislav Kobzar
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+***************************************************************************/
+
+#include
+
+// Simple HTTP server implementation in Qt taken from https://stackoverflow.com/a/32931195
+
+#ifndef HTTPSERVER_H
+#define HTTPSERVER_H
+
+class HttpServer : public QObject
+{
+ Q_OBJECT
+
+public:
+ HttpServer();
+ void startServer(quint16 httpServerPort, quint16 webSocketServerPort);
+ void stopServer();
+ bool isRunning;
+
+public slots:
+ void startConnection();
+ void sendData();
+ void closingClient();
+
+private:
+ QTcpServer *server = new QTcpServer();
+ quint16 httpPort;
+ quint16 webSocketPort;
+
+private slots:
+
+signals:
+};
+
+#endif
diff --git a/httpserver.html b/httpserver.html
new file mode 100644
index 0000000..209fc2b
--- /dev/null
+++ b/httpserver.html
@@ -0,0 +1,263 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/settings.cpp b/settings.cpp
index fe711a2..cd7bdba 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -800,6 +800,14 @@ void Settings::loadSettings()
}
else if (n == "dcOpacity")
general.displayControls.opacity = v.toDouble();
+ else if (n == "httpEnabled")
+ general.httpServerEnabled = (v=="true");
+ else if (n == "httpPort")
+ general.httpServerPort = v.toInt();
+ else if (n == "webSocketPort")
+ general.webSocketServerPort = v.toInt();
+ else if (n == "disableScreens")
+ general.disableScreens = (v=="true");
}
}
else if(t == "spMain")
@@ -914,6 +922,16 @@ void Settings::saveSettings()
gset += "\ndcIconSize = " + QString::number(general.displayControls.buttonSize);
gset += QString("\ndcAlignment = %1,%2").arg(general.displayControls.alignmentV).arg(general.displayControls.alignmentH);
gset += "\ndcOpacity = " + QString::number(general.displayControls.opacity);
+ if(general.httpServerEnabled)
+ gset += "\nhttpEnabled = true";
+ else
+ gset += "\nhttpEnabled = false";
+ gset += "\nhttpPort = " + QString::number(general.httpServerPort);
+ gset += "\nwebSocketPort = " + QString::number(general.webSocketServerPort);
+ if(general.disableScreens)
+ gset += "\ndisableScreens = true";
+ else
+ gset += "\ndisableScreens = false";
// **** prepare softProjector main settings
spset += "spSplitter = " + spMain.spSplitter.toHex();
diff --git a/settings.hpp b/settings.hpp
index b3d2572..e6c7801 100644
--- a/settings.hpp
+++ b/settings.hpp
@@ -286,6 +286,10 @@ class GeneralSettings
bool settingsChangedAll;
bool settingsChangedMulti;
bool settingsChangedSingle;
+ bool httpServerEnabled;
+ int webSocketServerPort;
+ int httpServerPort;
+ bool disableScreens;
};
class DisplaySettings
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index e9cb1c0..94d27c4 100644
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -72,6 +72,9 @@ void SettingsDialog::loadSettings(GeneralSettings &sets, Theme &thm, SlideShowSe
is_always_on_top = gsettings.displayIsOnTop;
current_display_screen = gsettings.displayScreen;
currentDisplayScreen2 = gsettings.displayScreen2;
+ currentHTTPEnabled = gsettings.httpServerEnabled;
+ currentHTTPPort = gsettings.httpServerPort;
+ currentWebSocketPort = gsettings.webSocketServerPort;
// Set individual items
generalSettingswidget->setSettings(gsettings);
@@ -154,6 +157,14 @@ void SettingsDialog::applySettings()
// Redraw the screen:
emit updateScreen();
+ // Update HTTP server state
+ if(currentHTTPPort != gsettings.httpServerPort
+ || currentWebSocketPort != gsettings.webSocketServerPort
+ || currentHTTPEnabled != gsettings.httpServerEnabled)
+ {
+ emit httpServerState(gsettings.httpServerEnabled,gsettings.httpServerPort,gsettings.webSocketServerPort);
+ }
+
// Save Settings
theme.saveThemeUpdate();
@@ -161,6 +172,8 @@ void SettingsDialog::applySettings()
is_always_on_top = gsettings.displayIsOnTop;
current_display_screen = gsettings.displayScreen;
currentDisplayScreen2 = gsettings.displayScreen2;
+ currentHTTPEnabled = gsettings.httpServerEnabled;
+ currentWebSocketPort = gsettings.webSocketServerPort;
}
void SettingsDialog::getThemes()
diff --git a/settingsdialog.hpp b/settingsdialog.hpp
index 82f58b0..4e347e6 100644
--- a/settingsdialog.hpp
+++ b/settingsdialog.hpp
@@ -52,6 +52,7 @@ public slots:
BibleVersionSettings& bsets, BibleVersionSettings& bsets2);
void positionsDisplayWindow();
void updateScreen();
+ void httpServerState(bool& state, int& httpServerPort, int& webSocketServerPort);
private:
Ui::SettingsDialog *ui;
@@ -60,6 +61,10 @@ public slots:
int currentDisplayScreen2;
bool is_always_on_top;
+ bool currentHTTPEnabled;
+ int currentHTTPPort;
+ int currentWebSocketPort;
+
GeneralSettings gsettings;
Theme theme;
BibleVersionSettings bsettings;
diff --git a/softProjector.pro b/softProjector.pro
index 3d2129f..4ccf696 100644
--- a/softProjector.pro
+++ b/softProjector.pro
@@ -27,7 +27,8 @@ QT += core \
quick \
printsupport \
multimedia \
- multimediawidgets
+ multimediawidgets \
+ websockets
TARGET = SoftProjector
TEMPLATE = app
@@ -88,7 +89,9 @@ SOURCES += main.cpp \
projectordisplayscreen.cpp \
imagegenerator.cpp \
spimageprovider.cpp \
- mediacontrol.cpp
+ mediacontrol.cpp \
+ httpserver.cpp \
+ websocketserver.cpp
HEADERS += softprojector.hpp \
songwidget.hpp \
biblewidget.hpp \
@@ -131,7 +134,9 @@ HEADERS += softprojector.hpp \
projectordisplayscreen.hpp \
imagegenerator.hpp \
spimageprovider.hpp \
- mediacontrol.hpp
+ mediacontrol.hpp \
+ httpserver.hpp \
+ websocketserver.hpp
FORMS += softprojector.ui \
songwidget.ui \
biblewidget.ui \
@@ -170,3 +175,5 @@ RESOURCES += softprojector.qrc
win32 {
RC_FILE = softprojector.rc
}
+
+DISTFILES +=
diff --git a/softprojector.cpp b/softprojector.cpp
index be4ef7b..367c49a 100644
--- a/softprojector.cpp
+++ b/softprojector.cpp
@@ -56,6 +56,13 @@ SoftProjector::SoftProjector(QWidget *parent)
mediaPlayer = new MediaWidget;
mediaControls = new MediaControl(this);
+ if (mySettings.general.httpServerEnabled) {
+ webSocketServer = new WebSocketServer();
+ webSocketServer->startServer(mySettings.general.webSocketServerPort);
+ httpServer = new HttpServer();
+ httpServer->startServer(mySettings.general.httpServerPort, mySettings.general.webSocketServerPort);
+ }
+
ui->setupUi(this);
// Create action group for language slections
@@ -71,7 +78,9 @@ SoftProjector::SoftProjector(QWidget *parent)
// Apply Settings
applySetting(mySettings.general, theme, mySettings.slideSets, mySettings.bibleSets, mySettings.bibleSets2);
- positionDisplayWindow();
+ if (!mySettings.general.disableScreens) {
+ positionDisplayWindow();
+ }
showing = false;
@@ -110,6 +119,7 @@ SoftProjector::SoftProjector(QWidget *parent)
BibleVersionSettings&,BibleVersionSettings&)));
connect(settingsDialog,SIGNAL(positionsDisplayWindow()),this,SLOT(positionDisplayWindow()));
connect(settingsDialog,SIGNAL(updateScreen()),this,SLOT(updateScreen()));
+ connect(settingsDialog,SIGNAL(httpServerState(bool&,int&,int&)),this,SLOT(httpServerState(bool&,int&,int&)));
connect(songWidget,SIGNAL(addToSchedule(Song&)),this,SLOT(addToShcedule(Song&)));
connect(announceWidget,SIGNAL(addToSchedule(Announcement&)),this,SLOT(addToShcedule(Announcement&)));
@@ -207,6 +217,8 @@ SoftProjector::~SoftProjector()
delete shSart2;
delete helpDialog;
delete ui;
+ delete webSocketServer;
+ delete httpServer;
}
void SoftProjector::positionDisplayWindow()
@@ -290,6 +302,9 @@ void SoftProjector::positionDisplayWindow()
void SoftProjector::showDisplayScreen(bool show)
{
+ if (mySettings.general.disableScreens)
+ return;
+
if(show)
{
pds1->showFullScreen();
@@ -390,6 +405,20 @@ void SoftProjector::applySetting(GeneralSettings &g, Theme &t, SlideShowSettings
retranslateUis();
}
+void SoftProjector::httpServerState(bool &state, int &httpServerPort, int &webSocketServerPort)
+{
+ if (httpServer->isRunning)
+ httpServer->stopServer();
+
+ if (webSocketServer->isRunning)
+ webSocketServer->stopServer();
+
+ if (state) {
+ httpServer->startServer(httpServerPort, webSocketServerPort);
+ webSocketServer->startServer(webSocketServerPort);
+ }
+}
+
void SoftProjector::closeEvent(QCloseEvent *event)
{
if(is_schedule_saved || schedule_file_path.isEmpty())
@@ -695,6 +724,11 @@ void SoftProjector::updateScreen()
ui->actionShow->setEnabled(true);
ui->actionHide->setEnabled(false);
ui->actionClear->setEnabled(false);
+
+ if (mySettings.general.httpServerEnabled)
+ {
+ webSocketServer->setBlank();
+ }
}
else if ((currentRow >=0 || pType == VIDEO) && !new_list)
{
@@ -776,6 +810,11 @@ void SoftProjector::showBible()
mySettings.bibleSets),theme.bible);
}
}
+
+ if(mySettings.general.httpServerEnabled)
+ {
+ webSocketServer->setBibleText(bibleWidget->bible.getCurrentVerseAndCaption(currentRows,theme.bible, mySettings.bibleSets));
+ }
}
void SoftProjector::showSong(int currentRow)
@@ -803,6 +842,11 @@ void SoftProjector::showSong(int currentRow)
pds2->renderSongText(current_song.getStanza(currentRow),s1);
}
}
+
+ if(mySettings.general.httpServerEnabled)
+ {
+ webSocketServer->setSongText(current_song.getStanza(currentRow));
+ }
}
void SoftProjector::showAnnounce(int currentRow)
@@ -864,11 +908,15 @@ void SoftProjector::on_actionClear_triggered()
ui->actionClear->setEnabled(false);
ui->actionShow->setEnabled(true);
// ui->actionHide->setEnabled(false);
+ if (mySettings.general.httpServerEnabled)
+ {
+ webSocketServer->setBlank();
+ }
}
void SoftProjector::on_actionCloseDisplay_triggered()
{
- if(ui->actionCloseDisplay->isChecked())
+ if(ui->actionCloseDisplay->isChecked() && !mySettings.general.disableScreens)
{
pds1->showFullScreen();
if(hasDisplayScreen2)
diff --git a/softprojector.hpp b/softprojector.hpp
index 3bcd1ee..361bfc9 100644
--- a/softprojector.hpp
+++ b/softprojector.hpp
@@ -40,6 +40,8 @@
#include "videoinfo.hpp"
#include "slideshoweditor.hpp"
#include "schedule.hpp"
+#include "httpserver.hpp"
+#include "websocketserver.hpp"
class QActionGroup;
@@ -75,6 +77,8 @@ class SoftProjector : public QMainWindow
PictureWidget *pictureWidget;
MediaWidget *mediaPlayer;
MediaControl *mediaControls;
+ WebSocketServer *webSocketServer;
+ HttpServer *httpServer;
bool showing; // whether we are currently showing to the projector
Song current_song;
@@ -93,6 +97,7 @@ public slots:
void saveSettings();
void positionDisplayWindow();
void updateScreen();
+ void httpServerState(bool &state, int &httpServerPort, int &webSocketServerPort);
void setWaitCursor();
void setArrowCursor();
diff --git a/softprojector.qrc b/softprojector.qrc
index a48f60a..f43a588 100644
--- a/softprojector.qrc
+++ b/softprojector.qrc
@@ -102,5 +102,6 @@
DisplayArea.qml
+ httpserver.html
diff --git a/softprojector.ui b/softprojector.ui
index 39799c5..a29b06c 100644
--- a/softprojector.ui
+++ b/softprojector.ui
@@ -216,7 +216,7 @@
0
0
1055
- 26
+ 21
diff --git a/httpserver.cpp b/httpserver.cpp
index cbcbefb..aa6d19b 100644
--- a/httpserver.cpp
+++ b/httpserver.cpp
@@ -25,8 +25,9 @@
HttpServer::HttpServer() { }
-void HttpServer::startServer(quint16 httpServerPort, quint16 webSocketServerPort)
+void HttpServer::startServer(QString httpServerIPAddress, quint16 httpServerPort, quint16 webSocketServerPort)
{
+ ipAddress = httpServerIPAddress;
httpPort = httpServerPort;
webSocketPort = webSocketServerPort;
server = new QTcpServer();
@@ -34,11 +35,11 @@ void HttpServer::startServer(quint16 httpServerPort, quint16 webSocketServerPort
// waiting for the web brower to make contact, this will emit signal
connect(server, SIGNAL(newConnection()), this, SLOT(startConnection()));
- if(server->listen(QHostAddress::Any, httpPort)) {
+ if(server->listen(QHostAddress(ipAddress), httpPort)) {
isRunning = true;
- qDebug() << "HTTP server listening on port: " << httpPort;
+ qDebug() << "HTTP server listening on " << ipAddress << ":" << httpPort;
} else {
- qDebug() << "HTTP server failed to start on port:" << httpPort;
+ qDebug() << "HTTP server failed listening on " << ipAddress << ":" << httpPort;
}
}
@@ -71,6 +72,7 @@ void HttpServer::sendData()
QString html = in.readAll();
file.close();
+ html.replace("${ipAddress}", ipAddress);
html.replace("${webSocketPort}", QString::number(webSocketPort));
socket->write("HTTP/1.1 200 OK\r\n"); // \r needs to be before \n
diff --git a/httpserver.hpp b/httpserver.hpp
index 9c95061..c640111 100644
--- a/httpserver.hpp
+++ b/httpserver.hpp
@@ -30,7 +30,7 @@ class HttpServer : public QObject
public:
HttpServer();
- void startServer(quint16 httpServerPort, quint16 webSocketServerPort);
+ void startServer(QString httpServerIPAddress, quint16 httpServerPort, quint16 webSocketServerPort);
void stopServer();
bool isRunning;
@@ -41,6 +41,7 @@ public slots:
private:
QTcpServer *server = new QTcpServer();
+ QString ipAddress;
quint16 httpPort;
quint16 webSocketPort;
diff --git a/httpserver.html b/httpserver.html
index 209fc2b..1e463aa 100644
--- a/httpserver.html
+++ b/httpserver.html
@@ -185,7 +185,7 @@