Enale loading all image types that Qt can load
This commit is contained in:
+4
-5
@@ -98,12 +98,14 @@ void Image::thumbnailLoadFinish(void *rawImage)
|
|||||||
emit thumbnailLoaded(this);
|
emit thumbnailLoaded(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageRingList::ImageRingList(Database *database, QObject *parent) : QAbstractItemModel(parent)
|
ImageRingList::ImageRingList(Database *database, const QStringList &nameFilter, QObject *parent) : QAbstractItemModel(parent)
|
||||||
, m_liveMode(false)
|
, m_liveMode(false)
|
||||||
, m_analyzeLevel(None)
|
, m_analyzeLevel(None)
|
||||||
, m_database(database)
|
, m_database(database)
|
||||||
|
, m_nameFilter(nameFilter)
|
||||||
{
|
{
|
||||||
connect(&m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)));
|
connect(&m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)));
|
||||||
|
m_nameFilter.replaceInStrings(QRegExp("^"), "*.");
|
||||||
m_thumbPool = new QThreadPool(this);
|
m_thumbPool = new QThreadPool(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,10 +124,7 @@ bool ImageRingList::setDir(const QString path, const QString ¤tFile)
|
|||||||
|
|
||||||
if(dir.exists())
|
if(dir.exists())
|
||||||
{
|
{
|
||||||
QStringList nameFilter;
|
QStringList list = dir.entryList(m_nameFilter, QDir::Files | QDir::Readable, m_liveMode ? QDir::Time : QDir::Name | QDir::IgnoreCase);
|
||||||
nameFilter << "*.jpg" << "*.jpeg" << "*.png" << "*.cr2" << "*.nef" << "*.dng" << "*.fit" << "*.fits" << "*.xisf";
|
|
||||||
|
|
||||||
QStringList list = dir.entryList(nameFilter, QDir::Files | QDir::Readable, m_liveMode ? QDir::Time : QDir::Name | QDir::IgnoreCase);
|
|
||||||
QStringList absolutePaths;
|
QStringList absolutePaths;
|
||||||
foreach(const QString &file, list)
|
foreach(const QString &file, list)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -60,8 +60,9 @@ class ImageRingList : public QAbstractItemModel
|
|||||||
AnalyzeLevel m_analyzeLevel;
|
AnalyzeLevel m_analyzeLevel;
|
||||||
QThreadPool *m_thumbPool;
|
QThreadPool *m_thumbPool;
|
||||||
Database *m_database;
|
Database *m_database;
|
||||||
|
QStringList m_nameFilter;
|
||||||
public:
|
public:
|
||||||
explicit ImageRingList(Database *database, QObject *parent = 0);
|
explicit ImageRingList(Database *database, const QStringList &nameFilter, QObject *parent = 0);
|
||||||
~ImageRingList() override;
|
~ImageRingList() override;
|
||||||
bool setDir(const QString path, const QString ¤tFile = QString());
|
bool setDir(const QString path, const QString ¤tFile = QString());
|
||||||
void setFile(const QString &file);
|
void setFile(const QString &file);
|
||||||
|
|||||||
+23
-3
@@ -26,6 +26,8 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <linux/btrfs.h>
|
#include <linux/btrfs.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <QImageReader>
|
||||||
|
#include <QMimeDatabase>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int MainWindow::socketPair[2] = {0, 0};
|
int MainWindow::socketPair[2] = {0, 0};
|
||||||
@@ -37,6 +39,24 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
|
|
||||||
SettingsDialog::loadSettings();
|
SettingsDialog::loadSettings();
|
||||||
|
|
||||||
|
QStringList nameFilter;
|
||||||
|
_saveFilter = tr("FITS (*.fits *.fit);;XISF (*.xisf);;");
|
||||||
|
_openFilter = tr("Images (");
|
||||||
|
QMimeDatabase db;
|
||||||
|
auto supportedFormats = QImageReader::supportedMimeTypes();
|
||||||
|
QStringList filters;
|
||||||
|
for(auto format : supportedFormats)
|
||||||
|
{
|
||||||
|
QMimeType mimeType = db.mimeTypeForName(format);
|
||||||
|
_saveFilter.append(mimeType.filterString() + ";;");
|
||||||
|
_openFilter.append("*.");
|
||||||
|
_openFilter.append(mimeType.suffixes().join(" *."));
|
||||||
|
_openFilter.append(" ");
|
||||||
|
nameFilter.append(mimeType.suffixes());
|
||||||
|
}
|
||||||
|
_openFilter.append("*.fit *.fits *.xisf *.cr2 *.nef *.dng)");
|
||||||
|
nameFilter.append({"fit", "fits", "xisf", "cr2", "nef", "dng"});
|
||||||
|
|
||||||
m_info = new ImageInfo(this);
|
m_info = new ImageInfo(this);
|
||||||
QDockWidget *infoDock = new QDockWidget(tr("Image info"), this);
|
QDockWidget *infoDock = new QDockWidget(tr("Image info"), this);
|
||||||
infoDock->setWidget(m_info);
|
infoDock->setWidget(m_info);
|
||||||
@@ -62,7 +82,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
connect(m_stretchPanel, &StretchToolbar::invert, m_imageGL->imageWidget(), &ImageWidget::invert);
|
connect(m_stretchPanel, &StretchToolbar::invert, m_imageGL->imageWidget(), &ImageWidget::invert);
|
||||||
connect(m_stretchPanel, &StretchToolbar::superPixel, m_imageGL->imageWidget(), &ImageWidget::superPixel);
|
connect(m_stretchPanel, &StretchToolbar::superPixel, m_imageGL->imageWidget(), &ImageWidget::superPixel);
|
||||||
|
|
||||||
m_ringList = new ImageRingList(m_database, this);
|
m_ringList = new ImageRingList(m_database, nameFilter, this);
|
||||||
m_filesystem = new FilesystemWidget(m_ringList, this);
|
m_filesystem = new FilesystemWidget(m_ringList, this);
|
||||||
connect(m_filesystem, SIGNAL(fileSelected(int)), this, SLOT(loadFile(int)));
|
connect(m_filesystem, SIGNAL(fileSelected(int)), this, SLOT(loadFile(int)));
|
||||||
|
|
||||||
@@ -372,7 +392,7 @@ void MainWindow::loadFile()
|
|||||||
QString file = QFileDialog::getOpenFileName(this,
|
QString file = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open file"),
|
tr("Open file"),
|
||||||
_lastDir,
|
_lastDir,
|
||||||
tr("Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)"),
|
_openFilter,
|
||||||
nullptr,
|
nullptr,
|
||||||
QFileDialog::DontUseNativeDialog);
|
QFileDialog::DontUseNativeDialog);
|
||||||
loadFile(file);
|
loadFile(file);
|
||||||
@@ -428,7 +448,7 @@ void MainWindow::saveAs()
|
|||||||
QString file = QFileDialog::getSaveFileName(this,
|
QString file = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save as"),
|
tr("Save as"),
|
||||||
_lastDir,
|
_lastDir,
|
||||||
tr("JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)"),
|
_saveFilter,
|
||||||
&selectedFilter);
|
&selectedFilter);
|
||||||
auto filterToFormat = [](const QString &file, const QString &filter) -> const char*
|
auto filterToFormat = [](const QString &file, const QString &filter) -> const char*
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class MainWindow : public QMainWindow
|
|||||||
QSocketNotifier *socketNotifier;
|
QSocketNotifier *socketNotifier;
|
||||||
QString _lastDir;
|
QString _lastDir;
|
||||||
bool _maximized;
|
bool _maximized;
|
||||||
|
QString _openFilter;
|
||||||
|
QString _saveFilter;
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = 0);
|
||||||
~MainWindow() override;
|
~MainWindow() override;
|
||||||
|
|||||||
Binary file not shown.
@@ -304,7 +304,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</source>
|
<source>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</source>
|
||||||
<translation>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</translation>
|
<translation type="vanished">JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Reindex files</source>
|
<source>Reindex files</source>
|
||||||
@@ -324,7 +324,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</source>
|
<source>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</source>
|
||||||
<translation>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
<translation type="vanished">Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Edit</source>
|
<source>Edit</source>
|
||||||
@@ -332,12 +332,20 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>FITS header editor</source>
|
<source>FITS header editor</source>
|
||||||
<translation>FITS header editor</translation>
|
<translation type="vanished">FITS header editor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Settings</translation>
|
<translation>Settings</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Images (</source>
|
||||||
|
<translation>Images (</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FITS (*.fits *.fit);;XISF (*.xisf);;</source>
|
||||||
|
<translation>FITS image (*.fits *.fit);;XISF image (*.xisf);;</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MarkedFiles</name>
|
<name>MarkedFiles</name>
|
||||||
|
|||||||
Binary file not shown.
@@ -304,7 +304,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</source>
|
<source>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</source>
|
||||||
<translation>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</translation>
|
<translation type="vanished">JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Reindex files</source>
|
<source>Reindex files</source>
|
||||||
@@ -324,7 +324,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</source>
|
<source>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</source>
|
||||||
<translation>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
<translation type="vanished">Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Edit</source>
|
<source>Edit</source>
|
||||||
@@ -332,12 +332,20 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>FITS header editor</source>
|
<source>FITS header editor</source>
|
||||||
<translation>Éditeur d'en-tête FITS</translation>
|
<translation type="vanished">Éditeur d'en-tête FITS</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Réglages</translation>
|
<translation>Réglages</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Images (</source>
|
||||||
|
<translation>Images (</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FITS (*.fits *.fit);;XISF (*.xisf);;</source>
|
||||||
|
<translation>FITS image (*.fits *.fit);;XISF image (*.xisf);;</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MarkedFiles</name>
|
<name>MarkedFiles</name>
|
||||||
|
|||||||
Binary file not shown.
@@ -317,7 +317,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</source>
|
<source>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</source>
|
||||||
<translation>JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</translation>
|
<translation type="vanished">JPEG (*.jpg *.JPG);; PNG (*.png *.PNG);;FITS (*.fits *.FITS);;XISF (*.xisf *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Reindex files</source>
|
<source>Reindex files</source>
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</source>
|
<source>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</source>
|
||||||
<translation>Obrázky (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
<translation type="vanished">Obrázky (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Edit</source>
|
<source>Edit</source>
|
||||||
@@ -345,12 +345,20 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>FITS header editor</source>
|
<source>FITS header editor</source>
|
||||||
<translation>Editor FITS hlavičky</translation>
|
<translation type="vanished">Editor FITS hlavičky</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Nastavenia</translation>
|
<translation>Nastavenia</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Images (</source>
|
||||||
|
<translation>Obrázky (</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FITS (*.fits *.fit);;XISF (*.xisf);;</source>
|
||||||
|
<translation>Obrázok FITS (*.fits *.fit);;Obrázok XISF (*.xisf);;</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MarkedFiles</name>
|
<name>MarkedFiles</name>
|
||||||
|
|||||||
Reference in New Issue
Block a user