mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Server: reviewed application handling
This commit is contained in:
parent
6d12443100
commit
7dab0f67bb
@ -37,9 +37,6 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
|
||||
// This will cause the application to exit when the main core is finished
|
||||
QObject::connect(&m, SIGNAL(finished()), &a, SLOT(quit()));
|
||||
|
||||
// This will run the main core from the application event loop.
|
||||
QTimer::singleShot(0, &m, SLOT(run()));
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,6 @@ void WebAPIRequestMapper::instanceSummaryService(qtwebapp::HttpRequest& request,
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
qDebug("WebAPIRequestMapper::instanceSummaryService");
|
||||
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
||||
connect(ui->tabInputsView, SIGNAL(currentChanged(int)), this, SLOT(tabInputViewIndexChanged()));
|
||||
|
||||
m_apiAdapter = new WebAPIAdapterGUI(*this);
|
||||
m_requestMapper = new WebAPIRequestMapper(qApp);
|
||||
m_requestMapper = new WebAPIRequestMapper(this);
|
||||
m_requestMapper->setAdapter(m_apiAdapter);
|
||||
m_apiServer = new WebAPIServer(parser.getServerAddress(), parser.getServerPort(), m_requestMapper);
|
||||
m_apiServer->start();
|
||||
|
@ -39,8 +39,7 @@ MainCore::MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, Q
|
||||
m_masterTabIndex(-1),
|
||||
m_dspEngine(DSPEngine::instance()),
|
||||
m_lastEngineState((DSPDeviceSourceEngine::State)-1),
|
||||
m_logger(logger),
|
||||
m_running(true)
|
||||
m_logger(logger)
|
||||
{
|
||||
qDebug() << "MainCore::MainCore: start";
|
||||
|
||||
@ -54,7 +53,7 @@ MainCore::MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, Q
|
||||
m_masterTimer.start(50);
|
||||
|
||||
m_apiAdapter = new WebAPIAdapterSrv(*this);
|
||||
m_requestMapper = new WebAPIRequestMapper(QCoreApplication::instance());
|
||||
m_requestMapper = new WebAPIRequestMapper(this);
|
||||
m_requestMapper->setAdapter(m_apiAdapter);
|
||||
m_apiServer = new WebAPIServer(parser.getServerAddress(), parser.getServerPort(), m_requestMapper);
|
||||
m_apiServer->start();
|
||||
@ -75,23 +74,11 @@ MainCore::~MainCore()
|
||||
delete m_logger;
|
||||
}
|
||||
|
||||
void MainCore::run()
|
||||
{
|
||||
qDebug() << "MainCore::run: start";
|
||||
|
||||
while (m_running) {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
qDebug() << "MainCore::run: end";
|
||||
emit finished();
|
||||
}
|
||||
|
||||
bool MainCore::handleMessage(const Message& cmd)
|
||||
{
|
||||
if (MsgDeleteInstance::match(cmd))
|
||||
{
|
||||
m_running = false;
|
||||
emit finished();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -62,9 +62,6 @@ public:
|
||||
|
||||
friend class WebAPIAdapterSrv;
|
||||
|
||||
public slots:
|
||||
void run();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
@ -90,7 +87,6 @@ private:
|
||||
DSPEngine* m_dspEngine;
|
||||
int m_lastEngineState;
|
||||
qtwebapp::LoggerWithFile *m_logger;
|
||||
bool m_running;
|
||||
|
||||
MessageQueue m_inputMessageQueue;
|
||||
QTimer m_masterTimer;
|
||||
|
@ -22,7 +22,7 @@ def getInputOptions():
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if (options.address == None):
|
||||
options.address = "127.0.0.1:8888"
|
||||
options.address = "127.0.0.1:8091"
|
||||
|
||||
return options
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user