OTHER: Get values for keys matching RegExp
This commit is contained in:
parent
92c7c30c49
commit
c6b75de31d
3 changed files with 18 additions and 1 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ BaseWindow::hideEvent (QHideEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((objectName ().isEmpty ()) | (objectName () == "MainWindow")) {
|
||||
if ((objectName ().isEmpty ()) || (objectName () == "MainWindow")) {
|
||||
event->ignore ();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue