TextFile scripting

This commit is contained in:
2025-04-15 11:09:23 +02:00
parent bac1963fa4
commit 58286d52c5
2 changed files with 93 additions and 1 deletions
+16 -1
View File
@@ -8,7 +8,7 @@
#include <QThreadPool>
#include <QSemaphore>
#include "database.h"
#include "imageinfo.h"
#include "imageinfodata.h"
class BatchProcessing;
class Solver;
@@ -48,6 +48,7 @@ public:
Q_INVOKABLE QJSValue getFloat(const QString &label = QString(), double value = 0, int decimals = 3) const;
Q_INVOKABLE QJSValue getItem(const QStringList &items, const QString &label = "", int current = 0) const;
Q_INVOKABLE void plot(const QJSValue &pointsArray);
Q_INVOKABLE QJSValue openFile(const QString &fileName, const QString &mode = "r");
bool convert(File *file, QString &outpath, const QString &format, const QVariantMap &params, bool async);
#ifdef PLATESOLVER
Q_INVOKABLE void setSolverProfile(int index);
@@ -143,6 +144,20 @@ public:
Q_INVOKABLE void addKeyword(const QString &key, const QVariant &value, const QString &comment = QString());
};
class TextFile : public QObject
{
Q_OBJECT
QFile _fr;
public:
bool open(const QString &path, const QString &mode);
Q_INVOKABLE void write(const QString &data);
Q_INVOKABLE QString read(int maxlen);
Q_INVOKABLE QString readLine();
Q_INVOKABLE QString readAll();
Q_INVOKABLE bool seek(qint64 offset);
Q_INVOKABLE qint64 pos();
};
}
#endif // SCRIPTENGINE_H