comparison widgets/PluginPathConfigurator.cpp @ 1294:9f9a7edd7d89 plugin-path-config

Show value of environment variable; populate for last plugin type by default (as that happens to be Vamp)
author Chris Cannam
date Mon, 04 Jun 2018 15:44:57 +0100
parents 6dd15b5c14f9
children 11888b7e193d
comparison
equal deleted inserted replaced
1293:6dd15b5c14f9 1294:9f9a7edd7d89
127 { 127 {
128 m_list->clear(); 128 m_list->clear();
129 129
130 if (m_paths.empty()) return; 130 if (m_paths.empty()) return;
131 131
132 populateFor(m_paths.begin()->first, -1); 132 populateFor(m_paths.rbegin()->first, -1);
133 } 133 }
134 134
135 void 135 void
136 PluginPathConfigurator::populateFor(QString type, int makeCurrent) 136 PluginPathConfigurator::populateFor(QString type, int makeCurrent)
137 { 137 {
138 QString envVariable = m_paths.at(type).envVariable; 138 QString envVariable = m_paths.at(type).envVariable;
139 bool useEnvVariable = m_paths.at(type).useEnvVariable; 139 bool useEnvVariable = m_paths.at(type).useEnvVariable;
140 QString envVarValue =
141 PluginPathSetter::getOriginalEnvironmentValue(envVariable);
142 QString currentValueRubric;
143 if (envVarValue == QString()) {
144 currentValueRubric = tr("(Variable is currently unset)");
145 } else {
146 if (envVarValue.length() > 100) {
147 QString envVarStart = envVarValue.left(95);
148 currentValueRubric = tr("(Current value begins: \"%1 ...\")")
149 .arg(envVarStart);
150 } else {
151 currentValueRubric = tr("(Currently set to: \"%1\")")
152 .arg(envVarValue);
153 }
154 }
140 m_envOverride->setText 155 m_envOverride->setText
141 (tr("Allow the %1 environment variable to take priority over this") 156 (tr("Allow the %1 environment variable to take priority over this\n%2")
142 .arg(envVariable)); 157 .arg(envVariable)
158 .arg(currentValueRubric));
143 m_envOverride->setCheckState(useEnvVariable ? Qt::Checked : Qt::Unchecked); 159 m_envOverride->setCheckState(useEnvVariable ? Qt::Checked : Qt::Unchecked);
144 160
145 m_list->clear(); 161 m_list->clear();
146 162
147 for (int i = 0; i < m_pluginTypeSelector->count(); ++i) { 163 for (int i = 0; i < m_pluginTypeSelector->count(); ++i) {
148 if (type == m_pluginTypeSelector->itemText(i)) { 164 if (type == m_pluginTypeSelector->itemText(i)) {
165 m_pluginTypeSelector->blockSignals(true);
149 m_pluginTypeSelector->setCurrentIndex(i); 166 m_pluginTypeSelector->setCurrentIndex(i);
167 m_pluginTypeSelector->blockSignals(false);
150 } 168 }
151 } 169 }
152 170
153 QStringList path = m_paths.at(type).directories; 171 QStringList path = m_paths.at(type).directories;
154 172