backport more fixes
[alioth/musescore.git] / debian / patches / backports / plugin-qml.diff
1 Origin: upstream, commit:ec7d9a85d79b45c558a4230ef35251122167064e
2 Author: Dmitri Ovodok <dmitrio95@yandex.ru>
3 Description: fix #275268: don't list non-plugin QML files in Plugin Manager
4
5 --- a/mscore/musescore.h
6 +++ b/mscore/musescore.h
7 @@ -908,7 +908,7 @@ extern bool saveXml(Score*, QIODevice*);
8  extern bool saveXml(Score*, const QString& name);
9  
10  struct PluginDescription;
11 -extern void collectPluginMetaInformation(PluginDescription*);
12 +extern bool collectPluginMetaInformation(PluginDescription*);
13  extern QString getSharePath();
14  
15  extern Score::FileError importMidi(MasterScore*, const QString& name);
16 --- a/mscore/plugin/mscorePlugins.cpp
17 +++ b/mscore/plugin/mscorePlugins.cpp
18 @@ -381,8 +381,8 @@ bool MuseScore::loadPlugin(const QString
19                    PluginDescription* p = new PluginDescription;
20                    p->path = path;
21                    p->load = false;
22 -                  collectPluginMetaInformation(p);
23 -                  registerPlugin(p);
24 +                  if (collectPluginMetaInformation(p))
25 +                        registerPlugin(p);
26                    result = true;
27                    }
28              }
29 @@ -478,9 +478,11 @@ void MuseScore::pluginTriggered(QString
30  
31  //---------------------------------------------------------
32  //   collectPluginMetaInformation
33 +///   returns false if loading a plugin for the given
34 +///   description has failed
35  //---------------------------------------------------------
36  
37 -void collectPluginMetaInformation(PluginDescription* d)
38 +bool collectPluginMetaInformation(PluginDescription* d)
39        {
40        qDebug("Collect meta for <%s>", qPrintable(d->path));
41  
42 @@ -491,14 +493,16 @@ void collectPluginMetaInformation(Plugin
43              foreach(QQmlError e, component.errors()) {
44                    qDebug("   line %d: %s", e.line(), qPrintable(e.description()));
45                    }
46 -            return;
47 +            return false;
48              }
49        QmlPlugin* item = qobject_cast<QmlPlugin*>(obj);
50 +      const bool isQmlPlugin = bool(item);
51        if (item) {
52              d->version      = item->version();
53              d->description  = item->description();
54              }
55        delete obj;
56 +      return isQmlPlugin;
57        }
58  }
59  
60 --- a/mscore/plugin/pluginManager.cpp
61 +++ b/mscore/plugin/pluginManager.cpp
62 @@ -167,8 +167,8 @@ static void updatePluginList(QList<QStri
63                                PluginDescription p;
64                                p.path = path;
65                                p.load = false;
66 -                              collectPluginMetaInformation(&p);
67 -                              pluginList.append(p);
68 +                              if (collectPluginMetaInformation(&p))
69 +                                    pluginList.append(p);
70                                }
71                          }
72                    }