Additional work on batch processing
This commit is contained in:
+20
-8
@@ -8,6 +8,7 @@
|
||||
#include <QThreadPool>
|
||||
#include <QSemaphore>
|
||||
#include "database.h"
|
||||
#include "imageinfo.h"
|
||||
|
||||
namespace Script
|
||||
{
|
||||
@@ -23,10 +24,10 @@ class ScriptEngine : public QObject
|
||||
QSemaphore _semaphore;
|
||||
QString _scriptPath;
|
||||
QString _outputDir;
|
||||
QStringList _paths;
|
||||
QList<QPair<QString, QString>> _paths;
|
||||
public:
|
||||
explicit ScriptEngine(QObject *parent = nullptr);
|
||||
void setParams(const QString &scriptPath, const QStringList &paths, const QString &outputDir);
|
||||
void setParams(const QString &scriptPath, const QList<QPair<QString, QString>> &paths, const QString &outputDir);
|
||||
void reportError(const QString &message);
|
||||
const QString& outputDir() const;
|
||||
void interrupt();
|
||||
@@ -35,8 +36,11 @@ public:
|
||||
Q_INVOKABLE void mark(File *file);
|
||||
Q_INVOKABLE void unmark(File *file);
|
||||
Q_INVOKABLE bool isMarked(const File *file) const;
|
||||
Q_INVOKABLE bool convert(File *file, QString &outpath, QString format, QVariantMap params);
|
||||
Q_INVOKABLE void setMaxThread(int maxthread);
|
||||
Q_INVOKABLE void sync();
|
||||
bool convert(File *file, QString &outpath, const QString &format, const QVariantMap ¶ms, bool async);
|
||||
QJSValue newObject();
|
||||
QJSValue newArray(uint size);
|
||||
public slots:
|
||||
void run();
|
||||
signals:
|
||||
@@ -52,7 +56,7 @@ class ScriptEngineThread : public QObject
|
||||
public:
|
||||
ScriptEngineThread(QObject *parent = nullptr);
|
||||
~ScriptEngineThread();
|
||||
void setParams(const QString &scriptPath, const QStringList &paths, const QString &outputDir);
|
||||
void setParams(const QString &scriptPath, const QList<QPair<QString, QString>> &paths, const QString &outputDir);
|
||||
void start();
|
||||
void interrupt();
|
||||
signals:
|
||||
@@ -65,27 +69,35 @@ class File : public QObject
|
||||
Q_OBJECT
|
||||
ScriptEngine *_engine;
|
||||
QString _path;
|
||||
QString _root;
|
||||
QFileInfo _info;
|
||||
bool _fitsKeywordsLoaded = false;
|
||||
QMap<QString, QString> _fitsKeywords;
|
||||
QStringList _fitsKeywords;
|
||||
QMultiHash<QString, FITSRecord> _fitsRecords;
|
||||
void loadFitsKeywords();
|
||||
bool mkpath(const QString &path) const;
|
||||
QJSValue _stats;
|
||||
public:
|
||||
explicit File(const QString &path, ScriptEngine *engine);
|
||||
explicit File(const QString &path, const QString &root, ScriptEngine *engine);
|
||||
Q_INVOKABLE QString fileName() const;
|
||||
Q_INVOKABLE QString absoluteFilePath() const;
|
||||
Q_INVOKABLE QString absolutePath() const;
|
||||
Q_INVOKABLE QString relativeFilePath() const;
|
||||
Q_INVOKABLE QString relativePath() const;
|
||||
Q_INVOKABLE QString baseName() const;
|
||||
Q_INVOKABLE QString completeBaseName() const;
|
||||
Q_INVOKABLE QString suffix() const;
|
||||
Q_INVOKABLE qint64 size() const;
|
||||
Q_INVOKABLE QStringList fitsKeywords();
|
||||
Q_INVOKABLE QString fitsValue(const QString &key);
|
||||
Q_INVOKABLE QJSValue fitsValues(const QString &key);
|
||||
Q_INVOKABLE QJSValue fitsRecords();
|
||||
Q_INVOKABLE bool isMarked() const;
|
||||
Q_INVOKABLE bool copy(const QString &newpath) const;
|
||||
Q_INVOKABLE bool move(const QString &newpath) const;
|
||||
Q_INVOKABLE bool convertTo(const QString &format);
|
||||
Q_INVOKABLE File* copy(const QString &newpath) const;
|
||||
Q_INVOKABLE bool move(const QString &newpath);
|
||||
Q_INVOKABLE File* convert(const QString &outpath, const QString &format, const QVariantMap ¶ms);
|
||||
Q_INVOKABLE File* convertAsync(const QString &outpath, const QString &format, const QVariantMap ¶ms);
|
||||
Q_INVOKABLE QJSValue stats();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user