MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / updatePresetList

Method updatePresetList

src/interface/TrayIcon.cpp:145–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void TrayIcon::updatePresetList()
146{
147 if (tray_presetMenu != nullptr)
148 {
149 tray_presetMenu->clear();
150 QString path = AppConfig::instance().getPath("presets");
151
152 QDir dir(path);
153
154 if (!dir.exists())
155 {
156 dir.mkpath(".");
157 }
158
159 QStringList nameFilter("*.conf");
160 QStringList files = dir.entryList(nameFilter);
161
162 if (files.count() < 1)
163 {
164 QAction *noPresets = new QAction(tr("No presets found"));
165 noPresets->setEnabled(false);
166 tray_presetMenu->addAction(noPresets);
167 }
168 else
169 {
170 for (int i = 0; i < files.count(); i++)
171 {
172 // Strip extensions
173 QFileInfo fi(files[i]);
174 files[i] = fi.completeBaseName();
175
176 // Add entry
177 QAction *newEntry = new QAction(files[i]);
178 connect(newEntry, &QAction::triggered, this, [this, files, i]()
179 {
180 emit loadPreset(AppConfig::instance().getPath(QString("presets/%1.conf").arg(files[i])));
181 });
182
183 tray_presetMenu->addAction(newEntry);
184 }
185 }
186 }
187}
188
189void TrayIcon::updateConvolverList()
190{

Callers

nothing calls this directly

Calls 7

connectFunction · 0.85
countMethod · 0.80
setEnabledMethod · 0.80
QStringClass · 0.50
clearMethod · 0.45
getPathMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected