From fd01d603269476f344cfad769289154a90988217 Mon Sep 17 00:00:00 2001 From: "Tod E. Kurt" Date: Tue, 8 Sep 2015 18:06:56 -0700 Subject: [PATCH] blink1control: api server logging control easier --- qt/blink1control/httpserver.cpp | 11 +++++++++-- qt/blink1control/mainwindow.cpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/qt/blink1control/httpserver.cpp b/qt/blink1control/httpserver.cpp index 815936f1..b1d66a49 100644 --- a/qt/blink1control/httpserver.cpp +++ b/qt/blink1control/httpserver.cpp @@ -169,11 +169,18 @@ void HttpServer::startRead(){ resp.insert("status",QString("last color")); } else if( cmd=="/logging" ) { - QString levelstr = qurlquery.queryItemValue("loglevel"); + QString levelstr=""; + if( qurlquery.hasQueryItem("loglevel") ) { + levelstr = qurlquery.queryItemValue("loglevel"); + } else if( qurlquery.hasQueryItem("logLevel") ) { + levelstr = qurlquery.queryItemValue("logLevel"); + } if( levelstr == "1" || levelstr == "0" ) { mw->startOrStopLogging(levelstr.toInt()); } - resp.insert("loglevel",mw->getLogging()); + + resp.insert("loglevel",(mw->getLogging()) ? 1 : 0); + resp.insert("logfile", mw->getLogFileName()); resp.insert("status",QString("logging")); } else if( cmd=="/input" || cmd=="/inputs" ) { diff --git a/qt/blink1control/mainwindow.cpp b/qt/blink1control/mainwindow.cpp index 646f0ac4..d44d4c3e 100644 --- a/qt/blink1control/mainwindow.cpp +++ b/qt/blink1control/mainwindow.cpp @@ -221,7 +221,7 @@ MainWindow::MainWindow(QWidget *parent) : void MainWindow::goingToSleep() { addToLog("goingToSleep..."); - sleepytime = true; + sleepytime = true; on_buttonOff_clicked(); } // call when we know we've been woken up