Add saving to FITS and XISF
This commit is contained in:
+29
-4
@@ -14,6 +14,8 @@
|
||||
#include <unistd.h>
|
||||
#include <QSettings>
|
||||
#include <QCoreApplication>
|
||||
#include <QThreadPool>
|
||||
#include "loadrunable.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/ioctl.h>
|
||||
@@ -298,15 +300,38 @@ void MainWindow::indexDir()
|
||||
|
||||
void MainWindow::saveAs()
|
||||
{
|
||||
QString file = QFileDialog::getSaveFileName(this, tr("Save as"), _lastDir, tr("Images (*.jpg *.png *.JPG *.PNG)"));
|
||||
QString selectedFilter;
|
||||
QString file = QFileDialog::getSaveFileName(this, tr("Save as"), _lastDir, tr("JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)"), &selectedFilter);
|
||||
if(!file.isEmpty())
|
||||
{
|
||||
QImage img = m_imageGL->imageWidget()->renderToImage();
|
||||
if(!img.isNull())
|
||||
img.save(file);
|
||||
QFileInfo info(file);
|
||||
if(info.suffix().isEmpty())
|
||||
{
|
||||
if(selectedFilter.contains("jpg"))file += ".jpg";
|
||||
if(selectedFilter.contains("png"))file += ".png";
|
||||
if(selectedFilter.contains("fits"))file += ".fits";
|
||||
if(selectedFilter.contains("xisf"))file += ".xisf";
|
||||
}
|
||||
|
||||
if(file.endsWith(".fits") || file.endsWith(".xisf"))
|
||||
{
|
||||
convert(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
QImage img = m_imageGL->imageWidget()->renderToImage();
|
||||
if(!img.isNull())
|
||||
img.save(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::convert(const QString &outfile)
|
||||
{
|
||||
QString file = m_ringList->currentImage()->name();
|
||||
QThreadPool::globalInstance()->start(new ConvertRunable(file, outfile));
|
||||
}
|
||||
|
||||
void MainWindow::markImage()
|
||||
{
|
||||
ImagePtr ptr = m_ringList->currentImage();
|
||||
|
||||
Reference in New Issue
Block a user