comparison plugin/PluginPathSetter.h @ 1472:5d7057af0c68 plugin-path-config

Add class to get/set/remember the plugin path for each plugin type
author Chris Cannam
date Fri, 25 May 2018 16:04:42 +0100
parents
children f52bf66b9096
comparison
equal deleted inserted replaced
1471:85e9b7b31a8d 1472:5d7057af0c68
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #ifndef SV_PLUGIN_PATH_SETTER_H
16 #define SV_PLUGIN_PATH_SETTER_H
17
18 #include <QString>
19 #include <QStringList>
20 #include <QMutex>
21
22 #include <map>
23
24 class PluginPathSetter
25 {
26 public:
27 /// Text used to identify a plugin type, e.g. "LADSPA", "Vamp"
28 typedef QString PluginTypeLabel;
29
30 struct PathConfig {
31 QStringList directories;
32 QString envVariable; // e.g. "LADSPA_PATH" etc
33 bool useEnvVariable; // true if env variable overrides directories list
34 };
35
36 typedef std::map<PluginTypeLabel, PathConfig> Paths;
37
38 /// Return paths arising from environment variables only, without
39 /// any user-defined preferences
40 static Paths getDefaultPaths();
41
42 /// Return paths arising from user settings + environment
43 /// variables as appropriate
44 static Paths getPaths();
45
46 /// Save the given paths to the settings
47 static void savePathSettings(Paths paths);
48
49 /// Update *_PATH environment variables from the settings, on
50 /// application startup
51 static void setEnvironmentVariables();
52
53 private:
54 static Paths m_defaultPaths;
55 static QMutex m_mutex;
56 };
57
58 #endif