Compare commits
1 Commits
20250915
...
56bba27ae3
| Author | SHA1 | Date | |
|---|---|---|---|
| 56bba27ae3 |
+1
-1
Submodule libXISF updated: c6581e1122...556bb22d26
+14
-3
@@ -18,6 +18,7 @@
|
|||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
|
#include <QImageWriter>
|
||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
@@ -57,12 +58,18 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
for(auto format : supportedFormats)
|
for(auto format : supportedFormats)
|
||||||
{
|
{
|
||||||
QMimeType mimeType = db.mimeTypeForName(format);
|
QMimeType mimeType = db.mimeTypeForName(format);
|
||||||
_saveFilter.append(mimeType.filterString() + ";;");
|
|
||||||
_openFilter.append("*.");
|
_openFilter.append("*.");
|
||||||
_openFilter.append(mimeType.suffixes().join(" *."));
|
_openFilter.append(mimeType.suffixes().join(" *."));
|
||||||
_openFilter.append(" ");
|
_openFilter.append(" ");
|
||||||
nameFilter.append(mimeType.suffixes());
|
nameFilter.append(mimeType.suffixes());
|
||||||
}
|
}
|
||||||
|
auto supportedWrite = QImageWriter::supportedMimeTypes();
|
||||||
|
for(auto format : supportedWrite)
|
||||||
|
{
|
||||||
|
QMimeType mimeType = db.mimeTypeForName(format);
|
||||||
|
_saveFilter.append(mimeType.filterString() + ";;");
|
||||||
|
}
|
||||||
|
|
||||||
_openFilter.append("*.fit *.fits *.fts *.fz *.xisf *.cr2 *.cr3 *.nef *.dng)");
|
_openFilter.append("*.fit *.fits *.fts *.fz *.xisf *.cr2 *.cr3 *.nef *.dng)");
|
||||||
_openFilter.append(tr(";;All files (*)"));
|
_openFilter.append(tr(";;All files (*)"));
|
||||||
nameFilter.append({"fit", "fits", "fts", "fz", "xisf", "cr2", "cr3", "nef", "dng"});
|
nameFilter.append({"fit", "fits", "fts", "fz", "xisf", "cr2", "cr3", "nef", "dng"});
|
||||||
@@ -618,7 +625,7 @@ void MainWindow::saveAs()
|
|||||||
_lastDir,
|
_lastDir,
|
||||||
_saveFilter,
|
_saveFilter,
|
||||||
&selectedFilter);
|
&selectedFilter);
|
||||||
auto filterToFormat = [](const QString &file, const QString &filter) -> const char*
|
auto filterToFormat = [](const QString &file, const QString &filter) -> const QString
|
||||||
{
|
{
|
||||||
QString suffix = QFileInfo(file).suffix();
|
QString suffix = QFileInfo(file).suffix();
|
||||||
if(!suffix.compare("jpg", Qt::CaseInsensitive) || !suffix.compare("jpeg", Qt::CaseInsensitive))return "jpeg";
|
if(!suffix.compare("jpg", Qt::CaseInsensitive) || !suffix.compare("jpeg", Qt::CaseInsensitive))return "jpeg";
|
||||||
@@ -628,6 +635,10 @@ void MainWindow::saveAs()
|
|||||||
if(filter.contains("png"))return "png";
|
if(filter.contains("png"))return "png";
|
||||||
if(filter.contains("fits"))return "fits";
|
if(filter.contains("fits"))return "fits";
|
||||||
if(filter.contains("xisf"))return "xisf";
|
if(filter.contains("xisf"))return "xisf";
|
||||||
|
QRegularExpression suf("\\(\\*\\.([a-zA-Z]+).*\\)");
|
||||||
|
auto match = suf.match(filter);
|
||||||
|
if(match.hasMatch())
|
||||||
|
return match.captured(1);
|
||||||
return "jpeg";
|
return "jpeg";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -643,7 +654,7 @@ void MainWindow::saveAs()
|
|||||||
{
|
{
|
||||||
QImage img = m_image->renderToImage();
|
QImage img = m_image->renderToImage();
|
||||||
if(!img.isNull())
|
if(!img.isNull())
|
||||||
img.save(file, filterToFormat(file, selectedFilter));
|
img.save(file, filterToFormat(file, selectedFilter).toLatin1().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user