Csound Csound-dev Csound-tekno Search About

[Csnd-dev] CsoundQt and qDebug

Date2016-12-26 20:21
FromMichael Gogins
Subject[Csnd-dev] CsoundQt and qDebug
This is mainly for Tarmo, I have made extensive changes to the usage
of qDebug in CsoundQt in the qthtml branch. I probably should have
created a branch for these changes, but I went ahead and committed
them and pushed them. If you don't like them, revert the changes in
the qthtml branchg using "git revert
8c38db562fb61dcf7fa9d150d380c952a5f90305". But if you think this is a
good idea I will merge these changes into the develop branch.

 I set up this at the top of main():

    // Set a global template for ALL qDebug messages.
    qSetMessagePattern("[%{time yyyy-MM-dd h:mm:ss.zzz}
%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}][%{file}:%{line}
%{function}] %{message}");

Thereafter, I removed all __FUNCTION__, __LINE__, etc. macros and also
removed all function names from qDebug output. The result is
consistent formatting of messages with timestamp, filename, line
number, and function name in addition to any other diagnostic
messages, for example:

[2016-12-26 15:06:33.816 D][src\csoundhtmlview.cpp:149
CsoundHtmlView::load] Setting JavaScript object on load.
[2016-12-26 15:06:34.163 D][src\qutecsound.cpp:5144
CsoundQt::setWidgetPanelGeometry] Warning: width invalid.
[2016-12-26 15:06:34.163 D][src\qutecsound.cpp:5148
CsoundQt::setWidgetPanelGeometry] Warning: height invalid.
[2016-12-26 15:06:34.169 D][src\csoundhtmlview.cpp:82 CsoundHtmlView::load]
[2016-12-26 15:06:34.177 D][src\csoundhtmlview.cpp:235
CsoundHtmlView::loadFromUrl]
[2016-12-26 15:06:34.179 D][src\csoundhtmlview.cpp:149
CsoundHtmlView::load] Setting JavaScript object on load.
[2016-12-26 15:06:36.611 D][src\qutecsound.cpp:5144
CsoundQt::setWidgetPanelGeometry] Warning: width invalid.
[2016-12-26 15:06:36.611 D][src\qutecsound.cpp:5148
CsoundQt::setWidgetPanelGeometry] Warning: height invalid.
[2016-12-26 15:06:36.616 D][src\csoundhtmlview.cpp:82 CsoundHtmlView::load]
[2016-12-26 15:06:36.624 D][src\csoundhtmlview.cpp:235
CsoundHtmlView::loadFromUrl]
[2016-12-26 15:06:36.626 D][src\csoundhtmlview.cpp:149
CsoundHtmlView::load] Setting JavaScript object on load.
[2016-12-26 15:06:37.859 W][unknown:0 unknown] Remote debugging server
started successfully. Try pointing a Chromium-based browser to
http://127.0.0.1:34711

More work could be done here, e.g. using qWarning, qError, and qInfo
as well as qDebug, which would allow the DEBUG macro or an environment
variable to control the level of diagnostic messages printed by
CsoundQt.

The HTML5 features based on QWebEngine are working on Windows now with
Qt SDK 5.8.0 rc. I am still working on getting Csound pieces in the
form of .html files (not .csd files) to work in CsoundQt. When I have
done that I will post a hotfix Windows installer to the GitHub
releases.

Best,
Mike


-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com

Date2016-12-26 22:45
FromTarmo Johannes
SubjectRe: [Csnd-dev] CsoundQt and qDebug
Hi Michael,

Thanks for this!
I think the qDebug formatting is good thing but sometimes less output is better for reading, so let's think for a while.
I dowloaded Qt5.8 RC and built qtmhtl branch on Linux, works well, I hope to test on OSX also soon.
Probably I get more back to CsoundQt in January to continue with html support and other features.

Best!
Tarmo

26.12.2016 22:21 kirjutas kuupäeval "Michael Gogins" <michael.gogins@gmail.com>:
This is mainly for Tarmo, I have made extensive changes to the usage
of qDebug in CsoundQt in the qthtml branch. I probably should have
created a branch for these changes, but I went ahead and committed
them and pushed them. If you don't like them, revert the changes in
the qthtml branchg using "git revert
8c38db562fb61dcf7fa9d150d380c952a5f90305". But if you think this is a
good idea I will merge these changes into the develop branch.

 I set up this at the top of main():

    // Set a global template for ALL qDebug messages.
    qSetMessagePattern("[%{time yyyy-MM-dd h:mm:ss.zzz}
%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}][%{file}:%{line}
%{function}] %{message}");

Thereafter, I removed all __FUNCTION__, __LINE__, etc. macros and also
removed all function names from qDebug output. The result is
consistent formatting of messages with timestamp, filename, line
number, and function name in addition to any other diagnostic
messages, for example:

[2016-12-26 15:06:33.816 D][src\csoundhtmlview.cpp:149
CsoundHtmlView::load] Setting JavaScript object on load.
[2016-12-26 15:06:34.163 D][src\qutecsound.cpp:5144
CsoundQt::setWidgetPanelGeometry] Warning: width invalid.
[2016-12-26 15:06:34.163 D][src\qutecsound.cpp:5148
CsoundQt::setWidgetPanelGeometry] Warning: height invalid.
[2016-12-26 15:06:34.169 D][src\csoundhtmlview.cpp:82 CsoundHtmlView::load]
[2016-12-26 15:06:34.177 D][src\csoundhtmlview.cpp:235
CsoundHtmlView::loadFromUrl]
[2016-12-26 15:06:34.179 D][src\csoundhtmlview.cpp:149
CsoundHtmlView::load] Setting JavaScript object on load.
[2016-12-26 15:06:36.611 D][src\qutecsound.cpp:5144
CsoundQt::setWidgetPanelGeometry] Warning: width invalid.
[2016-12-26 15:06:36.611 D][src\qutecsound.cpp:5148
CsoundQt::setWidgetPanelGeometry] Warning: height invalid.
[2016-12-26 15:06:36.616 D][src\csoundhtmlview.cpp:82 CsoundHtmlView::load]
[2016-12-26 15:06:36.624 D][src\csoundhtmlview.cpp:235
CsoundHtmlView::loadFromUrl]
[2016-12-26 15:06:36.626 D][src\csoundhtmlview.cpp:149
CsoundHtmlView::load] Setting JavaScript object on load.
[2016-12-26 15:06:37.859 W][unknown:0 unknown] Remote debugging server
started successfully. Try pointing a Chromium-based browser to
http://127.0.0.1:34711

More work could be done here, e.g. using qWarning, qError, and qInfo
as well as qDebug, which would allow the DEBUG macro or an environment
variable to control the level of diagnostic messages printed by
CsoundQt.

The HTML5 features based on QWebEngine are working on Windows now with
Qt SDK 5.8.0 rc. I am still working on getting Csound pieces in the
form of .html files (not .csd files) to work in CsoundQt. When I have
done that I will post a hotfix Windows installer to the GitHub
releases.

Best,
Mike


-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com