13 #ifndef __PLUGIN_API_UTIL_H__ 14 #define __PLUGIN_API_UTIL_H__ 18 #include "libmscore/element.h" 19 #include "libmscore/mscoreview.h" 20 #include "libmscore/score.h" 21 #include "libmscore/utils.h" 62 explicit
FileIO(QObject *parent = 0);
69 Q_INVOKABLE QString
read();
78 Q_INVOKABLE
bool write(const QString& data);
82 Q_INVOKABLE QString
homePath() {QDir dir;
return dir.homePath();}
84 Q_INVOKABLE QString
tempPath() {QDir dir;
return dir.tempPath();}
89 QString
source() {
return mSource; }
92 void setSource(
const QString&
source) { mSource =
source; }
101 void error(
const QString& msg);
120 MsProcess(QObject* parent = 0) : QProcess(parent) {}
124 Q_INVOKABLE
void start(
const QString& program) { QProcess::start(program); }
126 Q_INVOKABLE
bool waitForFinished(
int msecs = 30000) {
return QProcess::waitForFinished(msecs); }
128 Q_INVOKABLE QByteArray readAllStandardOutput() {
return QProcess::readAllStandardOutput(); }
136 class ScoreView :
public QQuickPaintedItem,
public MuseScoreView {
139 Q_PROPERTY(QColor color READ color WRITE setColor)
141 Q_PROPERTY(qreal scale READ scale WRITE setScale)
148 QRectF _boundingRect;
150 QNetworkAccessManager* networkManager;
152 virtual
void setScore(
Ms::
Score*) override;
154 virtual
void dataChanged(const QRectF&)
override { update(); }
155 virtual void updateAll()
override { update(); }
157 virtual void paint(QPainter*)
override;
159 virtual QRectF boundingRect()
const override {
return _boundingRect; }
160 virtual void drawBackground(QPainter*,
const QRectF&)
const override {}
166 Q_INVOKABLE
void setCurrentPage(
int n);
168 Q_INVOKABLE
void nextPage();
170 Q_INVOKABLE
void prevPage();
176 QColor color()
const {
return _color; }
177 void setColor(
const QColor& c) { _color = c; }
178 qreal scale()
const {
return mag; }
179 void setScale(qreal v) { mag = v; }
180 virtual const QRect geometry()
const override {
return QRect(QQuickPaintedItem::x(), y(), width(), height()); }
void error(const QString &msg)
Emitted on file operations errors.
This is an GUI element to show a score.
Definition: util.h:136
Provides a simple API to perform file reading and writing operations.
Definition: util.h:52
Q_INVOKABLE bool write(const QString &data)
Writes a string to the file.
Definition: util.cpp:83
Q_INVOKABLE QString tempPath()
Returns a path suitable for a temporary file.
Definition: util.h:84
QString source
Path to the file which is operated on.
Definition: util.h:60
Q_INVOKABLE bool exists()
Returns true if the file exists.
Definition: util.cpp:111
Definition: cursor.cpp:30
Q_INVOKABLE QString read()
Reads file contents and returns a string.
Definition: util.cpp:54
Start an external program. Available in QML as QProcess.
Definition: util.h:116
Q_INVOKABLE int modifiedTime()
Returns the file's last modification time.
Definition: util.cpp:117
Q_INVOKABLE QString homePath()
Returns user's home directory.
Definition: util.h:82
Q_INVOKABLE bool remove()
Removes the file.
Definition: util.cpp:102