[{"id":4208,"web_url":"https://patchwork.libcamera.org/comment/4208/","msgid":"<2666c3db-d005-91bb-74f7-d3c1b7dc39c3@ideasonboard.com>","date":"2020-03-23T14:56:06","subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 23/03/2020 14:21, Laurent Pinchart wrote:\n> Replace manual usage of std::cout and std::cerr with the Qt logging\n> facilities. This allows redirection log output if needed, and integrates\n> better with Qt.\n> \n\nThis fails to compile for me...\n\n> [2/3] Compiling C++ object 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o'.\n> FAILED: src/qcam/9916d8b@@qcam@exe/main_window.cpp.o \n> ccache c++ -Isrc/qcam/9916d8b@@qcam@exe -Isrc/qcam -I../src/qcam -Iinclude -I../include -Iinclude/libcamera -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++14 -g -Wno-unused-parameter -include config.h -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -fPIC -DQT_NO_KEYWORDS -MD -MQ 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o' -MF 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o.d' -o 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o' -c ../src/qcam/main_window.cpp\n> ../src/qcam/main_window.cpp: In member function ‘void MainWindow::processCapture()’:\n> ../src/qcam/main_window.cpp:516:31: error: ‘reset’ is not a member of ‘Qt’\n>    << metadata.sequence << Qt::reset\n>                                ^~~~~\n> ../src/qcam/main_window.cpp:516:31: note: suggested alternative:\n> In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h:49,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtDebug:1,\n>                  from ../src/qcam/main_window.cpp:26:\n> /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:262:28: note:   ‘reset’\n>  Q_CORE_EXPORT QTextStream &reset(QTextStream &s);\n>                             ^~~~~\n> ../src/qcam/main_window.cpp:519:20: error: ‘fixed’ is not a member of ‘Qt’\n>    << \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n>                     ^~~~~\n> ../src/qcam/main_window.cpp:519:20: note: suggested alternatives:\n> In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h:49,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtDebug:1,\n>                  from ../src/qcam/main_window.cpp:26:\n> /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:253:28: note:   ‘fixed’\n>  Q_CORE_EXPORT QTextStream &fixed(QTextStream &s);\n>                             ^~~~~\n> In file included from /usr/include/c++/8/ios:42,\n>                  from /usr/include/c++/8/ostream:38,\n>                  from /usr/include/c++/8/iterator:64,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:53,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qwidget.h:45,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qmainwindow.h:44,\n>                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QMainWindow:1,\n>                  from ../src/qcam/main_window.h:13,\n>                  from ../src/qcam/main_window.cpp:8:\n> /usr/include/c++/8/bits/ios_base.h:1043:3: note:   ‘std::fixed’\n>    fixed(ios_base& __base)\n>    ^~~~~\n> ninja: build stopped: subcommand failed.\n> make: *** [m:24: libcamera] Error 1\n\n\n\n\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/qcam/main.cpp        |  8 +++----\n>  src/qcam/main_window.cpp | 45 ++++++++++++++++++++--------------------\n>  2 files changed, 26 insertions(+), 27 deletions(-)\n> \n> diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\n> index 297453914ae9..862d714f467c 100644\n> --- a/src/qcam/main.cpp\n> +++ b/src/qcam/main.cpp\n> @@ -5,11 +5,11 @@\n>   * main.cpp - cam - The libcamera swiss army knife\n>   */\n>  \n> -#include <iostream>\n>  #include <signal.h>\n>  #include <string.h>\n>  \n>  #include <QApplication>\n> +#include <QtDebug>\n>  \n>  #include <libcamera/camera_manager.h>\n>  \n> @@ -18,7 +18,7 @@\n>  \n>  void signalHandler(int signal)\n>  {\n> -\tstd::cout << \"Exiting\" << std::endl;\n> +\tqInfo() << \"Exiting\";\n>  \tqApp->quit();\n>  }\n>  \n> @@ -65,8 +65,8 @@ int main(int argc, char **argv)\n>  \n>  \tret = cm->start();\n>  \tif (ret) {\n> -\t\tstd::cout << \"Failed to start camera manager: \"\n> -\t\t\t  << strerror(-ret) << std::endl;\n> +\t\tqInfo() << \"Failed to start camera manager:\"\n> +\t\t\t<< strerror(-ret);\n>  \t\treturn EXIT_FAILURE;\n>  \t}\n>  \n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index ed8301502fb2..184345b0e2a6 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -8,7 +8,6 @@\n>  #include \"main_window.h\"\n>  \n>  #include <iomanip>\n> -#include <iostream>\n>  #include <string>\n>  #include <sys/mman.h>\n>  \n> @@ -24,6 +23,7 @@\n>  #include <QTimer>\n>  #include <QToolBar>\n>  #include <QToolButton>\n> +#include <QtDebug>\n>  \n>  #include <libcamera/camera_manager.h>\n>  #include <libcamera/version.h>\n> @@ -177,11 +177,11 @@ void MainWindow::switchCamera(int index)\n>  \tconst std::shared_ptr<Camera> &cam = cameras[index];\n>  \n>  \tif (cam->acquire()) {\n> -\t\tstd::cout << \"Failed to acquire camera \" << cam->name() << std::endl;\n> +\t\tqInfo() << \"Failed to acquire camera\" << cam->name().c_str();\n>  \t\treturn;\n>  \t}\n>  \n> -\tstd::cout << \"Switching to camera \" << cam->name() << std::endl;\n> +\tqInfo() << \"Switching to camera\" << cam->name().c_str();\n>  \n>  \t/*\n>  \t * Stop the capture session, release the current camera, replace it with\n> @@ -236,13 +236,12 @@ int MainWindow::openCamera()\n>  \t/* Get and acquire the camera. */\n>  \tcamera_ = cm_->get(cameraName);\n>  \tif (!camera_) {\n> -\t\tstd::cout << \"Camera \" << cameraName << \" not found\"\n> -\t\t\t  << std::endl;\n> +\t\tqInfo() << \"Camera\" << cameraName.c_str() << \"not found\";\n>  \t\treturn -ENODEV;\n>  \t}\n>  \n>  \tif (camera_->acquire()) {\n> -\t\tstd::cout << \"Failed to acquire camera\" << std::endl;\n> +\t\tqInfo() << \"Failed to acquire camera\";\n>  \t\tcamera_.reset();\n>  \t\treturn -EBUSY;\n>  \t}\n> @@ -296,18 +295,18 @@ int MainWindow::startCapture()\n>  \n>  \tCameraConfiguration::Status validation = config_->validate();\n>  \tif (validation == CameraConfiguration::Invalid) {\n> -\t\tstd::cerr << \"Failed to create valid camera configuration\";\n> +\t\tqWarning() << \"Failed to create valid camera configuration\";\n>  \t\treturn -EINVAL;\n>  \t}\n>  \n>  \tif (validation == CameraConfiguration::Adjusted) {\n> -\t\tstd::cout << \"Stream size adjusted to \"\n> -\t\t\t  << cfg.size.toString() << std::endl;\n> +\t\tqInfo() << \"Stream size adjusted to\"\n> +\t\t\t<< cfg.size.toString().c_str();\n>  \t}\n>  \n>  \tret = camera_->configure(config_.get());\n>  \tif (ret < 0) {\n> -\t\tstd::cout << \"Failed to configure camera\" << std::endl;\n> +\t\tqInfo() << \"Failed to configure camera\";\n>  \t\treturn ret;\n>  \t}\n>  \n> @@ -316,7 +315,7 @@ int MainWindow::startCapture()\n>  \tret = viewfinder_->setFormat(cfg.pixelFormat,\n>  \t\t\t\t     QSize(cfg.size.width, cfg.size.height));\n>  \tif (ret < 0) {\n> -\t\tstd::cout << \"Failed to set viewfinder format\" << std::endl;\n> +\t\tqInfo() << \"Failed to set viewfinder format\";\n>  \t\treturn ret;\n>  \t}\n>  \n> @@ -326,7 +325,7 @@ int MainWindow::startCapture()\n>  \tallocator_ = new FrameBufferAllocator(camera_);\n>  \tret = allocator_->allocate(stream);\n>  \tif (ret < 0) {\n> -\t\tstd::cerr << \"Failed to allocate capture buffers\" << std::endl;\n> +\t\tqWarning() << \"Failed to allocate capture buffers\";\n>  \t\treturn ret;\n>  \t}\n>  \n> @@ -334,14 +333,14 @@ int MainWindow::startCapture()\n>  \tfor (const std::unique_ptr<FrameBuffer> &buffer : allocator_->buffers(stream)) {\n>  \t\tRequest *request = camera_->createRequest();\n>  \t\tif (!request) {\n> -\t\t\tstd::cerr << \"Can't create request\" << std::endl;\n> +\t\t\tqWarning() << \"Can't create request\";\n>  \t\t\tret = -ENOMEM;\n>  \t\t\tgoto error;\n>  \t\t}\n>  \n>  \t\tret = request->addBuffer(stream, buffer.get());\n>  \t\tif (ret < 0) {\n> -\t\t\tstd::cerr << \"Can't set buffer for request\" << std::endl;\n> +\t\t\tqWarning() << \"Can't set buffer for request\";\n>  \t\t\tgoto error;\n>  \t\t}\n>  \n> @@ -364,7 +363,7 @@ int MainWindow::startCapture()\n>  \n>  \tret = camera_->start();\n>  \tif (ret) {\n> -\t\tstd::cout << \"Failed to start capture\" << std::endl;\n> +\t\tqInfo() << \"Failed to start capture\";\n>  \t\tgoto error;\n>  \t}\n>  \n> @@ -374,7 +373,7 @@ int MainWindow::startCapture()\n>  \tfor (Request *request : requests) {\n>  \t\tret = camera_->queueRequest(request);\n>  \t\tif (ret < 0) {\n> -\t\t\tstd::cerr << \"Can't queue request\" << std::endl;\n> +\t\t\tqWarning() << \"Can't queue request\";\n>  \t\t\tgoto error_disconnect;\n>  \t\t}\n>  \t}\n> @@ -417,7 +416,7 @@ void MainWindow::stopCapture()\n>  \n>  \tint ret = camera_->stop();\n>  \tif (ret)\n> -\t\tstd::cout << \"Failed to stop capture\" << std::endl;\n> +\t\tqInfo() << \"Failed to stop capture\";\n>  \n>  \tcamera_->requestCompleted.disconnect(this, &MainWindow::requestComplete);\n>  \n> @@ -513,11 +512,11 @@ void MainWindow::processCapture()\n>  \tfps = lastBufferTime_ && fps ? 1000000000.0 / fps : 0.0;\n>  \tlastBufferTime_ = metadata.timestamp;\n>  \n> -\tstd::cout << \"seq: \" << std::setw(6) << std::setfill('0') << metadata.sequence\n> -\t\t  << \" bytesused: \" << metadata.planes[0].bytesused\n> -\t\t  << \" timestamp: \" << metadata.timestamp\n> -\t\t  << \" fps: \" << std::fixed << std::setprecision(2) << fps\n> -\t\t  << std::endl;\n> +\tqInfo() << \"seq:\" << qSetFieldWidth(6) << qSetPadChar('0')\n> +\t\t<< metadata.sequence << Qt::reset\n> +\t\t<< \"bytesused:\" << metadata.planes[0].bytesused\n> +\t\t<< \"timestamp:\" << metadata.timestamp\n> +\t\t<< \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n>  \n>  \t/* Display the buffer and requeue it to the camera. */\n>  \tdisplay(buffer);\n> @@ -542,7 +541,7 @@ void MainWindow::queueRequest(FrameBuffer *buffer)\n>  {\n>  \tRequest *request = camera_->createRequest();\n>  \tif (!request) {\n> -\t\tstd::cerr << \"Can't create request\" << std::endl;\n> +\t\tqWarning() << \"Can't create request\";\n>  \t\treturn;\n>  \t}\n>  \n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E9F560413\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:56:10 +0100 (CET)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7E5FC308;\n\tMon, 23 Mar 2020 15:56:09 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584975369;\n\tbh=aSgfAdLBMGv3Jb4CC7D/jT7j1PM3MLXLB5m+dVuHv7Y=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=fdp0+b1xbIcUwztvKDzFKpUfI6XdQ7eU69xruBQlvd+nT0mWHtRziMESM3zFL/W7l\n\t96Cmq/OQVW6lcayaqklCwZbBLq845lV9crZn9JBeWQq2/oIzXF7NhQdw3G6l139Q5x\n\tgS3Demam/BiiyiHwIxeHQqMsp7kNlhbECljpezGM=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>\n\t<20200323142205.28342-13-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkA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PGYrTwCt0YWPU2TgGgJrVhYT20ierN8LUvj\n\t6qOPTd+Uk7NFzL65qkh80ZKNBFddx1AabQpSVQKbdcLb8OFs85kuSvFdgqZwgxA1vl4TFhNz\n\tPZ79NAmXLackAx3sOVFhk4WQaKRshCB7cSl+RIng5S/ThOBlwNlcKG7j7W2MC06BlTbdEkUp\n\tECzuuRBv8wX4OQl+hbWbB/VKIx5HKlLu1eypen/5lNVzSqMMIYkkZcjV2SWQyUGxSwq0O/sx\n\tS0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j\n\tsbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8\n\tpQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc\n\tMW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<2666c3db-d005-91bb-74f7-d3c1b7dc39c3@ideasonboard.com>","Date":"Mon, 23 Mar 2020 14:56:06 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.9.1","MIME-Version":"1.0","In-Reply-To":"<20200323142205.28342-13-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 23 Mar 2020 14:56:10 -0000"}},{"id":4213,"web_url":"https://patchwork.libcamera.org/comment/4213/","msgid":"<20200323152736.GK4768@pendragon.ideasonboard.com>","date":"2020-03-23T15:27:36","subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Mar 23, 2020 at 02:56:06PM +0000, Kieran Bingham wrote:\n> On 23/03/2020 14:21, Laurent Pinchart wrote:\n> > Replace manual usage of std::cout and std::cerr with the Qt logging\n> > facilities. This allows redirection log output if needed, and integrates\n> > better with Qt.\n> \n> This fails to compile for me...\n> \n> > [2/3] Compiling C++ object 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o'.\n> > FAILED: src/qcam/9916d8b@@qcam@exe/main_window.cpp.o \n> > ccache c++ -Isrc/qcam/9916d8b@@qcam@exe -Isrc/qcam -I../src/qcam -Iinclude -I../include -Iinclude/libcamera -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++14 -g -Wno-unused-parameter -include config.h -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -fPIC -DQT_NO_KEYWORDS -MD -MQ 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o' -MF 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o.d' -o 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o' -c ../src/qcam/main_window.cpp\n> > ../src/qcam/main_window.cpp: In member function ‘void MainWindow::processCapture()’:\n> > ../src/qcam/main_window.cpp:516:31: error: ‘reset’ is not a member of ‘Qt’\n> >    << metadata.sequence << Qt::reset\n> >                                ^~~~~\n> > ../src/qcam/main_window.cpp:516:31: note: suggested alternative:\n> > In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h:49,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtDebug:1,\n> >                  from ../src/qcam/main_window.cpp:26:\n> > /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:262:28: note:   ‘reset’\n> >  Q_CORE_EXPORT QTextStream &reset(QTextStream &s);\n> >                             ^~~~~\n> > ../src/qcam/main_window.cpp:519:20: error: ‘fixed’ is not a member of ‘Qt’\n> >    << \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n> >                     ^~~~~\n> > ../src/qcam/main_window.cpp:519:20: note: suggested alternatives:\n> > In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h:49,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtDebug:1,\n> >                  from ../src/qcam/main_window.cpp:26:\n> > /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:253:28: note:   ‘fixed’\n> >  Q_CORE_EXPORT QTextStream &fixed(QTextStream &s);\n> >                             ^~~~~\n> > In file included from /usr/include/c++/8/ios:42,\n> >                  from /usr/include/c++/8/ostream:38,\n> >                  from /usr/include/c++/8/iterator:64,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:53,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qwidget.h:45,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qmainwindow.h:44,\n> >                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QMainWindow:1,\n> >                  from ../src/qcam/main_window.h:13,\n> >                  from ../src/qcam/main_window.cpp:8:\n> > /usr/include/c++/8/bits/ios_base.h:1043:3: note:   ‘std::fixed’\n> >    fixed(ios_base& __base)\n> >    ^~~~~\n> > ninja: build stopped: subcommand failed.\n> > make: *** [m:24: libcamera] Error 1\n\nIt seems to be a Qt version issue. Could you try to remove the Qt::\nprefix from reset and fixed ?\n\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/qcam/main.cpp        |  8 +++----\n> >  src/qcam/main_window.cpp | 45 ++++++++++++++++++++--------------------\n> >  2 files changed, 26 insertions(+), 27 deletions(-)\n> > \n> > diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\n> > index 297453914ae9..862d714f467c 100644\n> > --- a/src/qcam/main.cpp\n> > +++ b/src/qcam/main.cpp\n> > @@ -5,11 +5,11 @@\n> >   * main.cpp - cam - The libcamera swiss army knife\n> >   */\n> >  \n> > -#include <iostream>\n> >  #include <signal.h>\n> >  #include <string.h>\n> >  \n> >  #include <QApplication>\n> > +#include <QtDebug>\n> >  \n> >  #include <libcamera/camera_manager.h>\n> >  \n> > @@ -18,7 +18,7 @@\n> >  \n> >  void signalHandler(int signal)\n> >  {\n> > -\tstd::cout << \"Exiting\" << std::endl;\n> > +\tqInfo() << \"Exiting\";\n> >  \tqApp->quit();\n> >  }\n> >  \n> > @@ -65,8 +65,8 @@ int main(int argc, char **argv)\n> >  \n> >  \tret = cm->start();\n> >  \tif (ret) {\n> > -\t\tstd::cout << \"Failed to start camera manager: \"\n> > -\t\t\t  << strerror(-ret) << std::endl;\n> > +\t\tqInfo() << \"Failed to start camera manager:\"\n> > +\t\t\t<< strerror(-ret);\n> >  \t\treturn EXIT_FAILURE;\n> >  \t}\n> >  \n> > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> > index ed8301502fb2..184345b0e2a6 100644\n> > --- a/src/qcam/main_window.cpp\n> > +++ b/src/qcam/main_window.cpp\n> > @@ -8,7 +8,6 @@\n> >  #include \"main_window.h\"\n> >  \n> >  #include <iomanip>\n> > -#include <iostream>\n> >  #include <string>\n> >  #include <sys/mman.h>\n> >  \n> > @@ -24,6 +23,7 @@\n> >  #include <QTimer>\n> >  #include <QToolBar>\n> >  #include <QToolButton>\n> > +#include <QtDebug>\n> >  \n> >  #include <libcamera/camera_manager.h>\n> >  #include <libcamera/version.h>\n> > @@ -177,11 +177,11 @@ void MainWindow::switchCamera(int index)\n> >  \tconst std::shared_ptr<Camera> &cam = cameras[index];\n> >  \n> >  \tif (cam->acquire()) {\n> > -\t\tstd::cout << \"Failed to acquire camera \" << cam->name() << std::endl;\n> > +\t\tqInfo() << \"Failed to acquire camera\" << cam->name().c_str();\n> >  \t\treturn;\n> >  \t}\n> >  \n> > -\tstd::cout << \"Switching to camera \" << cam->name() << std::endl;\n> > +\tqInfo() << \"Switching to camera\" << cam->name().c_str();\n> >  \n> >  \t/*\n> >  \t * Stop the capture session, release the current camera, replace it with\n> > @@ -236,13 +236,12 @@ int MainWindow::openCamera()\n> >  \t/* Get and acquire the camera. */\n> >  \tcamera_ = cm_->get(cameraName);\n> >  \tif (!camera_) {\n> > -\t\tstd::cout << \"Camera \" << cameraName << \" not found\"\n> > -\t\t\t  << std::endl;\n> > +\t\tqInfo() << \"Camera\" << cameraName.c_str() << \"not found\";\n> >  \t\treturn -ENODEV;\n> >  \t}\n> >  \n> >  \tif (camera_->acquire()) {\n> > -\t\tstd::cout << \"Failed to acquire camera\" << std::endl;\n> > +\t\tqInfo() << \"Failed to acquire camera\";\n> >  \t\tcamera_.reset();\n> >  \t\treturn -EBUSY;\n> >  \t}\n> > @@ -296,18 +295,18 @@ int MainWindow::startCapture()\n> >  \n> >  \tCameraConfiguration::Status validation = config_->validate();\n> >  \tif (validation == CameraConfiguration::Invalid) {\n> > -\t\tstd::cerr << \"Failed to create valid camera configuration\";\n> > +\t\tqWarning() << \"Failed to create valid camera configuration\";\n> >  \t\treturn -EINVAL;\n> >  \t}\n> >  \n> >  \tif (validation == CameraConfiguration::Adjusted) {\n> > -\t\tstd::cout << \"Stream size adjusted to \"\n> > -\t\t\t  << cfg.size.toString() << std::endl;\n> > +\t\tqInfo() << \"Stream size adjusted to\"\n> > +\t\t\t<< cfg.size.toString().c_str();\n> >  \t}\n> >  \n> >  \tret = camera_->configure(config_.get());\n> >  \tif (ret < 0) {\n> > -\t\tstd::cout << \"Failed to configure camera\" << std::endl;\n> > +\t\tqInfo() << \"Failed to configure camera\";\n> >  \t\treturn ret;\n> >  \t}\n> >  \n> > @@ -316,7 +315,7 @@ int MainWindow::startCapture()\n> >  \tret = viewfinder_->setFormat(cfg.pixelFormat,\n> >  \t\t\t\t     QSize(cfg.size.width, cfg.size.height));\n> >  \tif (ret < 0) {\n> > -\t\tstd::cout << \"Failed to set viewfinder format\" << std::endl;\n> > +\t\tqInfo() << \"Failed to set viewfinder format\";\n> >  \t\treturn ret;\n> >  \t}\n> >  \n> > @@ -326,7 +325,7 @@ int MainWindow::startCapture()\n> >  \tallocator_ = new FrameBufferAllocator(camera_);\n> >  \tret = allocator_->allocate(stream);\n> >  \tif (ret < 0) {\n> > -\t\tstd::cerr << \"Failed to allocate capture buffers\" << std::endl;\n> > +\t\tqWarning() << \"Failed to allocate capture buffers\";\n> >  \t\treturn ret;\n> >  \t}\n> >  \n> > @@ -334,14 +333,14 @@ int MainWindow::startCapture()\n> >  \tfor (const std::unique_ptr<FrameBuffer> &buffer : allocator_->buffers(stream)) {\n> >  \t\tRequest *request = camera_->createRequest();\n> >  \t\tif (!request) {\n> > -\t\t\tstd::cerr << \"Can't create request\" << std::endl;\n> > +\t\t\tqWarning() << \"Can't create request\";\n> >  \t\t\tret = -ENOMEM;\n> >  \t\t\tgoto error;\n> >  \t\t}\n> >  \n> >  \t\tret = request->addBuffer(stream, buffer.get());\n> >  \t\tif (ret < 0) {\n> > -\t\t\tstd::cerr << \"Can't set buffer for request\" << std::endl;\n> > +\t\t\tqWarning() << \"Can't set buffer for request\";\n> >  \t\t\tgoto error;\n> >  \t\t}\n> >  \n> > @@ -364,7 +363,7 @@ int MainWindow::startCapture()\n> >  \n> >  \tret = camera_->start();\n> >  \tif (ret) {\n> > -\t\tstd::cout << \"Failed to start capture\" << std::endl;\n> > +\t\tqInfo() << \"Failed to start capture\";\n> >  \t\tgoto error;\n> >  \t}\n> >  \n> > @@ -374,7 +373,7 @@ int MainWindow::startCapture()\n> >  \tfor (Request *request : requests) {\n> >  \t\tret = camera_->queueRequest(request);\n> >  \t\tif (ret < 0) {\n> > -\t\t\tstd::cerr << \"Can't queue request\" << std::endl;\n> > +\t\t\tqWarning() << \"Can't queue request\";\n> >  \t\t\tgoto error_disconnect;\n> >  \t\t}\n> >  \t}\n> > @@ -417,7 +416,7 @@ void MainWindow::stopCapture()\n> >  \n> >  \tint ret = camera_->stop();\n> >  \tif (ret)\n> > -\t\tstd::cout << \"Failed to stop capture\" << std::endl;\n> > +\t\tqInfo() << \"Failed to stop capture\";\n> >  \n> >  \tcamera_->requestCompleted.disconnect(this, &MainWindow::requestComplete);\n> >  \n> > @@ -513,11 +512,11 @@ void MainWindow::processCapture()\n> >  \tfps = lastBufferTime_ && fps ? 1000000000.0 / fps : 0.0;\n> >  \tlastBufferTime_ = metadata.timestamp;\n> >  \n> > -\tstd::cout << \"seq: \" << std::setw(6) << std::setfill('0') << metadata.sequence\n> > -\t\t  << \" bytesused: \" << metadata.planes[0].bytesused\n> > -\t\t  << \" timestamp: \" << metadata.timestamp\n> > -\t\t  << \" fps: \" << std::fixed << std::setprecision(2) << fps\n> > -\t\t  << std::endl;\n> > +\tqInfo() << \"seq:\" << qSetFieldWidth(6) << qSetPadChar('0')\n> > +\t\t<< metadata.sequence << Qt::reset\n> > +\t\t<< \"bytesused:\" << metadata.planes[0].bytesused\n> > +\t\t<< \"timestamp:\" << metadata.timestamp\n> > +\t\t<< \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n> >  \n> >  \t/* Display the buffer and requeue it to the camera. */\n> >  \tdisplay(buffer);\n> > @@ -542,7 +541,7 @@ void MainWindow::queueRequest(FrameBuffer *buffer)\n> >  {\n> >  \tRequest *request = camera_->createRequest();\n> >  \tif (!request) {\n> > -\t\tstd::cerr << \"Can't create request\" << std::endl;\n> > +\t\tqWarning() << \"Can't create request\";\n> >  \t\treturn;\n> >  \t}\n> >","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 181C360417\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 16:27:46 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8EE0E308;\n\tMon, 23 Mar 2020 16:27:45 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584977265;\n\tbh=MbemZrQexpHq+CfXJSZ3/IAKlk5KpSZ1i0cVo0Oa/co=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Y5lO8+Wgmec+WIRJrO3dGrPCXqaI8M2e84MmkaSRCG1zQsByQcWD9bihmWoGoaFIe\n\tP9/+XLu74VwNk41oIGWfPUYmLmpTYmVdi9ZGuGqVBrIKLQmVPVxBja/KRgf970tiHE\n\teGpoU9C3ECUVLqxCLROwuu28/1a38qna+ZlG2VNI=","Date":"Mon, 23 Mar 2020 17:27:36 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200323152736.GK4768@pendragon.ideasonboard.com>","References":"<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>\n\t<20200323142205.28342-13-laurent.pinchart@ideasonboard.com>\n\t<2666c3db-d005-91bb-74f7-d3c1b7dc39c3@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<2666c3db-d005-91bb-74f7-d3c1b7dc39c3@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 23 Mar 2020 15:27:46 -0000"}},{"id":4216,"web_url":"https://patchwork.libcamera.org/comment/4216/","msgid":"<6af5566c-362d-75f9-e7f3-fc7ef6d2a1fc@ideasonboard.com>","date":"2020-03-23T15:45:09","subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 23/03/2020 15:27, Laurent Pinchart wrote:\n> Hi Kieran,\n> \n> On Mon, Mar 23, 2020 at 02:56:06PM +0000, Kieran Bingham wrote:\n>> On 23/03/2020 14:21, Laurent Pinchart wrote:\n>>> Replace manual usage of std::cout and std::cerr with the Qt logging\n>>> facilities. This allows redirection log output if needed, and integrates\n>>> better with Qt.\n>>\n>> This fails to compile for me...\n>>\n>>> [2/3] Compiling C++ object 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o'.\n>>> FAILED: src/qcam/9916d8b@@qcam@exe/main_window.cpp.o \n>>> ccache c++ -Isrc/qcam/9916d8b@@qcam@exe -Isrc/qcam -I../src/qcam -Iinclude -I../include -Iinclude/libcamera -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++14 -g -Wno-unused-parameter -include config.h -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -fPIC -DQT_NO_KEYWORDS -MD -MQ 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o' -MF 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o.d' -o 'src/qcam/9916d8b@@qcam@exe/main_window.cpp.o' -c ../src/qcam/main_window.cpp\n>>> ../src/qcam/main_window.cpp: In member function ‘void MainWindow::processCapture()’:\n>>> ../src/qcam/main_window.cpp:516:31: error: ‘reset’ is not a member of ‘Qt’\n>>>    << metadata.sequence << Qt::reset\n>>>                                ^~~~~\n>>> ../src/qcam/main_window.cpp:516:31: note: suggested alternative:\n>>> In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h:49,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtDebug:1,\n>>>                  from ../src/qcam/main_window.cpp:26:\n>>> /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:262:28: note:   ‘reset’\n>>>  Q_CORE_EXPORT QTextStream &reset(QTextStream &s);\n>>>                             ^~~~~\n>>> ../src/qcam/main_window.cpp:519:20: error: ‘fixed’ is not a member of ‘Qt’\n>>>    << \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n>>>                     ^~~~~\n>>> ../src/qcam/main_window.cpp:519:20: note: suggested alternatives:\n>>> In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h:49,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtDebug:1,\n>>>                  from ../src/qcam/main_window.cpp:26:\n>>> /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:253:28: note:   ‘fixed’\n>>>  Q_CORE_EXPORT QTextStream &fixed(QTextStream &s);\n>>>                             ^~~~~\n>>> In file included from /usr/include/c++/8/ios:42,\n>>>                  from /usr/include/c++/8/ostream:38,\n>>>                  from /usr/include/c++/8/iterator:64,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:53,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qwidget.h:45,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qmainwindow.h:44,\n>>>                  from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QMainWindow:1,\n>>>                  from ../src/qcam/main_window.h:13,\n>>>                  from ../src/qcam/main_window.cpp:8:\n>>> /usr/include/c++/8/bits/ios_base.h:1043:3: note:   ‘std::fixed’\n>>>    fixed(ios_base& __base)\n>>>    ^~~~~\n>>> ninja: build stopped: subcommand failed.\n>>> make: *** [m:24: libcamera] Error 1\n> \n> It seems to be a Qt version issue. Could you try to remove the Qt::\n> prefix from reset and fixed ?\n\nThat appears to have fixed things yes,\n\n> \n>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>> ---\n>>>  src/qcam/main.cpp        |  8 +++----\n>>>  src/qcam/main_window.cpp | 45 ++++++++++++++++++++--------------------\n>>>  2 files changed, 26 insertions(+), 27 deletions(-)\n>>>\n>>> diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\n>>> index 297453914ae9..862d714f467c 100644\n>>> --- a/src/qcam/main.cpp\n>>> +++ b/src/qcam/main.cpp\n>>> @@ -5,11 +5,11 @@\n>>>   * main.cpp - cam - The libcamera swiss army knife\n>>>   */\n>>>  \n>>> -#include <iostream>\n>>>  #include <signal.h>\n>>>  #include <string.h>\n>>>  \n>>>  #include <QApplication>\n>>> +#include <QtDebug>\n>>>  \n>>>  #include <libcamera/camera_manager.h>\n>>>  \n>>> @@ -18,7 +18,7 @@\n>>>  \n>>>  void signalHandler(int signal)\n>>>  {\n>>> -\tstd::cout << \"Exiting\" << std::endl;\n>>> +\tqInfo() << \"Exiting\";\n>>>  \tqApp->quit();\n>>>  }\n>>>  \n>>> @@ -65,8 +65,8 @@ int main(int argc, char **argv)\n>>>  \n>>>  \tret = cm->start();\n>>>  \tif (ret) {\n>>> -\t\tstd::cout << \"Failed to start camera manager: \"\n>>> -\t\t\t  << strerror(-ret) << std::endl;\n>>> +\t\tqInfo() << \"Failed to start camera manager:\"\n>>> +\t\t\t<< strerror(-ret);\n>>>  \t\treturn EXIT_FAILURE;\n>>>  \t}\n>>>  \n>>> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n>>> index ed8301502fb2..184345b0e2a6 100644\n>>> --- a/src/qcam/main_window.cpp\n>>> +++ b/src/qcam/main_window.cpp\n>>> @@ -8,7 +8,6 @@\n>>>  #include \"main_window.h\"\n>>>  \n>>>  #include <iomanip>\n>>> -#include <iostream>\n>>>  #include <string>\n>>>  #include <sys/mman.h>\n>>>  \n>>> @@ -24,6 +23,7 @@\n>>>  #include <QTimer>\n>>>  #include <QToolBar>\n>>>  #include <QToolButton>\n>>> +#include <QtDebug>\n>>>  \n>>>  #include <libcamera/camera_manager.h>\n>>>  #include <libcamera/version.h>\n>>> @@ -177,11 +177,11 @@ void MainWindow::switchCamera(int index)\n>>>  \tconst std::shared_ptr<Camera> &cam = cameras[index];\n>>>  \n>>>  \tif (cam->acquire()) {\n>>> -\t\tstd::cout << \"Failed to acquire camera \" << cam->name() << std::endl;\n>>> +\t\tqInfo() << \"Failed to acquire camera\" << cam->name().c_str();\n>>>  \t\treturn;\n>>>  \t}\n>>>  \n>>> -\tstd::cout << \"Switching to camera \" << cam->name() << std::endl;\n>>> +\tqInfo() << \"Switching to camera\" << cam->name().c_str();\n>>>  \n>>>  \t/*\n>>>  \t * Stop the capture session, release the current camera, replace it with\n>>> @@ -236,13 +236,12 @@ int MainWindow::openCamera()\n>>>  \t/* Get and acquire the camera. */\n>>>  \tcamera_ = cm_->get(cameraName);\n>>>  \tif (!camera_) {\n>>> -\t\tstd::cout << \"Camera \" << cameraName << \" not found\"\n>>> -\t\t\t  << std::endl;\n>>> +\t\tqInfo() << \"Camera\" << cameraName.c_str() << \"not found\";\n>>>  \t\treturn -ENODEV;\n>>>  \t}\n>>>  \n>>>  \tif (camera_->acquire()) {\n>>> -\t\tstd::cout << \"Failed to acquire camera\" << std::endl;\n>>> +\t\tqInfo() << \"Failed to acquire camera\";\n>>>  \t\tcamera_.reset();\n>>>  \t\treturn -EBUSY;\n>>>  \t}\n>>> @@ -296,18 +295,18 @@ int MainWindow::startCapture()\n>>>  \n>>>  \tCameraConfiguration::Status validation = config_->validate();\n>>>  \tif (validation == CameraConfiguration::Invalid) {\n>>> -\t\tstd::cerr << \"Failed to create valid camera configuration\";\n>>> +\t\tqWarning() << \"Failed to create valid camera configuration\";\n>>>  \t\treturn -EINVAL;\n>>>  \t}\n>>>  \n>>>  \tif (validation == CameraConfiguration::Adjusted) {\n>>> -\t\tstd::cout << \"Stream size adjusted to \"\n>>> -\t\t\t  << cfg.size.toString() << std::endl;\n>>> +\t\tqInfo() << \"Stream size adjusted to\"\n>>> +\t\t\t<< cfg.size.toString().c_str();\n>>>  \t}\n>>>  \n>>>  \tret = camera_->configure(config_.get());\n>>>  \tif (ret < 0) {\n>>> -\t\tstd::cout << \"Failed to configure camera\" << std::endl;\n>>> +\t\tqInfo() << \"Failed to configure camera\";\n>>>  \t\treturn ret;\n>>>  \t}\n>>>  \n>>> @@ -316,7 +315,7 @@ int MainWindow::startCapture()\n>>>  \tret = viewfinder_->setFormat(cfg.pixelFormat,\n>>>  \t\t\t\t     QSize(cfg.size.width, cfg.size.height));\n>>>  \tif (ret < 0) {\n>>> -\t\tstd::cout << \"Failed to set viewfinder format\" << std::endl;\n>>> +\t\tqInfo() << \"Failed to set viewfinder format\";\n>>>  \t\treturn ret;\n>>>  \t}\n>>>  \n>>> @@ -326,7 +325,7 @@ int MainWindow::startCapture()\n>>>  \tallocator_ = new FrameBufferAllocator(camera_);\n>>>  \tret = allocator_->allocate(stream);\n>>>  \tif (ret < 0) {\n>>> -\t\tstd::cerr << \"Failed to allocate capture buffers\" << std::endl;\n>>> +\t\tqWarning() << \"Failed to allocate capture buffers\";\n>>>  \t\treturn ret;\n>>>  \t}\n>>>  \n>>> @@ -334,14 +333,14 @@ int MainWindow::startCapture()\n>>>  \tfor (const std::unique_ptr<FrameBuffer> &buffer : allocator_->buffers(stream)) {\n>>>  \t\tRequest *request = camera_->createRequest();\n>>>  \t\tif (!request) {\n>>> -\t\t\tstd::cerr << \"Can't create request\" << std::endl;\n>>> +\t\t\tqWarning() << \"Can't create request\";\n>>>  \t\t\tret = -ENOMEM;\n>>>  \t\t\tgoto error;\n>>>  \t\t}\n>>>  \n>>>  \t\tret = request->addBuffer(stream, buffer.get());\n>>>  \t\tif (ret < 0) {\n>>> -\t\t\tstd::cerr << \"Can't set buffer for request\" << std::endl;\n>>> +\t\t\tqWarning() << \"Can't set buffer for request\";\n>>>  \t\t\tgoto error;\n>>>  \t\t}\n>>>  \n>>> @@ -364,7 +363,7 @@ int MainWindow::startCapture()\n>>>  \n>>>  \tret = camera_->start();\n>>>  \tif (ret) {\n>>> -\t\tstd::cout << \"Failed to start capture\" << std::endl;\n>>> +\t\tqInfo() << \"Failed to start capture\";\n>>>  \t\tgoto error;\n>>>  \t}\n>>>  \n>>> @@ -374,7 +373,7 @@ int MainWindow::startCapture()\n>>>  \tfor (Request *request : requests) {\n>>>  \t\tret = camera_->queueRequest(request);\n>>>  \t\tif (ret < 0) {\n>>> -\t\t\tstd::cerr << \"Can't queue request\" << std::endl;\n>>> +\t\t\tqWarning() << \"Can't queue request\";\n>>>  \t\t\tgoto error_disconnect;\n>>>  \t\t}\n>>>  \t}\n>>> @@ -417,7 +416,7 @@ void MainWindow::stopCapture()\n>>>  \n>>>  \tint ret = camera_->stop();\n>>>  \tif (ret)\n>>> -\t\tstd::cout << \"Failed to stop capture\" << std::endl;\n>>> +\t\tqInfo() << \"Failed to stop capture\";\n>>>  \n>>>  \tcamera_->requestCompleted.disconnect(this, &MainWindow::requestComplete);\n>>>  \n>>> @@ -513,11 +512,11 @@ void MainWindow::processCapture()\n>>>  \tfps = lastBufferTime_ && fps ? 1000000000.0 / fps : 0.0;\n>>>  \tlastBufferTime_ = metadata.timestamp;\n>>>  \n>>> -\tstd::cout << \"seq: \" << std::setw(6) << std::setfill('0') << metadata.sequence\n>>> -\t\t  << \" bytesused: \" << metadata.planes[0].bytesused\n>>> -\t\t  << \" timestamp: \" << metadata.timestamp\n>>> -\t\t  << \" fps: \" << std::fixed << std::setprecision(2) << fps\n>>> -\t\t  << std::endl;\n>>> +\tqInfo() << \"seq:\" << qSetFieldWidth(6) << qSetPadChar('0')\n>>> +\t\t<< metadata.sequence << Qt::reset\n>>> +\t\t<< \"bytesused:\" << metadata.planes[0].bytesused\n>>> +\t\t<< \"timestamp:\" << metadata.timestamp\n>>> +\t\t<< \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n>>>  \n>>>  \t/* Display the buffer and requeue it to the camera. */\n>>>  \tdisplay(buffer);\n>>> @@ -542,7 +541,7 @@ void MainWindow::queueRequest(FrameBuffer *buffer)\n>>>  {\n>>>  \tRequest *request = camera_->createRequest();\n>>>  \tif (!request) {\n>>> -\t\tstd::cerr << \"Can't create request\" << std::endl;\n>>> +\t\tqWarning() << \"Can't create request\";\n>>>  \t\treturn;\n>>>  \t}\n>>>  \n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CBC4660417\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 16:45:13 +0100 (CET)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 29C4B308;\n\tMon, 23 Mar 2020 16:45:13 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584978313;\n\tbh=x/16Nby1VIaza82fDfUDgFs8GAZLG4A94DBkfRvEUOU=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=NV7f8yCawxnBdir4onL1SOBqEcQ5vChuml6v3JiCmZsNd30112zyQ1OKX7sQHsph9\n\tpeK9jm0vtq4YF1XdD9GGPFgmvGXF8hzLGoI17FLRejTjUz6yKQeUTWjgsxhhzN9foV\n\tUYuc81saaGA7R4R0trIFgdEZd8UoDX2l8lZ9qJ5Y=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>\n\t<20200323142205.28342-13-laurent.pinchart@ideasonboard.com>\n\t<2666c3db-d005-91bb-74f7-d3c1b7dc39c3@ideasonboard.com>\n\t<20200323152736.GK4768@pendragon.ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8\n\tRXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko\n\tlPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55gq\n\t8K8FieAjgjMSxngo/HST8TpFeqI5nVeq0/lqtBRQKumuIqDg+Bkr4L1V/PSB6XgQcOdhtd36\n\tOe9X9dXB8YSNt7VjOcO7BTmFn/Z8r92mSAfHXpb07YJWJosQOQARAQABtDBLaWVyYW4gQmlu\n\tZ2hhbSA8a2llcmFuLmJpbmdoYW1AaWRlYXNvbmJvYXJkLmNvbT6JAlcEEwEKAEECGwMFCwkI\n\tBwIGFQgJCgsCBBYCAwECHgECF4ACGQEWIQSQLdeYP70o/eNy1HqhHkZyEKRh/QUCXWTtygUJ\n\tCyJXZAAKCRChHkZyEKRh/f8dEACTDsbLN2nioNZMw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PU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<6af5566c-362d-75f9-e7f3-fc7ef6d2a1fc@ideasonboard.com>","Date":"Mon, 23 Mar 2020 15:45:09 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.9.1","MIME-Version":"1.0","In-Reply-To":"<20200323152736.GK4768@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 23 Mar 2020 15:45:14 -0000"}},{"id":4223,"web_url":"https://patchwork.libcamera.org/comment/4223/","msgid":"<8f23a0ed-46cc-223c-d446-c161ee1c0c44@ideasonboard.com>","date":"2020-03-23T15:55:42","subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 23/03/2020 14:21, Laurent Pinchart wrote:\n> Replace manual usage of std::cout and std::cerr with the Qt logging\n> facilities. This allows redirection log output if needed, and integrates\n> better with Qt.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nWith the compile issues fixed...\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/qcam/main.cpp        |  8 +++----\n>  src/qcam/main_window.cpp | 45 ++++++++++++++++++++--------------------\n>  2 files changed, 26 insertions(+), 27 deletions(-)\n> \n> diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\n> index 297453914ae9..862d714f467c 100644\n> --- a/src/qcam/main.cpp\n> +++ b/src/qcam/main.cpp\n> @@ -5,11 +5,11 @@\n>   * main.cpp - cam - The libcamera swiss army knife\n>   */\n>  \n> -#include <iostream>\n>  #include <signal.h>\n>  #include <string.h>\n>  \n>  #include <QApplication>\n> +#include <QtDebug>\n>  \n>  #include <libcamera/camera_manager.h>\n>  \n> @@ -18,7 +18,7 @@\n>  \n>  void signalHandler(int signal)\n>  {\n> -\tstd::cout << \"Exiting\" << std::endl;\n> +\tqInfo() << \"Exiting\";\n>  \tqApp->quit();\n>  }\n>  \n> @@ -65,8 +65,8 @@ int main(int argc, char **argv)\n>  \n>  \tret = cm->start();\n>  \tif (ret) {\n> -\t\tstd::cout << \"Failed to start camera manager: \"\n> -\t\t\t  << strerror(-ret) << std::endl;\n> +\t\tqInfo() << \"Failed to start camera manager:\"\n> +\t\t\t<< strerror(-ret);\n>  \t\treturn EXIT_FAILURE;\n>  \t}\n>  \n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index ed8301502fb2..184345b0e2a6 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -8,7 +8,6 @@\n>  #include \"main_window.h\"\n>  \n>  #include <iomanip>\n> -#include <iostream>\n>  #include <string>\n>  #include <sys/mman.h>\n>  \n> @@ -24,6 +23,7 @@\n>  #include <QTimer>\n>  #include <QToolBar>\n>  #include <QToolButton>\n> +#include <QtDebug>\n>  \n>  #include <libcamera/camera_manager.h>\n>  #include <libcamera/version.h>\n> @@ -177,11 +177,11 @@ void MainWindow::switchCamera(int index)\n>  \tconst std::shared_ptr<Camera> &cam = cameras[index];\n>  \n>  \tif (cam->acquire()) {\n> -\t\tstd::cout << \"Failed to acquire camera \" << cam->name() << std::endl;\n> +\t\tqInfo() << \"Failed to acquire camera\" << cam->name().c_str();\n>  \t\treturn;\n>  \t}\n>  \n> -\tstd::cout << \"Switching to camera \" << cam->name() << std::endl;\n> +\tqInfo() << \"Switching to camera\" << cam->name().c_str();\n>  \n>  \t/*\n>  \t * Stop the capture session, release the current camera, replace it with\n> @@ -236,13 +236,12 @@ int MainWindow::openCamera()\n>  \t/* Get and acquire the camera. */\n>  \tcamera_ = cm_->get(cameraName);\n>  \tif (!camera_) {\n> -\t\tstd::cout << \"Camera \" << cameraName << \" not found\"\n> -\t\t\t  << std::endl;\n> +\t\tqInfo() << \"Camera\" << cameraName.c_str() << \"not found\";\n>  \t\treturn -ENODEV;\n>  \t}\n>  \n>  \tif (camera_->acquire()) {\n> -\t\tstd::cout << \"Failed to acquire camera\" << std::endl;\n> +\t\tqInfo() << \"Failed to acquire camera\";\n>  \t\tcamera_.reset();\n>  \t\treturn -EBUSY;\n>  \t}\n> @@ -296,18 +295,18 @@ int MainWindow::startCapture()\n>  \n>  \tCameraConfiguration::Status validation = config_->validate();\n>  \tif (validation == CameraConfiguration::Invalid) {\n> -\t\tstd::cerr << \"Failed to create valid camera configuration\";\n> +\t\tqWarning() << \"Failed to create valid camera configuration\";\n>  \t\treturn -EINVAL;\n>  \t}\n>  \n>  \tif (validation == CameraConfiguration::Adjusted) {\n> -\t\tstd::cout << \"Stream size adjusted to \"\n> -\t\t\t  << cfg.size.toString() << std::endl;\n> +\t\tqInfo() << \"Stream size adjusted to\"\n> +\t\t\t<< cfg.size.toString().c_str();\n>  \t}\n>  \n>  \tret = camera_->configure(config_.get());\n>  \tif (ret < 0) {\n> -\t\tstd::cout << \"Failed to configure camera\" << std::endl;\n> +\t\tqInfo() << \"Failed to configure camera\";\n>  \t\treturn ret;\n>  \t}\n>  \n> @@ -316,7 +315,7 @@ int MainWindow::startCapture()\n>  \tret = viewfinder_->setFormat(cfg.pixelFormat,\n>  \t\t\t\t     QSize(cfg.size.width, cfg.size.height));\n>  \tif (ret < 0) {\n> -\t\tstd::cout << \"Failed to set viewfinder format\" << std::endl;\n> +\t\tqInfo() << \"Failed to set viewfinder format\";\n>  \t\treturn ret;\n>  \t}\n>  \n> @@ -326,7 +325,7 @@ int MainWindow::startCapture()\n>  \tallocator_ = new FrameBufferAllocator(camera_);\n>  \tret = allocator_->allocate(stream);\n>  \tif (ret < 0) {\n> -\t\tstd::cerr << \"Failed to allocate capture buffers\" << std::endl;\n> +\t\tqWarning() << \"Failed to allocate capture buffers\";\n>  \t\treturn ret;\n>  \t}\n>  \n> @@ -334,14 +333,14 @@ int MainWindow::startCapture()\n>  \tfor (const std::unique_ptr<FrameBuffer> &buffer : allocator_->buffers(stream)) {\n>  \t\tRequest *request = camera_->createRequest();\n>  \t\tif (!request) {\n> -\t\t\tstd::cerr << \"Can't create request\" << std::endl;\n> +\t\t\tqWarning() << \"Can't create request\";\n>  \t\t\tret = -ENOMEM;\n>  \t\t\tgoto error;\n>  \t\t}\n>  \n>  \t\tret = request->addBuffer(stream, buffer.get());\n>  \t\tif (ret < 0) {\n> -\t\t\tstd::cerr << \"Can't set buffer for request\" << std::endl;\n> +\t\t\tqWarning() << \"Can't set buffer for request\";\n>  \t\t\tgoto error;\n>  \t\t}\n>  \n> @@ -364,7 +363,7 @@ int MainWindow::startCapture()\n>  \n>  \tret = camera_->start();\n>  \tif (ret) {\n> -\t\tstd::cout << \"Failed to start capture\" << std::endl;\n> +\t\tqInfo() << \"Failed to start capture\";\n>  \t\tgoto error;\n>  \t}\n>  \n> @@ -374,7 +373,7 @@ int MainWindow::startCapture()\n>  \tfor (Request *request : requests) {\n>  \t\tret = camera_->queueRequest(request);\n>  \t\tif (ret < 0) {\n> -\t\t\tstd::cerr << \"Can't queue request\" << std::endl;\n> +\t\t\tqWarning() << \"Can't queue request\";\n>  \t\t\tgoto error_disconnect;\n>  \t\t}\n>  \t}\n> @@ -417,7 +416,7 @@ void MainWindow::stopCapture()\n>  \n>  \tint ret = camera_->stop();\n>  \tif (ret)\n> -\t\tstd::cout << \"Failed to stop capture\" << std::endl;\n> +\t\tqInfo() << \"Failed to stop capture\";\n>  \n>  \tcamera_->requestCompleted.disconnect(this, &MainWindow::requestComplete);\n>  \n> @@ -513,11 +512,11 @@ void MainWindow::processCapture()\n>  \tfps = lastBufferTime_ && fps ? 1000000000.0 / fps : 0.0;\n>  \tlastBufferTime_ = metadata.timestamp;\n>  \n> -\tstd::cout << \"seq: \" << std::setw(6) << std::setfill('0') << metadata.sequence\n> -\t\t  << \" bytesused: \" << metadata.planes[0].bytesused\n> -\t\t  << \" timestamp: \" << metadata.timestamp\n> -\t\t  << \" fps: \" << std::fixed << std::setprecision(2) << fps\n> -\t\t  << std::endl;\n> +\tqInfo() << \"seq:\" << qSetFieldWidth(6) << qSetPadChar('0')\n> +\t\t<< metadata.sequence << Qt::reset\n> +\t\t<< \"bytesused:\" << metadata.planes[0].bytesused\n> +\t\t<< \"timestamp:\" << metadata.timestamp\n> +\t\t<< \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n>  \n>  \t/* Display the buffer and requeue it to the camera. */\n>  \tdisplay(buffer);\n> @@ -542,7 +541,7 @@ void MainWindow::queueRequest(FrameBuffer *buffer)\n>  {\n>  \tRequest *request = camera_->createRequest();\n>  \tif (!request) {\n> -\t\tstd::cerr << \"Can't create request\" << std::endl;\n> +\t\tqWarning() << \"Can't create request\";\n>  \t\treturn;\n>  \t}\n>  \n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1E7EC60417\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 16:55:48 +0100 (CET)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8C288308;\n\tMon, 23 Mar 2020 16:55:47 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584978947;\n\tbh=E0lMh1iDuLkgF9dsXVE0GWWKmAExkBjXLOL6uI434w8=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=DYYA5BsOCSDhh+/ERJCDkSq0ooAyi2fGyTC/u8WIHrgmusveYIqOwPVEMTWE8JfFr\n\tz6jKNpqKD4T7IgwwQ2r4X4pOdzATSHHmM+1fi34T8bwFKtDlB7xBA1B6MWV64kIPC7\n\tJqfbQ/nGlI27eRdlZEjG/vq9HlC73zfENWEUKbkc=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>\n\t<20200323142205.28342-13-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZV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g/\n\tvSj943LUeqEeRnIQpGH9BQJdizzIBQkLSKZiAAoJEKEeRnIQpGH9eYgQAJpjaWNgqNOnMTmD\n\tMJggbwjIotypzIXfhHNCeTkG7+qCDlSaBPclcPGYrTwCt0YWPU2TgGgJrVhYT20ierN8LUvj\n\t6qOPTd+Uk7NFzL65qkh80ZKNBFddx1AabQpSVQKbdcLb8OFs85kuSvFdgqZwgxA1vl4TFhNz\n\tPZ79NAmXLackAx3sOVFhk4WQaKRshCB7cSl+RIng5S/ThOBlwNlcKG7j7W2MC06BlTbdEkUp\n\tECzuuRBv8wX4OQl+hbWbB/VKIx5HKlLu1eypen/5lNVzSqMMIYkkZcjV2SWQyUGxSwq0O/sx\n\tS0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j\n\tsbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8\n\tpQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc\n\tMW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<8f23a0ed-46cc-223c-d446-c161ee1c0c44@ideasonboard.com>","Date":"Mon, 23 Mar 2020 15:55:42 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.9.1","MIME-Version":"1.0","In-Reply-To":"<20200323142205.28342-13-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 12/21] qcam: Use Qt qInfo() and\n\tqWarning() logging facilities","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 23 Mar 2020 15:55:48 -0000"}}]