1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-25 17:25:10 +03:00

[Companion][Simulator] Misc. minor fixes:

Fix Qt < 5.3 compat. issue in DebugOutput;
  AppDebugMessageHandler: Filter out verbose QPainter warnings on Linux Qt < 5.3; Do not return any instance if disabled entirely;
  Fix style sheet for simulator radio background.
This commit is contained in:
Max Paperno 2017-03-06 06:28:33 -05:00
parent 0e906162e1
commit 6c493fddd9
3 changed files with 17 additions and 6 deletions

View file

@ -33,8 +33,10 @@ AppDebugMessageHandler::AppDebugMessageHandler(QObject * parent) :
AppDebugMessageHandler * AppDebugMessageHandler::instance()
{
static AppDebugMessageHandler * _instance = NULL;
#if APP_DBG_HANDLER_ENABLE
if(_instance == NULL && !qApp->closingDown())
_instance = new AppDebugMessageHandler(qApp); // Ensure this object is cleaned up when the QApplication exits.
#endif
return _instance;
}
@ -55,9 +57,7 @@ void AppDebugMessageHandler::setShowFunctionDeclarations(bool showFunctionDeclar
void AppDebugMessageHandler::installAppMessageHandler()
{
#if APP_DBG_HANDLER_ENABLE
m_defaultHandler = qInstallMessageHandler(g_appDebugMessageHandler);
#endif
}
void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogContext & context, const QString & msg)
@ -73,6 +73,12 @@ void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogCon
if (lvl < m_appDebugOutputLevel && type != QtFatalMsg)
return;
#if defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
// Filter out lots of QPainter warnings from undocked QDockWidgets... hackish but effective (only workaround found so far)
if (lvl == 2 && QString(context.function).contains("QPainter::"))
return;
#endif
QString msgPattern = QString("[%1] ").arg(symbols[type]);
if (m_showSourcePath) {
@ -101,7 +107,7 @@ void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogCon
msgPattern.replace("%{message}", msg);
if (!m_showFunctionDeclarations) {
QString func = context.function;
msgPattern.replace(QString("%{function}"), func.replace(m_functionFilter, "\\1)"));
msgPattern.replace("%{function}", func.replace(m_functionFilter, "\\1)"));
}
#endif

View file

@ -101,8 +101,13 @@ DebugOutput::DebugOutput(QWidget * parent, SimulatorInterface *simulator):
connect(ui->actionToggleFilter, &QAction::toggled, this, &DebugOutput::onFilterToggled);
connect(ui->filterText, &QComboBox::currentTextChanged, this, &DebugOutput::onFilterTextChanged);
if (AppDebugMessageHandler::instance())
if (AppDebugMessageHandler::instance()) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0)) // https://bugreports.qt.io/browse/QTBUG-36119
connect(AppDebugMessageHandler::instance(), SIGNAL(messageOutput(quint8,QString,QMessageLogContext)), this, SLOT(onAppDebugMessage(quint8,QString,QMessageLogContext)));
#else
connect(AppDebugMessageHandler::instance(), &AppDebugMessageHandler::messageOutput, this, &DebugOutput::onAppDebugMessage);
#endif
}
// send firmware TRACE events to our data collector
m_simulator->installTraceHook(firmwareTraceCb);

View file

@ -52,11 +52,11 @@ QSplitter::handle:hover {
*/
/* default radio "case" background */
SimulatorDialog > QWidget {
SimulatorWidget > QWidget {
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(242, 242, 242, 255), stop:0.757062 rgba(222, 220, 220, 255), stop:1 rgba(232, 230, 230, 255));
}
/* radio LCD/controls area under "case" */
SimulatorDialog #radioUiWidget {
SimulatorWidget #radioUiWidget {
background-color: qlineargradient(spread:reflect, x1:0.22, y1:0, x2:0.55065, y2:0.54, stop:0 rgba(7, 7, 7, 250), stop:0.864407 rgba(66, 66, 66, 255));
margin: 0;
padding: 0;