summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2014-07-25 01:26:20 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2014-07-25 01:26:20 +0200
commit5a6666121b0415a743c1ca4b533c6b4a5999b10f (patch)
tree378ff64f833ae585396e27e4fb7b31428f51871c /src/control
parentc1c315cdce0a9e35b21b933579ca0bc70507a491 (diff)
parent2acf167ceabe00c743370aed281e3328f6f74090 (diff)
Merge remote-tracking branch 'upstream/master' into super-softtakeover
Conflicts: src/effects/effectparameterslot.cpp src/effects/effectparameterslot.h src/effects/effectslot.cpp src/effects/effectslot.h
Diffstat (limited to 'src/control')
-rw-r--r--src/control/control.cpp17
-rw-r--r--src/control/control.h7
2 files changed, 23 insertions, 1 deletions
diff --git a/src/control/control.cpp b/src/control/control.cpp
index 5cdf32f4c2..8ebdd4c408 100644
--- a/src/control/control.cpp
+++ b/src/control/control.cpp
@@ -9,7 +9,9 @@
// Static member variable definition
ConfigObject<ConfigValue>* ControlDoublePrivate::s_pUserConfig = NULL;
QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> > ControlDoublePrivate::s_qCOHash;
+QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> > ControlDoublePrivate::s_qCOAliasHash;
QMutex ControlDoublePrivate::s_qCOHashMutex;
+QMutex ControlDoublePrivate::s_qCOAliasHashMutex;
/*
ControlDoublePrivate::ControlDoublePrivate()
@@ -77,12 +79,20 @@ ControlDoublePrivate::~ControlDoublePrivate() {
}
// static
+void ControlDoublePrivate::insertAlias(const ConfigKey& alias, const ConfigKey& key) {
+ QSharedPointer<ControlDoublePrivate> pControl = getControl(key);
+ QMutexLocker locker(&s_qCOAliasHashMutex);
+ s_qCOAliasHash.insert(alias, pControl);
+}
+
+// static
QSharedPointer<ControlDoublePrivate> ControlDoublePrivate::getControl(
const ConfigKey& key, bool warn, ControlObject* pCreatorCO,
bool bIgnoreNops, bool bTrack, bool bPersist) {
QMutexLocker locker(&s_qCOHashMutex);
QSharedPointer<ControlDoublePrivate> pControl;
QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> >::const_iterator it = s_qCOHash.find(key);
+
if (it != s_qCOHash.end()) {
if (pCreatorCO) {
if (warn) {
@@ -91,7 +101,14 @@ QSharedPointer<ControlDoublePrivate> ControlDoublePrivate::getControl(
} else {
pControl = it.value();
}
+ } else {
+ QMutexLocker locker(&s_qCOAliasHashMutex);
+ QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> >::const_iterator it = s_qCOAliasHash.find(key);
+ if (it != s_qCOAliasHash.end()) {
+ pControl = it.value();
+ }
}
+
locker.unlock();
if (pControl == NULL) {
diff --git a/src/control/control.h b/src/control/control.h
index 7dbd62c5a9..5c0088b27b 100644
--- a/src/control/control.h
+++ b/src/control/control.h
@@ -25,6 +25,8 @@ class ControlDoublePrivate : public QObject {
s_pUserConfig = pConfig;
}
+ static void insertAlias(const ConfigKey& alias, const ConfigKey& key);
+
// Gets the ControlDoublePrivate matching the given ConfigKey. If bCreate
// is true, allocates a new ControlDoublePrivate for the ConfigKey if one
// does not exist.
@@ -66,7 +68,7 @@ class ControlDoublePrivate : public QObject {
// Set the behavior to be used when setting values and translating between
// parameter and value space. Returns the previously set behavior (if any).
- // The caller must nut delete the behavior at any time. The memory is managed
+ // The caller must not delete the behavior at any time. The memory is managed
// by this function.
void setBehavior(ControlNumericBehavior* pBehavior);
@@ -167,9 +169,12 @@ class ControlDoublePrivate : public QObject {
// Hash of ControlDoublePrivate instantiations.
static QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> > s_qCOHash;
+ static QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> > s_qCOAliasHash;
// Mutex guarding access to the ControlDoublePrivate hash.
static QMutex s_qCOHashMutex;
+ // Mutex guarding access to the ControlDoublePrivate aliases hash.
+ static QMutex s_qCOAliasHashMutex;
};