Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62d2671112 | |||
| 1f8923512e | |||
| 455c3b2d64 | |||
| 4fe546f0e5 | |||
| 95c6fc5343 | |||
| 2bc54ea0cc | |||
| be6e472081 |
@@ -35,12 +35,22 @@ set(TENMON_SRC
|
|||||||
mainwindow.cpp
|
mainwindow.cpp
|
||||||
markedfiles.cpp
|
markedfiles.cpp
|
||||||
rawimage.cpp
|
rawimage.cpp
|
||||||
|
settingsdialog.cpp
|
||||||
starfit.cpp
|
starfit.cpp
|
||||||
statusbar.cpp
|
statusbar.cpp
|
||||||
stfslider.cpp
|
stfslider.cpp
|
||||||
stretchtoolbar.cpp
|
stretchtoolbar.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(COLOR_MANAGMENT "Enable sRGB framebuffer support for gamma correct images and color profiles support" ON)
|
||||||
|
if(${Qt5Core_VERSION_STRING} VERSION_LESS "5.14")
|
||||||
|
set(COLOR_MANAGMENT OFF)
|
||||||
|
endif(${Qt5Core_VERSION_STRING} VERSION_LESS "5.14")
|
||||||
|
|
||||||
|
if(COLOR_MANAGMENT)
|
||||||
|
add_compile_definitions("COLOR_MANAGMENT")
|
||||||
|
endif(COLOR_MANAGMENT)
|
||||||
|
|
||||||
qt5_add_resources(TENMON_SRC resources.qrc)
|
qt5_add_resources(TENMON_SRC resources.qrc)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND TENMON_SRC icon.rc)
|
list(APPEND TENMON_SRC icon.rc)
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const int DEFAULT_WIDTH = 2;
|
int DEFAULT_WIDTH = 2;
|
||||||
|
|
||||||
Image::Image(const QString name, int number, ImageRingList *ringList) :
|
Image::Image(const QString name, int number, ImageRingList *ringList) :
|
||||||
m_loading(false),
|
m_loading(false),
|
||||||
@@ -260,6 +260,7 @@ void ImageRingList::loadThumbnails()
|
|||||||
void ImageRingList::stopLoading()
|
void ImageRingList::stopLoading()
|
||||||
{
|
{
|
||||||
m_thumbPool->clear();
|
m_thumbPool->clear();
|
||||||
|
m_thumbPool->waitForDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImageRingList::imageCount() const
|
int ImageRingList::imageCount() const
|
||||||
|
|||||||
@@ -24,8 +24,13 @@ const RawImageType rawImageTypes[] = {
|
|||||||
{QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, true},
|
{QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, true},
|
||||||
{QOpenGLTexture::Red, QOpenGLTexture::R16_UNorm, QOpenGLTexture::UInt16, true},
|
{QOpenGLTexture::Red, QOpenGLTexture::R16_UNorm, QOpenGLTexture::UInt16, true},
|
||||||
{QOpenGLTexture::Red, QOpenGLTexture::R32F, QOpenGLTexture::Float32, true},
|
{QOpenGLTexture::Red, QOpenGLTexture::R32F, QOpenGLTexture::Float32, true},
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
{QOpenGLTexture::RGB, QOpenGLTexture::SRGB8, QOpenGLTexture::UInt8, false},
|
||||||
|
{QOpenGLTexture::RGBA,QOpenGLTexture::SRGB8, QOpenGLTexture::UInt8, false},
|
||||||
|
#else
|
||||||
{QOpenGLTexture::RGB, QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, false},
|
{QOpenGLTexture::RGB, QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, false},
|
||||||
{QOpenGLTexture::RGBA,QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, false},
|
{QOpenGLTexture::RGBA,QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, false},
|
||||||
|
#endif
|
||||||
{QOpenGLTexture::RGB, QOpenGLTexture::RGB16_UNorm, QOpenGLTexture::UInt16, false},
|
{QOpenGLTexture::RGB, QOpenGLTexture::RGB16_UNorm, QOpenGLTexture::UInt16, false},
|
||||||
{QOpenGLTexture::RGBA, QOpenGLTexture::RGB16_UNorm, QOpenGLTexture::UInt16, false},
|
{QOpenGLTexture::RGBA, QOpenGLTexture::RGB16_UNorm, QOpenGLTexture::UInt16, false},
|
||||||
{QOpenGLTexture::RGB, QOpenGLTexture::RGB32F, QOpenGLTexture::Float32, false}
|
{QOpenGLTexture::RGB, QOpenGLTexture::RGB32F, QOpenGLTexture::Float32, false}
|
||||||
@@ -79,6 +84,9 @@ ImageWidget::ImageWidget(Database *database, QWidget *parent) : QOpenGLWidget(pa
|
|||||||
});
|
});
|
||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
setTextureFormat(GL_SRGB8_ALPHA8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageWidget::~ImageWidget()
|
ImageWidget::~ImageWidget()
|
||||||
@@ -110,6 +118,7 @@ void ImageWidget::setImage(std::shared_ptr<RawImage> image, int index)
|
|||||||
m_image->setLevelOfDetailRange(m_superpixel ? 1 : 0, m_image->mipMaxLevel());
|
m_image->setLevelOfDetailRange(m_superpixel ? 1 : 0, m_image->mipMaxLevel());
|
||||||
m_image->generateMipMaps();
|
m_image->generateMipMaps();
|
||||||
m_bwImg = rawImageType.bw;
|
m_bwImg = rawImageType.bw;
|
||||||
|
m_srgb = rawImageType.textureFormat == QOpenGLTexture::SRGB8 || rawImageType.textureFormat == QOpenGLTexture::SRGB8_Alpha8;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +258,7 @@ void ImageWidget::paintGL()
|
|||||||
}
|
}
|
||||||
m_thumbnailProgram->bind();
|
m_thumbnailProgram->bind();
|
||||||
f->glUniform3i(m_thumbnailProgram->uniformLocation("viewport_row"), width(), height(), width()/THUMB_SIZE_BORDER);
|
f->glUniform3i(m_thumbnailProgram->uniformLocation("viewport_row"), width(), height(), width()/THUMB_SIZE_BORDER);
|
||||||
|
f->glUniform3i(m_thumbnailProgram->uniformLocation("thumb_size"), THUMB_SIZE_BORDER/2, THUMB_SIZE_BORDER, THUMB_SIZE_BORDER_Y);
|
||||||
m_thumbnailProgram->setUniformValue("mtf_param", m_low, m_mid, m_high);
|
m_thumbnailProgram->setUniformValue("mtf_param", m_low, m_mid, m_high);
|
||||||
m_thumbnailProgram->setUniformValue("invert", m_invert);
|
m_thumbnailProgram->setUniformValue("invert", m_invert);
|
||||||
m_thumbnailProgram->setUniformValue("offset", 0, m_dy);
|
m_thumbnailProgram->setUniformValue("offset", 0, m_dy);
|
||||||
@@ -287,6 +297,9 @@ void ImageWidget::paintGL()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
if(m_srgb)f->glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
m_vao->bind();
|
m_vao->bind();
|
||||||
m_image->bind(0);
|
m_image->bind(0);
|
||||||
m_program->bind();
|
m_program->bind();
|
||||||
@@ -297,6 +310,9 @@ void ImageWidget::paintGL()
|
|||||||
m_program->setUniformValue("bw", m_bwImg);
|
m_program->setUniformValue("bw", m_bwImg);
|
||||||
m_program->setUniformValue("invert", m_invert);
|
m_program->setUniformValue("invert", m_invert);
|
||||||
f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
if(m_srgb)f->glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class ImageWidget : public QOpenGLWidget
|
|||||||
bool m_showThumbnails;
|
bool m_showThumbnails;
|
||||||
bool m_selecting;
|
bool m_selecting;
|
||||||
bool m_sizesDirty;
|
bool m_sizesDirty;
|
||||||
|
bool m_srgb;
|
||||||
int m_thumbnailCount;
|
int m_thumbnailCount;
|
||||||
QVector<ImageThumb> m_thumnails;
|
QVector<ImageThumb> m_thumnails;
|
||||||
Database *m_database;
|
Database *m_database;
|
||||||
|
|||||||
+37
-11
@@ -14,6 +14,11 @@
|
|||||||
#include "starfit.h"
|
#include "starfit.h"
|
||||||
#include "wcslib/wcshdr.h"
|
#include "wcslib/wcshdr.h"
|
||||||
|
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
#include <QColorSpace>
|
||||||
|
static pcl::ICCProfile sRgbIccProfile((void*)QColorSpace(QColorSpace::SRgb).iccProfile().data());
|
||||||
|
#endif
|
||||||
|
|
||||||
LoadRunable::LoadRunable(const QString &file, Image *receiver, AnalyzeLevel level, bool thumbnail) :
|
LoadRunable::LoadRunable(const QString &file, Image *receiver, AnalyzeLevel level, bool thumbnail) :
|
||||||
m_file(file),
|
m_file(file),
|
||||||
m_receiver(receiver),
|
m_receiver(receiver),
|
||||||
@@ -83,17 +88,17 @@ bool loadRAW(const QString path, ImageInfoData &info, RawImage **image)
|
|||||||
if(!image)
|
if(!image)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LibRaw raw;
|
std::unique_ptr<LibRaw> raw = std::make_unique<LibRaw>();
|
||||||
raw.open_file(path.toLocal8Bit().data());
|
raw->open_file(path.toLocal8Bit().data());
|
||||||
raw.imgdata.params.half_size = true;
|
raw->imgdata.params.half_size = true;
|
||||||
raw.imgdata.params.use_camera_wb = true;
|
raw->imgdata.params.use_camera_wb = true;
|
||||||
raw.imgdata.params.user_flip = 0;
|
raw->imgdata.params.user_flip = 0;
|
||||||
if(raw.unpack())
|
if(raw->unpack())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(image)
|
if(image)
|
||||||
{
|
{
|
||||||
libraw_rawdata_t rawdata = raw.imgdata.rawdata;
|
libraw_rawdata_t rawdata = raw->imgdata.rawdata;
|
||||||
size_t size = rawdata.sizes.width*rawdata.sizes.height;
|
size_t size = rawdata.sizes.width*rawdata.sizes.height;
|
||||||
|
|
||||||
std::vector<uint16_t> out;
|
std::vector<uint16_t> out;
|
||||||
@@ -115,14 +120,14 @@ bool loadRAW(const QString path, ImageInfoData &info, RawImage **image)
|
|||||||
memcpy((*image)->data(), &out[0], sizeof(uint16_t)*d);
|
memcpy((*image)->data(), &out[0], sizeof(uint16_t)*d);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString shutterSpeed = QString::number(raw.imgdata.other.shutter);
|
QString shutterSpeed = QString::number(raw->imgdata.other.shutter);
|
||||||
if(raw.imgdata.other.shutter < 1)
|
if(raw->imgdata.other.shutter < 1)
|
||||||
{
|
{
|
||||||
shutterSpeed = QString("1/%1s").arg(1.0f/raw.imgdata.other.shutter);
|
shutterSpeed = QString("1/%1s").arg(1.0f/raw->imgdata.other.shutter);
|
||||||
}
|
}
|
||||||
//info.append(StringPair(QObject::tr("Width"), QString::number(rawImg->width)));
|
//info.append(StringPair(QObject::tr("Width"), QString::number(rawImg->width)));
|
||||||
//info.append(StringPair(QObject::tr("Height"), QString::number(rawImg->height)));
|
//info.append(StringPair(QObject::tr("Height"), QString::number(rawImg->height)));
|
||||||
info.info.append({QObject::tr("ISO"), QString::number(raw.imgdata.other.iso_speed)});
|
info.info.append({QObject::tr("ISO"), QString::number(raw->imgdata.other.iso_speed)});
|
||||||
info.info.append({QObject::tr("Shutter speed"), shutterSpeed});
|
info.info.append({QObject::tr("Shutter speed"), shutterSpeed});
|
||||||
#if LIBRAW_MINOR_VERSION>=19
|
#if LIBRAW_MINOR_VERSION>=19
|
||||||
// info.append(StringPair(QObject::tr("Camera temperature"), QString::number(raw.imgdata.other.CameraTemperature)));
|
// info.append(StringPair(QObject::tr("Camera temperature"), QString::number(raw.imgdata.other.CameraTemperature)));
|
||||||
@@ -281,11 +286,26 @@ bool loadFITS(const QString path, ImageInfoData &info, RawImage **image)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "pcl/ICCProfileTransformation.h"
|
||||||
|
|
||||||
template<typename T, typename PCLtype, int CVtype>
|
template<typename T, typename PCLtype, int CVtype>
|
||||||
bool loadPCLImage(pcl::XISFReader &xisf, RawImage **image)
|
bool loadPCLImage(pcl::XISFReader &xisf, RawImage **image)
|
||||||
{
|
{
|
||||||
PCLtype pclImage;
|
PCLtype pclImage;
|
||||||
xisf.ReadImage(pclImage);
|
xisf.ReadImage(pclImage);
|
||||||
|
pclImage.Status().DisableInitialization();
|
||||||
|
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
pcl::ICCProfile iccProfile = xisf.ReadICCProfile();
|
||||||
|
if(iccProfile.IsProfile())
|
||||||
|
{
|
||||||
|
pcl::ICCProfileTransformation iccTran;
|
||||||
|
iccTran.DisableParallelProcessing();
|
||||||
|
iccTran.Add(iccProfile);
|
||||||
|
iccTran.Add(sRgbIccProfile);
|
||||||
|
iccTran >> pclImage;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int numChannels = pclImage.NumberOfChannels();
|
int numChannels = pclImage.NumberOfChannels();
|
||||||
cv::Mat cvImg[numChannels];
|
cv::Mat cvImg[numChannels];
|
||||||
@@ -315,6 +335,7 @@ bool loadXISF(const QString &path, ImageInfoData &info, RawImage **image)
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
pcl::XISF::EnsurePTLUTInitialized();
|
||||||
pcl::String pclPath = path.utf16();
|
pcl::String pclPath = path.utf16();
|
||||||
pcl::XISFReader xisf;
|
pcl::XISFReader xisf;
|
||||||
xisf.Open(pclPath);
|
xisf.Open(pclPath);
|
||||||
@@ -384,6 +405,11 @@ void LoadRunable::run()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QImage img(m_file);
|
QImage img(m_file);
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
if(img.colorSpace().isValid())
|
||||||
|
img.convertToColorSpace(QColorSpace::SRgb);
|
||||||
|
#endif
|
||||||
|
|
||||||
ExifData *exif = exif_data_new_from_file(m_file.toLocal8Bit().constData());
|
ExifData *exif = exif_data_new_from_file(m_file.toLocal8Bit().constData());
|
||||||
info.info.append({QObject::tr("Width"), QString::number(img.width())});
|
info.info.append({QObject::tr("Width"), QString::number(img.width())});
|
||||||
info.info.append({QObject::tr("Height"), QString::number(img.height())});
|
info.info.append({QObject::tr("Height"), QString::number(img.height())});
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ int main(int argc, char *argv[])
|
|||||||
format.setMinorVersion(3);
|
format.setMinorVersion(3);
|
||||||
format.setOption(QSurfaceFormat::DebugContext);
|
format.setOption(QSurfaceFormat::DebugContext);
|
||||||
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
||||||
|
#ifdef COLOR_MANAGMENT
|
||||||
|
format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
|
||||||
|
#endif
|
||||||
QSurfaceFormat::setDefaultFormat(format);
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|||||||
+14
-1
@@ -20,6 +20,7 @@
|
|||||||
#include "markedfiles.h"
|
#include "markedfiles.h"
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
|
#include "settingsdialog.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -34,6 +35,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
qRegisterMetaType<ImageInfoData>("ImageInfoData");
|
qRegisterMetaType<ImageInfoData>("ImageInfoData");
|
||||||
qRegisterMetaType<RawImage*>("RawImage");
|
qRegisterMetaType<RawImage*>("RawImage");
|
||||||
|
|
||||||
|
SettingsDialog::loadSettings();
|
||||||
|
|
||||||
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);
|
||||||
@@ -117,6 +120,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
exitAction->setShortcut(QKeySequence::Quit);
|
exitAction->setShortcut(QKeySequence::Quit);
|
||||||
menuBar()->addMenu(fileMenu);
|
menuBar()->addMenu(fileMenu);
|
||||||
|
|
||||||
|
QMenu *editMenu = new QMenu(tr("Edit"), this);
|
||||||
|
editMenu->addAction(tr("Settings"), this, &MainWindow::showSettingsDialog);
|
||||||
|
menuBar()->addMenu(editMenu);
|
||||||
|
|
||||||
QMenu *viewMenu = new QMenu(tr("View"), this);
|
QMenu *viewMenu = new QMenu(tr("View"), this);
|
||||||
viewMenu->addAction(tr("Zoom In"), m_imageGL, SLOT(zoomIn()), QKeySequence::ZoomIn);
|
viewMenu->addAction(tr("Zoom In"), m_imageGL, SLOT(zoomIn()), QKeySequence::ZoomIn);
|
||||||
viewMenu->addAction(tr("Zoom Out"), m_imageGL, SLOT(zoomOut()), QKeySequence::ZoomOut);
|
viewMenu->addAction(tr("Zoom Out"), m_imageGL, SLOT(zoomOut()), QKeySequence::ZoomOut);
|
||||||
@@ -533,10 +540,16 @@ void MainWindow::starFinder(bool findStars)
|
|||||||
|
|
||||||
void MainWindow::showMarkFilesDialog()
|
void MainWindow::showMarkFilesDialog()
|
||||||
{
|
{
|
||||||
MarkedFiles markedFiles;
|
MarkedFiles markedFiles(this);
|
||||||
markedFiles.exec();
|
markedFiles.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showSettingsDialog()
|
||||||
|
{
|
||||||
|
SettingsDialog settingsDialog(this);
|
||||||
|
settingsDialog.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::updateWindowTitle()
|
void MainWindow::updateWindowTitle()
|
||||||
{
|
{
|
||||||
ImagePtr ptr = m_ringList->currentImage();
|
ImagePtr ptr = m_ringList->currentImage();
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ protected slots:
|
|||||||
void peakFinder(bool findPeaks);
|
void peakFinder(bool findPeaks);
|
||||||
void starFinder(bool findStars);
|
void starFinder(bool findStars);
|
||||||
void showMarkFilesDialog();
|
void showMarkFilesDialog();
|
||||||
|
void showSettingsDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include "rawimage.h"
|
#include "rawimage.h"
|
||||||
|
|
||||||
|
int THUMB_SIZE = 128;
|
||||||
|
int THUMB_SIZE_BORDER = 138;
|
||||||
|
int THUMB_SIZE_BORDER_Y = 158;
|
||||||
|
|
||||||
RawImage::ImgType CV2Type(int cvtype)
|
RawImage::ImgType CV2Type(int cvtype)
|
||||||
{
|
{
|
||||||
switch (cvtype)
|
switch (cvtype)
|
||||||
|
|||||||
+3
-3
@@ -10,9 +10,9 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QVector3D>
|
#include <QVector3D>
|
||||||
|
|
||||||
const int THUMB_SIZE = 128;
|
extern int THUMB_SIZE;
|
||||||
const int THUMB_SIZE_BORDER = 138;
|
extern int THUMB_SIZE_BORDER;
|
||||||
const int THUMB_SIZE_BORDER_Y = 158;
|
extern int THUMB_SIZE_BORDER_Y;
|
||||||
|
|
||||||
class Peak
|
class Peak
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
#include "settingsdialog.h"
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSettings>
|
||||||
|
#include "rawimage.h"
|
||||||
|
|
||||||
|
extern int DEFAULT_WIDTH;
|
||||||
|
|
||||||
|
class EvenNumber : public QSpinBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit EvenNumber(QWidget *parent) : QSpinBox(parent){}
|
||||||
|
protected:
|
||||||
|
QValidator::State validate(QString &text, int &) const
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
int val = text.toInt(&ok);
|
||||||
|
if(ok && (val & 1) == 0)return QValidator::Acceptable;
|
||||||
|
if(ok)return QValidator::Intermediate;
|
||||||
|
return QValidator::Invalid;
|
||||||
|
}
|
||||||
|
void fixup(QString &input) const
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
int val = input.toInt(&ok);
|
||||||
|
val -= val & 1;
|
||||||
|
input = QString::number(val);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
|
||||||
|
{
|
||||||
|
QFormLayout *layout = new QFormLayout(this);
|
||||||
|
setWindowTitle(tr("Settings"));
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
m_preloadImages = new QSpinBox(this);
|
||||||
|
m_preloadImages->setRange(0, 8);
|
||||||
|
m_preloadImages->setValue(settings.value("settings/preloadimagecount", DEFAULT_WIDTH).toInt());
|
||||||
|
m_preloadImages->setToolTip(tr("How many images are preloaded before and after current image."));
|
||||||
|
|
||||||
|
m_thumSize = new EvenNumber(this);
|
||||||
|
m_thumSize->setRange(64, 512);
|
||||||
|
m_thumSize->setSingleStep(2);
|
||||||
|
m_thumSize->setValue(settings.value("settings/thumnailsize", THUMB_SIZE).toInt());
|
||||||
|
m_thumSize->setToolTip(tr("Thumbnail size in pixels"));
|
||||||
|
|
||||||
|
layout->addRow(tr("Image preload count"), m_preloadImages);
|
||||||
|
layout->addRow(tr("Thumbnails size"), m_thumSize);
|
||||||
|
layout->addRow(new QLabel(tr("Changes in settings will take effect after program restart.")));
|
||||||
|
|
||||||
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
||||||
|
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
connect(this, &QDialog::accepted, this, &SettingsDialog::saveSettings);
|
||||||
|
|
||||||
|
layout->addRow(buttonBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::loadSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
THUMB_SIZE = settings.value("settings/thumbnailsize", THUMB_SIZE).toInt();
|
||||||
|
THUMB_SIZE_BORDER = THUMB_SIZE + 10;
|
||||||
|
THUMB_SIZE_BORDER_Y = THUMB_SIZE + 30;
|
||||||
|
DEFAULT_WIDTH = settings.value("settings/preloadimagecount", DEFAULT_WIDTH).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::saveSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("settings/thumbnailsize", m_thumSize->value());
|
||||||
|
settings.setValue("settings/preloadimagecount", m_preloadImages->value());
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef SETTINGSDIALOG_H
|
||||||
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
|
class SettingsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit SettingsDialog(QWidget *parent = nullptr);
|
||||||
|
static void loadSettings();
|
||||||
|
private:
|
||||||
|
void saveSettings();
|
||||||
|
|
||||||
|
QSpinBox *m_preloadImages;
|
||||||
|
QSpinBox *m_thumSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SETTINGSDIALOG_H
|
||||||
+3
-2
@@ -7,13 +7,14 @@ out vec3 qt_TexCoord0;
|
|||||||
uniform ivec3 viewport_row;
|
uniform ivec3 viewport_row;
|
||||||
uniform mat4 mvp;
|
uniform mat4 mvp;
|
||||||
uniform vec2 offset;
|
uniform vec2 offset;
|
||||||
|
uniform ivec3 thumb_size;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
vec2 pos = qt_Vertex * 0.5;
|
vec2 pos = qt_Vertex * 0.5;
|
||||||
pos.y *= -1.0;
|
pos.y *= -1.0;
|
||||||
pos = pos * imageSize_num.xy + 69;
|
pos = pos * imageSize_num.xy + thumb_size.x;
|
||||||
ivec2 off = ivec2(imageSize_num.z % viewport_row.z, imageSize_num.z / viewport_row.z) * ivec2(138, 158);
|
ivec2 off = ivec2(imageSize_num.z % viewport_row.z, imageSize_num.z / viewport_row.z) * thumb_size.yz;
|
||||||
|
|
||||||
gl_Position = mvp * vec4(pos - offset + off, 0.0, 1.0);
|
gl_Position = mvp * vec4(pos - offset + off, 0.0, 1.0);
|
||||||
qt_TexCoord0 = vec3(qt_MultiTexCoord0, imageSize_num.z + 0.1);
|
qt_TexCoord0 = vec3(qt_MultiTexCoord0, imageSize_num.z + 0.1);
|
||||||
|
|||||||
Binary file not shown.
@@ -326,6 +326,18 @@
|
|||||||
<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>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Edit</source>
|
||||||
|
<translation>Edit</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FITS header editor</source>
|
||||||
|
<translation>FITS header editor</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Settings</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MarkedFiles</name>
|
<name>MarkedFiles</name>
|
||||||
@@ -424,6 +436,33 @@
|
|||||||
<translation>Select columns</translation>
|
<translation>Select columns</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsDialog</name>
|
||||||
|
<message>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Settings</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>How many images are preloaded before and after current image.</source>
|
||||||
|
<translation>How many images are preloaded before and after current image.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Thumbnail size in pixels</source>
|
||||||
|
<translation>Thumbnail size in pixels</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Image preload count</source>
|
||||||
|
<translation>Image preload count</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Thumbnails size</source>
|
||||||
|
<translation>Thumbnails size</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Changes in settings will take effect after program restart.</source>
|
||||||
|
<translation>Changes in settings will take effect after program restart.</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>StretchToolbar</name>
|
<name>StretchToolbar</name>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
Binary file not shown.
@@ -326,6 +326,18 @@
|
|||||||
<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>Images (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Edit</source>
|
||||||
|
<translation>Éditer</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FITS header editor</source>
|
||||||
|
<translation>Éditeur d'en-tête FITS</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Réglages</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MarkedFiles</name>
|
<name>MarkedFiles</name>
|
||||||
@@ -424,6 +436,33 @@
|
|||||||
<translation>Choix des colonnes</translation>
|
<translation>Choix des colonnes</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsDialog</name>
|
||||||
|
<message>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Réglages</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>How many images are preloaded before and after current image.</source>
|
||||||
|
<translation>Combien d'images sont préchargées avant et après l'image courante.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Thumbnail size in pixels</source>
|
||||||
|
<translation>Taille des vignettes en pixels</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Image preload count</source>
|
||||||
|
<translation>Nombre d'images préchargées</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Thumbnails size</source>
|
||||||
|
<translation>Taille des vignette</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Changes in settings will take effect after program restart.</source>
|
||||||
|
<translation>Les changements de paramètres prendront effet après le redémarrage du programme.</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>StretchToolbar</name>
|
<name>StretchToolbar</name>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
Binary file not shown.
@@ -339,6 +339,18 @@
|
|||||||
<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>Obrázky (*.jpg *.jpeg *.png *.cr2 *.nef *.dng *.fit *.fits *.xisf *.JPG *.JPEG *.PNG *.CR2 *.NEF *.DNG *.FIT *.FITS *.XISF)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Edit</source>
|
||||||
|
<translation>Upraviť</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FITS header editor</source>
|
||||||
|
<translation>Editor FITS hlavičky</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Nastavenia</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MarkedFiles</name>
|
<name>MarkedFiles</name>
|
||||||
@@ -437,6 +449,33 @@
|
|||||||
<translation>Výber stĺpcov</translation>
|
<translation>Výber stĺpcov</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsDialog</name>
|
||||||
|
<message>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Nastavenia</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>How many images are preloaded before and after current image.</source>
|
||||||
|
<translation>Koľko obrázkov sa prednačíta pred a za aktuálnym obrázkom.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Thumbnail size in pixels</source>
|
||||||
|
<translation>Veľkosť náhľadu v pixeloch</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Image preload count</source>
|
||||||
|
<translation>Počet prednačítaných obrázkov</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Thumbnails size</source>
|
||||||
|
<translation>Veľkosť náhľadu</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Changes in settings will take effect after program restart.</source>
|
||||||
|
<translation>Zmeny v nastaveniach sa prejavia po reštarte programu.</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>StretchToolbar</name>
|
<name>StretchToolbar</name>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
Reference in New Issue
Block a user