MuseScore  3.4
Music composition and notation
qmlplugin.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2012 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __QMLPLUGIN_H__
14 #define __QMLPLUGIN_H__
15 
16 #include "config.h"
17 
18 #include "libmscore/mscore.h"
20 #include "libmscore/utils.h"
21 
22 namespace Ms {
23 
24 class MsProcess;
25 class Score;
26 class Element;
27 class MScore;
28 
29 //---------------------------------------------------------
30 // QmlPlugin
31 // @@ MuseScore
32 // @P menuPath QString where the plugin is placed in menu
33 // @P filePath QString source file path, without the file name (read only)
34 // @P version QString version of this plugin
35 // @P description QString human readable description, displayed in Plugin Manager
36 // @P pluginType QString type may be dialog, dock, or not defined.
37 // @P dockArea QString where to dock on main screen. left,top,bottom, right(default)
38 // @P requiresScore bool whether the plugin requires an existing score to run
39 // @P division int number of MIDI ticks for 1/4 note (read only)
40 // @P mscoreVersion int complete version number of MuseScore in the form: MMmmuu (read only)
41 // @P mscoreMajorVersion int 1st part of the MuseScore version (read only)
42 // @P mscoreMinorVersion int 2nd part of the MuseScore version (read only)
43 // @P mscoreUpdateVersion int 3rd part of the MuseScore version (read only)
44 // @P mscoreDPI qreal (read only)
45 // @P curScore Ms::Score* current score, if any (read only)
46 // @P scores array[Ms::Score] all currently open scores (read only)
47 //---------------------------------------------------------
48 
49 class QmlPlugin : public QQuickItem {
50  Q_OBJECT
51 
52  QString _menuPath;
53  QString _pluginType;
54  QString _dockArea;
55  bool _requiresScore = true;
56  QString _version;
57  QString _description;
58 
59  protected:
60  QString _filePath; // the path of the source file, without file name
62  const MuseScoreCore* msc() const { return MuseScoreCore::mscoreCore; }
63 
64  public slots:
65  virtual void endCmd(const QMap<QString, QVariant>&) = 0;
66 
67  public:
68  QmlPlugin(QQuickItem* parent = 0);
69 
70  void setMenuPath(const QString& s) { _menuPath = s; }
71  QString menuPath() const { return _menuPath; }
72  void setVersion(const QString& s) { _version = s; }
73  QString version() const { return _version; }
74  void setDescription(const QString& s) { _description = s; }
75  QString description() const { return _description; }
76  void setFilePath(const QString s) { _filePath = s; }
77  QString filePath() const { return _filePath; }
78 
79  void setPluginType(const QString& s) { _pluginType = s; }
80  QString pluginType() const { return _pluginType; }
81  void setDockArea(const QString& s) { _dockArea = s; }
82  QString dockArea() const { return _dockArea; }
83  void setRequiresScore(bool b) { _requiresScore = b; }
84  bool requiresScore() const { return _requiresScore; }
85 
86  virtual void runPlugin() = 0;
87 
88  int division() const { return MScore::division; }
89  int mscoreVersion() const { return Ms::version(); }
90  int mscoreMajorVersion() const { return majorVersion(); }
91  int mscoreMinorVersion() const { return minorVersion(); }
92  int mscoreUpdateVersion() const { return updateVersion(); }
93  qreal mscoreDPI() const { return DPI; }
94  };
95 
96 
97 } // namespace Ms
98 #endif
int mscoreUpdateVersion() const
Definition: qmlplugin.h:92
Definition: qmlplugin.h:49
void setFilePath(const QString s)
Definition: qmlplugin.h:76
QString dockArea() const
Definition: qmlplugin.h:82
const MuseScoreCore * msc() const
Definition: qmlplugin.h:62
QString _filePath
Definition: qmlplugin.h:60
bool _requiresScore
Definition: qmlplugin.h:55
int mscoreVersion() const
Definition: qmlplugin.h:89
QString _menuPath
Definition: qmlplugin.h:52
int minorVersion()
Definition: utils.cpp:636
virtual void runPlugin()=0
QString pluginType() const
Definition: qmlplugin.h:80
QmlPlugin(QQuickItem *parent=0)
Definition: qmlplugin.cpp:23
void setRequiresScore(bool b)
Definition: qmlplugin.h:83
QString description() const
Definition: qmlplugin.h:75
QString _pluginType
Definition: qmlplugin.h:53
QString filePath() const
Definition: qmlplugin.h:77
MuseScoreCore * msc()
Definition: qmlplugin.h:61
virtual void endCmd(const QMap< QString, QVariant > &)=0
QString _version
Definition: qmlplugin.h:56
Definition: aeolus.cpp:26
int mscoreMinorVersion() const
Definition: qmlplugin.h:91
void setPluginType(const QString &s)
Definition: qmlplugin.h:79
void setVersion(const QString &s)
Definition: qmlplugin.h:72
void setDockArea(const QString &s)
Definition: qmlplugin.h:81
static int division
Definition: mscore.h:357
int division() const
Definition: qmlplugin.h:88
bool requiresScore() const
Definition: qmlplugin.h:84
static MuseScoreCore * mscoreCore
Definition: musescoreCore.h:32
QString version() const
Definition: qmlplugin.h:73
int updateVersion()
Definition: utils.cpp:646
QString _dockArea
Definition: qmlplugin.h:54
Definition: musescoreCore.h:25
void setDescription(const QString &s)
Definition: qmlplugin.h:74
qreal mscoreDPI() const
Definition: qmlplugin.h:93
int majorVersion()
Definition: utils.cpp:626
void setMenuPath(const QString &s)
Definition: qmlplugin.h:70
QString menuPath() const
Definition: qmlplugin.h:71
int mscoreMajorVersion() const
Definition: qmlplugin.h:90
QString _description
Definition: qmlplugin.h:57