mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-10 04:15:51 +00:00
add methods to dbus interface
This commit is contained in:
@ -35,7 +35,58 @@ AWDBusAdaptor::~AWDBusAdaptor()
|
||||
}
|
||||
|
||||
|
||||
qlonglong AWDBusAdaptor::whoAmI() const
|
||||
QString AWDBusAdaptor::Info(const QString key) const
|
||||
{
|
||||
return m_plugin->infoByKey(key);
|
||||
}
|
||||
|
||||
|
||||
QStringList AWDBusAdaptor::Keys(const QString regexp) const
|
||||
{
|
||||
return m_plugin->dictKeys(true, regexp);
|
||||
}
|
||||
|
||||
|
||||
QString AWDBusAdaptor::Value(const QString key) const
|
||||
{
|
||||
return m_plugin->valueByKey(key);
|
||||
}
|
||||
|
||||
|
||||
qlonglong AWDBusAdaptor::WhoAmI() const
|
||||
{
|
||||
return reinterpret_cast<qlonglong>(m_plugin);
|
||||
}
|
||||
|
||||
|
||||
void AWDBusAdaptor::SetLogLevel(const QString what, const int level)
|
||||
{
|
||||
qCDebug(LOG_DBUS) << "Set log level" << level << "for" << what;
|
||||
|
||||
if (level >= m_logLevels.count()) {
|
||||
qCDebug(LOG_DBUS) << "Invalid logging level" << level
|
||||
<< "should be less than" << m_logLevels.count();
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto lev : m_logLevels)
|
||||
SetLogLevel(what, lev, m_logLevels.indexOf(lev) >= level);
|
||||
}
|
||||
|
||||
|
||||
void AWDBusAdaptor::SetLogLevel(const QString what, const QString level,
|
||||
const bool enabled)
|
||||
{
|
||||
qCDebug(LOG_DBUS) << "Set log level" << level << "enabled" << enabled
|
||||
<< "for" << what;
|
||||
|
||||
if (!m_logLevels.contains(level)) {
|
||||
qCDebug(LOG_DBUS) << "Invalid logging level" << level << "should be in"
|
||||
<< m_logLevels;
|
||||
return;
|
||||
}
|
||||
|
||||
QString state = enabled ? QString("true") : QString("false");
|
||||
QLoggingCategory::setFilterRules(
|
||||
QString("%1.%2=%3").arg(what).arg(level).arg(state));
|
||||
}
|
||||
|
Reference in New Issue
Block a user