Batchprocessing improvments
This commit is contained in:
+22
-7
@@ -47,12 +47,17 @@ QList<QPair<QString, QString>> scanDirectories(const QStringList &paths)
|
|||||||
|
|
||||||
void BatchProcessing::scanScriptDir()
|
void BatchProcessing::scanScriptDir()
|
||||||
{
|
{
|
||||||
|
QString current;
|
||||||
|
if(_ui->scriptsList->currentItem())
|
||||||
|
current = _ui->scriptsList->currentItem()->text();
|
||||||
|
|
||||||
_ui->scriptsList->clear();
|
_ui->scriptsList->clear();
|
||||||
QDir dir(_scriptBasePath);
|
QDir dir(_scriptBasePath);
|
||||||
for(const QString &script : dir.entryList(QDir::Files | QDir::Readable))
|
QStringList scripts = dir.entryList(QDir::Files | QDir::Readable);
|
||||||
{
|
_ui->scriptsList->addItems(scripts);
|
||||||
_ui->scriptsList->addItem(script);
|
|
||||||
}
|
int idx = scripts.indexOf(current);
|
||||||
|
if(idx>=0)_ui->scriptsList->setCurrentRow(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
BatchProcessing::BatchProcessing(QWidget *parent) : QDialog(parent)
|
BatchProcessing::BatchProcessing(QWidget *parent) : QDialog(parent)
|
||||||
@@ -94,6 +99,7 @@ BatchProcessing::BatchProcessing(QWidget *parent) : QDialog(parent)
|
|||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
_ui->outputPath->setText(settings.value("batchprocessing/outputpath", QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first()).toString());
|
_ui->outputPath->setText(settings.value("batchprocessing/outputpath", QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first()).toString());
|
||||||
|
_ui->pathsList->addItem("/home/nou/Obrázky/astro/2019-12-03");
|
||||||
}
|
}
|
||||||
|
|
||||||
BatchProcessing::~BatchProcessing()
|
BatchProcessing::~BatchProcessing()
|
||||||
@@ -127,15 +133,24 @@ void BatchProcessing::closeEvent(QCloseEvent *event)
|
|||||||
|
|
||||||
void BatchProcessing::addFiles()
|
void BatchProcessing::addFiles()
|
||||||
{
|
{
|
||||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Select files"), "/home/nou/Obrázky/astro");
|
QSettings settings;
|
||||||
_ui->pathsList->addItems(files);
|
QStringList files = QFileDialog::getOpenFileNames(this, tr("Select files"), settings.value("batchprocessing/inputpath", QDir::homePath()).toString());
|
||||||
|
if(!files.isEmpty())
|
||||||
|
{
|
||||||
|
_ui->pathsList->addItems(files);
|
||||||
|
settings.setValue("batchprocessing/inputpath", QFileInfo(files.first()).absolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchProcessing::addDir()
|
void BatchProcessing::addDir()
|
||||||
{
|
{
|
||||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select directory"), "/home/nou/Obrázky/astro");
|
QSettings settings;
|
||||||
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Select directory"), settings.value("batchprocessing/inputpath", QDir::homePath()).toString());
|
||||||
if(!dir.isEmpty())
|
if(!dir.isEmpty())
|
||||||
|
{
|
||||||
_ui->pathsList->addItem(dir);
|
_ui->pathsList->addItem(dir);
|
||||||
|
settings.setValue("batchprocessing/inputpath", dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchProcessing::removePath()
|
void BatchProcessing::removePath()
|
||||||
|
|||||||
+1
-1
Submodule libXISF updated: 263b380dbf...922d4b73c9
+5
-1
@@ -7,6 +7,7 @@
|
|||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
#include <libexif/exif-data.h>
|
#include <libexif/exif-data.h>
|
||||||
#include <fitsio2.h>
|
#include <fitsio2.h>
|
||||||
#include <libxisf.h>
|
#include <libxisf.h>
|
||||||
@@ -724,8 +725,11 @@ void ConvertRunable::run()
|
|||||||
|
|
||||||
ConvertRunable::ConvertParams::ConvertParams(const QVariantMap &map)
|
ConvertRunable::ConvertParams::ConvertParams(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
|
bool ok = false;
|
||||||
if(map.contains("compressionLevel"))
|
if(map.contains("compressionLevel"))
|
||||||
compressionLevel = map["compressionLevel"].toInt();
|
compressionLevel = std::clamp(map["compressionLevel"].toInt(&ok), -1, 100);
|
||||||
|
|
||||||
|
if(!ok)compressionLevel = -1;
|
||||||
|
|
||||||
if(map.contains("compressionType"))
|
if(map.contains("compressionType"))
|
||||||
compressionType = map["compressionType"].toString();
|
compressionType = map["compressionType"].toString();
|
||||||
|
|||||||
+19
-6
@@ -89,19 +89,32 @@ void ScriptEngine::sync()
|
|||||||
_pool->waitForDone();
|
_pool->waitForDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ScriptEngine::getString(const QString &label, const QString &text) const
|
QJSValue ScriptEngine::getString(const QString &label, const QString &text) const
|
||||||
{
|
{
|
||||||
return QInputDialog::getText(_parent, tr("Enter text"), label, QLineEdit::Normal, text);
|
bool ok = false;
|
||||||
|
QString ret = QInputDialog::getText(_parent, tr("Enter text"), label, QLineEdit::Normal, text, &ok);
|
||||||
|
return ok ? ret : QJSValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptEngine::getInt(const QString &label, int value)
|
QJSValue ScriptEngine::getInt(const QString &label, int value)
|
||||||
{
|
{
|
||||||
return QInputDialog::getInt(_parent, tr("Enter integer number"), label, value);
|
bool ok = false;
|
||||||
|
int ret = QInputDialog::getInt(_parent, tr("Enter integer number"), label, value, INT_MIN, INT_MAX, 1, &ok);
|
||||||
|
return ok ? ret : QJSValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ScriptEngine::getFloat(const QString &label, double value, int decimals) const
|
QJSValue ScriptEngine::getFloat(const QString &label, double value, int decimals) const
|
||||||
{
|
{
|
||||||
return QInputDialog::getDouble(_parent, tr("Enter float number"), label, value, INT_MIN, INT_MAX, decimals);
|
bool ok = false;
|
||||||
|
double ret = QInputDialog::getDouble(_parent, tr("Enter float number"), label, value, -INFINITY, INFINITY, decimals, &ok);
|
||||||
|
return ok ? ret : QJSValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
QJSValue ScriptEngine::getItem(const QStringList &items, const QString &label, int current) const
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
QString ret = QInputDialog::getItem(_parent, tr("Select item"), label, items, current, false, &ok);
|
||||||
|
return ok ? ret : QJSValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptEngine::convert(File *file, QString &outpath, const QString &format, const QVariantMap ¶ms, bool async)
|
bool ScriptEngine::convert(File *file, QString &outpath, const QString &format, const QVariantMap ¶ms, bool async)
|
||||||
|
|||||||
+4
-3
@@ -39,9 +39,10 @@ public:
|
|||||||
Q_INVOKABLE bool isMarked(const File *file) const;
|
Q_INVOKABLE bool isMarked(const File *file) const;
|
||||||
Q_INVOKABLE void setMaxThread(int maxthread);
|
Q_INVOKABLE void setMaxThread(int maxthread);
|
||||||
Q_INVOKABLE void sync();
|
Q_INVOKABLE void sync();
|
||||||
Q_INVOKABLE QString getString(const QString &label = QString(), const QString &text = QString()) const;
|
Q_INVOKABLE QJSValue getString(const QString &label = QString(), const QString &text = QString()) const;
|
||||||
Q_INVOKABLE int getInt(const QString &label = QString(), int value = 0);
|
Q_INVOKABLE QJSValue getInt(const QString &label = QString(), int value = 0);
|
||||||
Q_INVOKABLE double getFloat(const QString &label = QString(), double value = 0, int decimals = 3) const;
|
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;
|
||||||
bool convert(File *file, QString &outpath, const QString &format, const QVariantMap ¶ms, bool async);
|
bool convert(File *file, QString &outpath, const QString &format, const QVariantMap ¶ms, bool async);
|
||||||
QJSValue newObject();
|
QJSValue newObject();
|
||||||
QJSValue newArray(uint size);
|
QJSValue newArray(uint size);
|
||||||
|
|||||||
Reference in New Issue
Block a user