PluginScan.h
Go to the documentation of this file.
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 PLUGIN_SCAN_H
16 #define PLUGIN_SCAN_H
17 
18 #include <QStringList>
19 #include <QMutex>
20 #include <vector>
21 #include <map>
22 
23 #ifdef HAVE_PLUGIN_CHECKER_HELPER
24 #include "checker/knownplugincandidates.h"
25 #else
27 #endif
28 
30 {
31 public:
32  static PluginScan *getInstance();
33 
39  void scan();
40 
49  bool scanSucceeded() const;
50 
51  enum PluginType {
54  DSSIPlugin
55  };
56  struct Candidate {
57  QString libraryPath; // full path, not just soname
58  QString helperTag; // identifies the helper that found it
59  // (see HelperExecPath)
60  };
61 
70  QList<Candidate> getCandidateLibrariesFor(PluginType) const;
71 
72  QString getStartupFailureReport() const;
73 
74 private:
75  PluginScan();
76  ~PluginScan();
77 
78  void clear();
79 
80 #ifdef HAVE_PLUGIN_CHECKER_HELPER
81  QString formatFailureReport(QString helperTag,
82  std::vector<PluginCandidates::FailureRec>)
83  const;
84 #endif
85 
86  mutable QMutex m_mutex; // while scanning; definitely can't multi-thread this
87 
88  std::map<QString, KnownPluginCandidates *> m_kp; // tag -> KnownPlugins client
90 
91  class Logger;
93 };
94 
95 #endif
QMutex m_mutex
Definition: PluginScan.h:86
std::map< QString, KnownPluginCandidates * > m_kp
Definition: PluginScan.h:88
bool m_succeeded
Definition: PluginScan.h:89
Logger * m_logger
Definition: PluginScan.h:91