Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9746f8f653 | |||
| b51a305c63 | |||
| 39775b5e98 | |||
| 93b56e2966 | |||
| 2e41464ff4 |
@@ -2,10 +2,23 @@ FITS/XISF image viewer with multithreaded image loading
|
||||
|
||||
To get all dependencies install these packages
|
||||
|
||||
sudo apt install qtbase5-dev libraw-dev libexif-dev libcfitsio-dev libgsl-dev cmake
|
||||
sudo apt install qtbase5-dev libraw-dev libexif-dev libcfitsio-dev libgsl-dev wcslib-dev libopencv-dev cmake
|
||||
|
||||
on OpenSUSE
|
||||
|
||||
sudo zypper install opencv-devel gsl-devel exif-devel libraw-devel wcslib-devel libqt5-qtbase-devel
|
||||
|
||||
MacOS X
|
||||
|
||||
To compile on MacOS install XCode first. Then install homebrew in x86_64 mode
|
||||
with "arch -i x86_64". Building on native ARM is not supported.
|
||||
|
||||
homebrew install qt5 libraw cfitsio libexif libgsl wcslib opencv
|
||||
|
||||
You may need to set CMAKE_PREFIX_PATH for Qt5 and OpenCV so CMake can find them.
|
||||
|
||||
Then to build run standard cmake
|
||||
|
||||
cmake -B build -S .
|
||||
make
|
||||
./tenmon
|
||||
cmake --build build
|
||||
./build/tenmon
|
||||
|
||||
+13
-6
@@ -20,12 +20,6 @@ FilesystemWidget::FilesystemWidget(QAbstractItemModel *model, QWidget *parent) :
|
||||
connect(m_listView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FilesystemWidget::fileClicked);
|
||||
}
|
||||
|
||||
void FilesystemWidget::setDir(const QString &dir)
|
||||
{
|
||||
//m_model->setRootPath(dir);
|
||||
//m_treeView->setRootIndex(m_model->index(m_model->rootPath()));
|
||||
}
|
||||
|
||||
void FilesystemWidget::selectFile(int row)
|
||||
{
|
||||
QModelIndex index = m_model->index(row, 0);
|
||||
@@ -47,6 +41,9 @@ Filetree::Filetree(QWidget *parent) : QTreeView(parent)
|
||||
m_fileSystemModel->setRootPath(m_rootDir);
|
||||
m_fileSystemModel->setNameFilters({"*.fits", "*.fit", "*.xisf", "*.jpg", "*.jpeg", "*.png", "*.cr2", "*.nef", "*.dng"});
|
||||
m_fileSystemModel->setNameFilterDisables(false);
|
||||
if(settings.value("filetree/showHidden", false).toBool())
|
||||
m_fileSystemModel->setFilter(m_fileSystemModel->filter() | QDir::Hidden);
|
||||
|
||||
setModel(m_fileSystemModel);
|
||||
setRootIndex(m_fileSystemModel->index(m_rootDir));
|
||||
header()->restoreState(settings.value("filetree/header").toByteArray());
|
||||
@@ -57,6 +54,7 @@ Filetree::~Filetree()
|
||||
QSettings settings;
|
||||
settings.setValue("filetree/rootDir", m_rootDir);
|
||||
settings.setValue("filetree/header", header()->saveState());
|
||||
settings.setValue("filetree/showHidden", (bool)(m_fileSystemModel->filter() & QDir::Hidden));
|
||||
}
|
||||
|
||||
void Filetree::contextMenuEvent(QContextMenuEvent *event)
|
||||
@@ -85,6 +83,9 @@ void Filetree::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
QAction *resetRoot = menu.addAction(tr("Reset root"));
|
||||
QAction *goUp = menu.addAction(tr("Go up"));
|
||||
QAction *showHidden = menu.addAction(tr("Show hidden files"));
|
||||
showHidden->setCheckable(true);
|
||||
showHidden->setChecked(m_fileSystemModel->filter() & QDir::Hidden);
|
||||
|
||||
QAction *a = menu.exec(event->globalPos());
|
||||
if(a == nullptr)
|
||||
@@ -121,6 +122,12 @@ void Filetree::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
emit indexDirectory(m_fileSystemModel->filePath(index));
|
||||
}
|
||||
else if(a == showHidden)
|
||||
{
|
||||
auto filter = m_fileSystemModel->filter();
|
||||
filter ^= QDir::Hidden;
|
||||
m_fileSystemModel->setFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
void Filetree::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
|
||||
@@ -13,7 +13,6 @@ class FilesystemWidget : public QWidget
|
||||
QAbstractItemModel *m_model;
|
||||
public:
|
||||
explicit FilesystemWidget(QAbstractItemModel *model, QWidget *parent = nullptr);
|
||||
void setDir(const QString &dir);
|
||||
private slots:
|
||||
void selectFile(int row);
|
||||
void fileClicked(const QModelIndex &index, const QModelIndex &);
|
||||
|
||||
+11
-3
@@ -13,7 +13,7 @@
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <QSettings>
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QThreadPool>
|
||||
#include <QStatusBar>
|
||||
#include "loadrunable.h"
|
||||
@@ -190,7 +190,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||
_lastDir = standardLocations.first();
|
||||
|
||||
_lastDir = settings.value("mainwindow/lastdir", _lastDir).toString();
|
||||
m_filesystem->setDir(_lastDir);
|
||||
|
||||
QStringList args = QCoreApplication::arguments();
|
||||
args.removeFirst();
|
||||
@@ -208,6 +207,16 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||
}
|
||||
|
||||
m_imageGL->setFocus();
|
||||
|
||||
// workaround for nasty wayland backend bug https://bugreports.qt.io/browse/QTBUG-87332
|
||||
if(static_cast<QGuiApplication*>(QCoreApplication::instance())->platformName() == "wayland")
|
||||
{
|
||||
infoDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
|
||||
filesystemDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
|
||||
databaseViewDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
|
||||
filetreeDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
|
||||
m_stretchPanel->setFloatable(false);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -367,7 +376,6 @@ void MainWindow::loadFile(const QString &path)
|
||||
_lastDir = info.canonicalPath();
|
||||
QSettings settings;
|
||||
settings.setValue("mainwindow/lastdir", _lastDir);
|
||||
m_filesystem->setDir(_lastDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ RawImage::RawImage(cv::Mat &img)
|
||||
{
|
||||
m_img = img;
|
||||
m_stats = false;
|
||||
scaleToUnit();
|
||||
}
|
||||
|
||||
RawImage::RawImage(const RawImage &d)
|
||||
@@ -378,3 +379,18 @@ bool RawImage::pixel(int x, int y, QVector3D &rgb) const
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void RawImage::scaleToUnit()
|
||||
{
|
||||
if(CV_MAT_DEPTH(m_img.type()) == CV_32F)
|
||||
{
|
||||
double min, max;
|
||||
cv::minMaxIdx(m_img, &min, &max);
|
||||
if(min < 0 || max > 1)
|
||||
{
|
||||
float scale = 1.0 / (max - min);
|
||||
float zero = min * scale;
|
||||
m_img = m_img * scale - zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
float thumbAspect() const;
|
||||
const cv::Mat& mat() const;
|
||||
bool pixel(int x, int y, QVector3D &rgb) const;
|
||||
void scaleToUnit();
|
||||
};
|
||||
|
||||
#endif // RAWIMAGE_H
|
||||
|
||||
Binary file not shown.
@@ -71,6 +71,10 @@
|
||||
<source>Go up</source>
|
||||
<translation>Go up</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show hidden files</source>
|
||||
<translation>Show hidden files</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpDialog</name>
|
||||
|
||||
Binary file not shown.
@@ -71,6 +71,10 @@
|
||||
<source>Go up</source>
|
||||
<translation>Monter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show hidden files</source>
|
||||
<translation>Afficher les fichiers cachés</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpDialog</name>
|
||||
|
||||
Binary file not shown.
@@ -72,6 +72,10 @@
|
||||
<source>Go up</source>
|
||||
<translation>O úroveň vyššie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show hidden files</source>
|
||||
<translation>Zobraz skryté súbory</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpDialog</name>
|
||||
|
||||
Reference in New Issue
Block a user