OTHER: Get values for keys matching RegExp

This commit is contained in:
Thomas Frauendorfer 2008-12-03 12:47:46 +01:00
parent 92c7c30c49
commit c6b75de31d
3 changed files with 18 additions and 1 deletions

View file

@ -48,6 +48,20 @@ XConfig::value_get (QString key)
return m_config_cache.value (key);
}
QStringList
XConfig::values_get (QRegExp key)
{
QStringList ret;
QHash < QString, QString >::ConstIterator it = m_config_cache.constBegin ();
while (it != m_config_cache.constEnd ()) {
if (key.exactMatch (it.key ())) {
ret.append (it.value ());
}
++it;
}
return ret;
}
bool
XConfig::value_set (QString key, QString val)
{

View file

@ -24,7 +24,9 @@ namespace Xmms {
#include <QObject>
#include <QHash>
#include <QRegExp>
#include <QString>
#include <QStringList>
class XConfig : public QObject
{
@ -33,6 +35,7 @@ class XConfig : public QObject
XConfig (XClient *parent);
QString value_get (QString key);
QStringList values_get (QRegExp key = QRegExp (".*"));
bool value_set (QString key, QString value);
bool value_register (QString key, QString defval);

View file

@ -43,7 +43,7 @@ BaseWindow::hideEvent (QHideEvent *event)
return;
}
if ((objectName ().isEmpty ()) | (objectName () == "MainWindow")) {
if ((objectName ().isEmpty ()) || (objectName () == "MainWindow")) {
event->ignore ();
return;
}