Chris@1178
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@1178
|
2
|
Chris@1178
|
3 /*
|
Chris@1178
|
4 Sonic Visualiser
|
Chris@1178
|
5 An audio file viewer and annotation editor.
|
Chris@1178
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@1178
|
7
|
Chris@1178
|
8 This program is free software; you can redistribute it and/or
|
Chris@1178
|
9 modify it under the terms of the GNU General Public License as
|
Chris@1178
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@1178
|
11 License, or (at your option) any later version. See the file
|
Chris@1178
|
12 COPYING included with this distribution for more information.
|
Chris@1178
|
13 */
|
Chris@1178
|
14
|
Chris@1178
|
15 #ifndef PLUGIN_SCAN_H
|
Chris@1178
|
16 #define PLUGIN_SCAN_H
|
Chris@1178
|
17
|
Chris@1178
|
18 #include <QStringList>
|
Chris@1246
|
19 #include <QMutex>
|
Chris@1241
|
20 #include <vector>
|
Chris@1246
|
21 #include <map>
|
Chris@1178
|
22
|
Chris@1474
|
23 class KnownPluginCandidates;
|
Chris@1178
|
24
|
Chris@1180
|
25 class PluginScan
|
Chris@1178
|
26 {
|
Chris@1178
|
27 public:
|
Chris@1178
|
28 static PluginScan *getInstance();
|
Chris@1178
|
29
|
Chris@1249
|
30 /**
|
Chris@1249
|
31 * Carry out startup scan of available plugins. Do not call
|
Chris@1249
|
32 * getCandidateLibrariesFor() unless this has been called and
|
Chris@1249
|
33 * scanSucceeded() is returning true.
|
Chris@1249
|
34 */
|
Chris@1241
|
35 void scan();
|
Chris@1179
|
36
|
Chris@1249
|
37 /**
|
Chris@1249
|
38 * Return true if scan() completed successfully. If the scan
|
Chris@1249
|
39 * failed, consider using the normal plugin path to load any
|
Chris@1249
|
40 * available plugins (as if they had all been found to be
|
Chris@1249
|
41 * loadable) rather than rejecting all of them -- i.e. consider
|
Chris@1249
|
42 * falling back on the behaviour of code from before the scan
|
Chris@1249
|
43 * logic was added.
|
Chris@1249
|
44 */
|
Chris@1179
|
45 bool scanSucceeded() const;
|
Chris@1178
|
46
|
Chris@1180
|
47 enum PluginType {
|
Chris@1429
|
48 VampPlugin,
|
Chris@1429
|
49 LADSPAPlugin,
|
Chris@1429
|
50 DSSIPlugin
|
Chris@1180
|
51 };
|
Chris@1246
|
52 struct Candidate {
|
Chris@1249
|
53 QString libraryPath; // full path, not just soname
|
Chris@1249
|
54 QString helperTag; // identifies the helper that found it
|
Chris@1249
|
55 // (see HelperExecPath)
|
Chris@1246
|
56 };
|
Chris@1249
|
57
|
Chris@1249
|
58 /**
|
Chris@1249
|
59 * Return the candidate plugin libraries of the given type that
|
Chris@1249
|
60 * were found by helpers during the startup scan.
|
Chris@1249
|
61 *
|
Chris@1249
|
62 * This could return an empty list for two reasons: the scan
|
Chris@1249
|
63 * succeeded but no libraries were found; or the scan failed. Call
|
Chris@1249
|
64 * scanSucceeded() to distinguish between them.
|
Chris@1249
|
65 */
|
Chris@1246
|
66 QList<Candidate> getCandidateLibrariesFor(PluginType) const;
|
Chris@1178
|
67
|
Chris@1178
|
68 QString getStartupFailureReport() const;
|
Chris@1178
|
69
|
Chris@1178
|
70 private:
|
Chris@1178
|
71 PluginScan();
|
Chris@1178
|
72 ~PluginScan();
|
Chris@1241
|
73
|
Chris@1241
|
74 void clear();
|
Chris@1246
|
75
|
Chris@1246
|
76 mutable QMutex m_mutex; // while scanning; definitely can't multi-thread this
|
Chris@1241
|
77
|
Chris@1474
|
78 std::map<QString, KnownPluginCandidates *> m_kp; // tag -> KnownPlugins client
|
Chris@1179
|
79 bool m_succeeded;
|
Chris@1180
|
80
|
Chris@1180
|
81 class Logger;
|
Chris@1180
|
82 Logger *m_logger;
|
Chris@1178
|
83 };
|
Chris@1178
|
84
|
Chris@1178
|
85 #endif
|