[PATCH] MarbleDebug: don't use a class extending QIODevice as a null device

Thiago Macieira thiago at macieira.org
Mon Apr 17 14:18:25 PDT 2017

On segunda-feira, 17 de abril de 2017 14:10:28 PDT Lubomir I. Ivanov wrote:
> i guess we could just do a:
> void MarbleDebug::setEnabled(bool enabled)
> {
>     Marble::loggingCategory.setEnabled(enabled);
>     MarbleDebug::m_enabled = enabled;
> }

I'd go a little further and drop the m_enabled variable completely. You don't 
need it, let the bit in the QLoggingCategory variable keep the state.

You'd have:

namespace MarbleDebug {
Q_LOGGING_CATEGORY(category, "marble", QtWarningMsg)

void setEnabled(bool enabled)
    category.setEnabled(QtDebugMsg, enabled);

bool isEnabled()		// do you even need this function?
	return category.isDebugEnabled();
} //namespace MarbleDebug

This changes to the MarbleDebug namespace too.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

More information about the subsurface mailing list