mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
Make settings trace output human readable
This commit is contained in:
parent
477b99ea45
commit
b12e9004bb
37
main.cpp
37
main.cpp
@ -28,6 +28,10 @@
|
|||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QBitArray>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
#include "ExceptionCatchingApplication.hpp"
|
#include "ExceptionCatchingApplication.hpp"
|
||||||
#include "Logger.hpp"
|
#include "Logger.hpp"
|
||||||
@ -68,23 +72,24 @@ namespace
|
|||||||
|
|
||||||
void safe_stream_QVariant (boost::log::record_ostream& os, QVariant const& v)
|
void safe_stream_QVariant (boost::log::record_ostream& os, QVariant const& v)
|
||||||
{
|
{
|
||||||
if (QMetaType::QByteArray == static_cast<QMetaType::Type> (v.type ()))
|
switch (static_cast<QMetaType::Type> (v.type ()))
|
||||||
{
|
|
||||||
auto const& a =v.toByteArray ();
|
|
||||||
std::ios::fmtflags f (os.flags ());
|
|
||||||
os << std::hex << std::showbase;
|
|
||||||
for (auto p = a.begin (); p != a.end (); )
|
|
||||||
{
|
|
||||||
os << static_cast<int8_t> (*p++);
|
|
||||||
if (p != a.end ())
|
|
||||||
{
|
|
||||||
os << ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
os.flags (f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
case QMetaType::QByteArray:
|
||||||
|
os << "0x" << v.toByteArray ().toHex (':').toStdString ();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QMetaType::QBitArray:
|
||||||
|
{
|
||||||
|
auto const& bits = v.toBitArray ();
|
||||||
|
os << "0b";
|
||||||
|
for (int i = 0; i < bits.size (); ++ i)
|
||||||
|
{
|
||||||
|
os << (bits[i] ? '1' : '0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
os << v.toString ();
|
os << v.toString ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user