Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2415717ce0 | |||
| e7acbca01e |
+10
-1
@@ -2,6 +2,8 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
QMap<QString, QColor> headerHighlight;
|
||||||
|
|
||||||
ImageInfo::ImageInfo(QWidget *parent) : QTreeWidget(parent)
|
ImageInfo::ImageInfo(QWidget *parent) : QTreeWidget(parent)
|
||||||
{
|
{
|
||||||
setColumnCount(3);
|
setColumnCount(3);
|
||||||
@@ -25,7 +27,14 @@ void ImageInfo::setInfo(const ImageInfoData &info)
|
|||||||
QTreeWidgetItem *fitsHeader = new QTreeWidgetItem({tr("FITS Header")});
|
QTreeWidgetItem *fitsHeader = new QTreeWidgetItem({tr("FITS Header")});
|
||||||
for(const FITSRecord &record : info.fitsHeader)
|
for(const FITSRecord &record : info.fitsHeader)
|
||||||
{
|
{
|
||||||
new QTreeWidgetItem(fitsHeader, {record.key, record.value.toString().left(1024), record.comment});
|
QTreeWidgetItem *item = new QTreeWidgetItem(fitsHeader, {record.key, record.value.toString().left(1024), record.comment});
|
||||||
|
if(headerHighlight.contains(record.key))
|
||||||
|
{
|
||||||
|
QColor color = headerHighlight[record.key];
|
||||||
|
item->setBackground(0, color);
|
||||||
|
item->setBackground(1, color);
|
||||||
|
item->setBackground(2, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addTopLevelItem(fitsHeader);
|
addTopLevelItem(fitsHeader);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,15 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QColorDialog>
|
||||||
#include "rawimage.h"
|
#include "rawimage.h"
|
||||||
|
|
||||||
extern int DEFAULT_WIDTH;
|
extern int DEFAULT_WIDTH;
|
||||||
extern double SATURATION;
|
extern double SATURATION;
|
||||||
extern int FILTERING;
|
extern int FILTERING;
|
||||||
extern bool BESTFIT;
|
extern bool BESTFIT;
|
||||||
|
extern QMap<QString, QColor> headerHighlight;
|
||||||
|
|
||||||
class EvenNumber : public QSpinBox
|
class EvenNumber : public QSpinBox
|
||||||
{
|
{
|
||||||
@@ -87,6 +90,44 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
|
|||||||
m_bestFit->setChecked(BESTFIT);
|
m_bestFit->setChecked(BESTFIT);
|
||||||
|
|
||||||
|
|
||||||
|
m_headerHighlight = new QListWidget(this);
|
||||||
|
for(auto i = headerHighlight.begin(); i != headerHighlight.end(); i++)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(m_headerHighlight);
|
||||||
|
item->setText(i.key());
|
||||||
|
item->setBackground(i.value());
|
||||||
|
}
|
||||||
|
m_keyword = new QLineEdit(this);
|
||||||
|
QPushButton *color = new QPushButton(this);
|
||||||
|
QPixmap pix(16, 16);
|
||||||
|
pix.fill(m_color);
|
||||||
|
color->setIcon(pix);
|
||||||
|
connect(color, &QPushButton::clicked, [this, color](){
|
||||||
|
QColor rgb = QColorDialog::getColor(m_color, this);
|
||||||
|
if(rgb.isValid())
|
||||||
|
{
|
||||||
|
QPixmap pix(16, 16);
|
||||||
|
pix.fill(rgb);
|
||||||
|
color->setIcon(pix);
|
||||||
|
m_color = rgb;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
QPushButton *add = new QPushButton(tr("Add keyword highlight"), this);
|
||||||
|
connect(add, &QPushButton::clicked, [this](){
|
||||||
|
auto list = m_headerHighlight->findItems(m_keyword->text(), Qt::MatchFixedString | Qt::MatchCaseSensitive);
|
||||||
|
if(list.size())return;
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(m_headerHighlight);
|
||||||
|
item->setText(m_keyword->text());
|
||||||
|
item->setBackground(m_color);
|
||||||
|
});
|
||||||
|
QPushButton *remove = new QPushButton(tr("Remove keyword highlight"), this);
|
||||||
|
connect(remove, &QPushButton::clicked, [this](){
|
||||||
|
auto list = m_headerHighlight->selectedItems();
|
||||||
|
for(auto item : list)
|
||||||
|
delete item;
|
||||||
|
});
|
||||||
|
|
||||||
layout->addRow(tr("Image preload count"), m_preloadImages);
|
layout->addRow(tr("Image preload count"), m_preloadImages);
|
||||||
layout->addRow(tr("Thumbnails size"), m_thumSize);
|
layout->addRow(tr("Thumbnails size"), m_thumSize);
|
||||||
layout->addRow(tr("Saturation"), m_saturation);
|
layout->addRow(tr("Saturation"), m_saturation);
|
||||||
@@ -95,6 +136,9 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
|
|||||||
layout->addRow(m_qualityThumbnail);
|
layout->addRow(m_qualityThumbnail);
|
||||||
layout->addRow(m_useNativeDialog);
|
layout->addRow(m_useNativeDialog);
|
||||||
layout->addRow(m_bestFit);
|
layout->addRow(m_bestFit);
|
||||||
|
layout->addRow(m_headerHighlight);
|
||||||
|
layout->addRow(m_keyword, color);
|
||||||
|
layout->addRow(add, remove);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
QPushButton *installThumbnailer = new QPushButton(tr("Install"), this);
|
QPushButton *installThumbnailer = new QPushButton(tr("Install"), this);
|
||||||
@@ -125,6 +169,11 @@ void SettingsDialog::loadSettings()
|
|||||||
FILTERING = settings.value("settings/filtering", FILTERING).toInt();
|
FILTERING = settings.value("settings/filtering", FILTERING).toInt();
|
||||||
QUALITY_RESIZE = settings.value("settings/qualitythumbnail", QUALITY_RESIZE).toBool();
|
QUALITY_RESIZE = settings.value("settings/qualitythumbnail", QUALITY_RESIZE).toBool();
|
||||||
BESTFIT = settings.value("settings/bestfit", BESTFIT).toBool();
|
BESTFIT = settings.value("settings/bestfit", BESTFIT).toBool();
|
||||||
|
QStringList keywords = settings.value("settings/headerhighlightkeywords").toStringList();
|
||||||
|
QStringList colors = settings.value("settings/headerhighlightcolors").toStringList();
|
||||||
|
for(int i = 0; i < std::min(keywords.size(), colors.size()); i++)
|
||||||
|
headerHighlight.insert(keywords[i], QColor::fromString(colors[i]));
|
||||||
|
|
||||||
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, settings.value("settings/dontusenativedialogs", false).toBool());
|
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, settings.value("settings/dontusenativedialogs", false).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,4 +224,15 @@ void SettingsDialog::saveSettings()
|
|||||||
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, m_useNativeDialog->isChecked());
|
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, m_useNativeDialog->isChecked());
|
||||||
if(DEFAULT_WIDTH != m_preloadImages->value())
|
if(DEFAULT_WIDTH != m_preloadImages->value())
|
||||||
emit preloadChanged(m_preloadImages->value());
|
emit preloadChanged(m_preloadImages->value());
|
||||||
|
|
||||||
|
headerHighlight.clear();
|
||||||
|
QStringList colors;
|
||||||
|
for(int i = 0; i < m_headerHighlight->count(); i++)
|
||||||
|
{
|
||||||
|
auto item = m_headerHighlight->item(i);
|
||||||
|
colors.push_back(item->background().color().name());
|
||||||
|
headerHighlight[item->text()] = item->background().color();
|
||||||
|
}
|
||||||
|
settings.setValue("settings/headerhighlightkeywords", headerHighlight.keys());
|
||||||
|
settings.setValue("settings/headerhighlightcolors", colors);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QListWidget>
|
||||||
|
|
||||||
class SettingsDialog : public QDialog
|
class SettingsDialog : public QDialog
|
||||||
{
|
{
|
||||||
@@ -28,6 +29,9 @@ private:
|
|||||||
QCheckBox *m_qualityThumbnail;
|
QCheckBox *m_qualityThumbnail;
|
||||||
QComboBox *m_filtering;
|
QComboBox *m_filtering;
|
||||||
QCheckBox *m_bestFit;
|
QCheckBox *m_bestFit;
|
||||||
|
QListWidget *m_headerHighlight;
|
||||||
|
QColor m_color = Qt::yellow;
|
||||||
|
QLineEdit *m_keyword;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
||||||
|
|||||||
+78
-12
@@ -12,7 +12,7 @@ static float clamp(float x)
|
|||||||
|
|
||||||
STFSlider::STFSlider(const QColor &color, QWidget *parent) : QWidget(parent)
|
STFSlider::STFSlider(const QColor &color, QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
setMinimumWidth(100);
|
setMinimumWidth(100);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
@@ -64,12 +64,51 @@ void STFSlider::setMTFParams(float low, float mid, float high)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void STFSlider::orientationChanged(Qt::Orientations orientation)
|
||||||
|
{
|
||||||
|
m_orientation = orientation;
|
||||||
|
if(m_orientation == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
if(m_color == Qt::white)
|
||||||
|
{
|
||||||
|
setMaximumSize(QWIDGETSIZE_MAX, 16);
|
||||||
|
setMinimumSize(16, 16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setMaximumSize(QWIDGETSIZE_MAX, 10);
|
||||||
|
setMinimumSize(10, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(m_color == Qt::white)
|
||||||
|
{
|
||||||
|
setMaximumSize(16, QWIDGETSIZE_MAX);
|
||||||
|
setMinimumSize(16, 16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setMaximumSize(10, QWIDGETSIZE_MAX);
|
||||||
|
setMinimumSize(10, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void STFSlider::paintEvent(QPaintEvent *event)
|
void STFSlider::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
QRect rect = event->rect();
|
QRect rect = event->rect();
|
||||||
qreal w = rect.width() - 1;
|
qreal w = rect.width() - 1;
|
||||||
qreal h = rect.height();
|
qreal h = rect.height();
|
||||||
|
if(m_orientation == Qt::Vertical)
|
||||||
|
{
|
||||||
|
rect = rect.transposed();
|
||||||
|
painter.rotate(90);
|
||||||
|
w = rect.width() - 1;
|
||||||
|
h = rect.height();
|
||||||
|
painter.translate(0, -h);
|
||||||
|
}
|
||||||
QLinearGradient gradient(rect.topLeft(), rect.topRight());
|
QLinearGradient gradient(rect.topLeft(), rect.topRight());
|
||||||
gradient.setColorAt(0, Qt::black);
|
gradient.setColorAt(0, Qt::black);
|
||||||
for(int i=1; i<=32; i++)
|
for(int i=1; i<=32; i++)
|
||||||
@@ -93,6 +132,11 @@ void STFSlider::paintEvent(QPaintEvent *event)
|
|||||||
{
|
{
|
||||||
painter.setPen(p < m_threshold ? Qt::white : Qt::black);
|
painter.setPen(p < m_threshold ? Qt::white : Qt::black);
|
||||||
painter.resetTransform();
|
painter.resetTransform();
|
||||||
|
if(m_orientation == Qt::Vertical)
|
||||||
|
{
|
||||||
|
painter.rotate(90);
|
||||||
|
painter.translate(0, -h);
|
||||||
|
}
|
||||||
painter.translate(w*p, 0);
|
painter.translate(w*p, 0);
|
||||||
painter.drawPath(tick);
|
painter.drawPath(tick);
|
||||||
};
|
};
|
||||||
@@ -105,15 +149,26 @@ void STFSlider::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
void STFSlider::mouseMoveEvent(QMouseEvent *event)
|
void STFSlider::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
const qreal x = event->position().x();
|
qreal x,w;
|
||||||
if(std::abs(m_blackPoint*width() - x) < 5 ||
|
if(m_orientation == Qt::Horizontal)
|
||||||
std::abs((m_blackPoint + (m_whitePoint - m_blackPoint) * m_midPoint)*width() - x) < 5 ||
|
{
|
||||||
std::abs(m_whitePoint*width() - x) < 5)
|
x = event->position().x();
|
||||||
setCursor(Qt::SplitHCursor);
|
w = width();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = event->position().y();
|
||||||
|
w = height();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(std::abs(m_blackPoint*w - x) < 5 ||
|
||||||
|
std::abs((m_blackPoint + (m_whitePoint - m_blackPoint) * m_midPoint)*w - x) < 5 ||
|
||||||
|
std::abs(m_whitePoint*w - x) < 5)
|
||||||
|
setCursor(m_orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor);
|
||||||
else
|
else
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
|
|
||||||
qreal xw = x/width();
|
qreal xw = x/w;
|
||||||
if(event->modifiers() & Qt::ShiftModifier && !m_fineTune)
|
if(event->modifiers() & Qt::ShiftModifier && !m_fineTune)
|
||||||
{
|
{
|
||||||
m_fineTune = true;
|
m_fineTune = true;
|
||||||
@@ -154,18 +209,29 @@ void STFSlider::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
void STFSlider::mousePressEvent(QMouseEvent *event)
|
void STFSlider::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
const qreal x = event->position().x();
|
qreal x,w;
|
||||||
|
if(m_orientation == Qt::Horizontal)
|
||||||
|
{
|
||||||
|
x = event->position().x();
|
||||||
|
w = width();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = event->position().y();
|
||||||
|
w = height();
|
||||||
|
}
|
||||||
|
|
||||||
if(event->modifiers() & Qt::ShiftModifier)
|
if(event->modifiers() & Qt::ShiftModifier)
|
||||||
{
|
{
|
||||||
m_fineTune = true;
|
m_fineTune = true;
|
||||||
m_fineTuneX = x/width();
|
m_fineTuneX = x/w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(std::abs((m_blackPoint + (m_whitePoint - m_blackPoint) * m_midPoint)*width() - x) < 5)
|
if(std::abs((m_blackPoint + (m_whitePoint - m_blackPoint) * m_midPoint)*w - x) < 5)
|
||||||
m_grabbed = 1;
|
m_grabbed = 1;
|
||||||
else if(std::abs(m_blackPoint*width() - x) < 5)
|
else if(std::abs(m_blackPoint*w - x) < 5)
|
||||||
m_grabbed = 0;
|
m_grabbed = 0;
|
||||||
else if(std::abs(m_whitePoint*width() - x) < 5)
|
else if(std::abs(m_whitePoint*w - x) < 5)
|
||||||
m_grabbed = 2;
|
m_grabbed = 2;
|
||||||
else
|
else
|
||||||
m_grabbed = -1;
|
m_grabbed = -1;
|
||||||
|
|||||||
@@ -15,12 +15,15 @@ class STFSlider : public QWidget
|
|||||||
float m_fineTuneX;
|
float m_fineTuneX;
|
||||||
QColor m_color;
|
QColor m_color;
|
||||||
float m_threshold;
|
float m_threshold;
|
||||||
|
Qt::Orientations m_orientation = Qt::Horizontal;
|
||||||
public:
|
public:
|
||||||
explicit STFSlider(const QColor &color = Qt::white, QWidget *parent = nullptr);
|
explicit STFSlider(const QColor &color = Qt::white, QWidget *parent = nullptr);
|
||||||
float blackPoint() const;
|
float blackPoint() const;
|
||||||
float midPoint() const;
|
float midPoint() const;
|
||||||
float whitePoint() const;
|
float whitePoint() const;
|
||||||
void setMTFParams(float low, float mid, float high);
|
void setMTFParams(float low, float mid, float high);
|
||||||
|
public slots:
|
||||||
|
void orientationChanged(Qt::Orientations orientation);
|
||||||
signals:
|
signals:
|
||||||
void paramChanged(float blackPoint, float midPoint, float whitePoint);
|
void paramChanged(float blackPoint, float midPoint, float whitePoint);
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
+12
-16
@@ -6,17 +6,6 @@
|
|||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include "imageringlist.h"
|
#include "imageringlist.h"
|
||||||
|
|
||||||
const float BLACK_POINT_SIGMA = -2.8f;
|
|
||||||
const float MAD_TO_SIGMA = 1.4826f;
|
|
||||||
const float TARGET_BACKGROUND = 0.25f;
|
|
||||||
|
|
||||||
float MTF(float x, float m)
|
|
||||||
{
|
|
||||||
if(x < 0)return 0;
|
|
||||||
if(x > 1)return 1;
|
|
||||||
return ((m - 1) * x) / ((2 * m - 1) * x - m);
|
|
||||||
}
|
|
||||||
|
|
||||||
StretchToolbar::StretchToolbar(QWidget *parent) : QToolBar(tr("Stretch toolbar"), parent)
|
StretchToolbar::StretchToolbar(QWidget *parent) : QToolBar(tr("Stretch toolbar"), parent)
|
||||||
{
|
{
|
||||||
setObjectName("stretchtoolbar");
|
setObjectName("stretchtoolbar");
|
||||||
@@ -24,16 +13,23 @@ StretchToolbar::StretchToolbar(QWidget *parent) : QToolBar(tr("Stretch toolbar")
|
|||||||
QVBoxLayout *vbox1 = new QVBoxLayout(lum);
|
QVBoxLayout *vbox1 = new QVBoxLayout(lum);
|
||||||
m_stfSlider = new STFSlider(Qt::white, this);
|
m_stfSlider = new STFSlider(Qt::white, this);
|
||||||
vbox1->addWidget(m_stfSlider);
|
vbox1->addWidget(m_stfSlider);
|
||||||
|
connect(this, &StretchToolbar::orientationChanged, m_stfSlider, &STFSlider::orientationChanged);
|
||||||
|
|
||||||
m_stfSliderR = new STFSlider(Qt::red, this);
|
m_stfSliderR = new STFSlider(Qt::red, this);
|
||||||
m_stfSliderG = new STFSlider(Qt::green, this);
|
m_stfSliderG = new STFSlider(Qt::green, this);
|
||||||
m_stfSliderB = new STFSlider(Qt::blue, this);
|
m_stfSliderB = new STFSlider(Qt::blue, this);
|
||||||
QWidget *rgb = new QWidget(this);
|
QWidget *rgb = new QWidget(this);
|
||||||
QVBoxLayout *vbox2 = new QVBoxLayout(rgb);
|
QBoxLayout *box2 = new QBoxLayout(orientation() == Qt::Horizontal ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight, rgb);
|
||||||
vbox2->setSpacing(0);
|
box2->setSpacing(0);
|
||||||
vbox2->addWidget(m_stfSliderR);
|
box2->addWidget(m_stfSliderR);
|
||||||
vbox2->addWidget(m_stfSliderG);
|
box2->addWidget(m_stfSliderG);
|
||||||
vbox2->addWidget(m_stfSliderB);
|
box2->addWidget(m_stfSliderB);
|
||||||
|
connect(this, &StretchToolbar::orientationChanged, m_stfSliderR, &STFSlider::orientationChanged);
|
||||||
|
connect(this, &StretchToolbar::orientationChanged, m_stfSliderG, &STFSlider::orientationChanged);
|
||||||
|
connect(this, &StretchToolbar::orientationChanged, m_stfSliderB, &STFSlider::orientationChanged);
|
||||||
|
connect(this, &StretchToolbar::orientationChanged, [box2](Qt::Orientations orientation){
|
||||||
|
box2->setDirection(orientation == Qt::Horizontal ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
|
||||||
|
});
|
||||||
|
|
||||||
m_stack = new QStackedWidget(this);
|
m_stack = new QStackedWidget(this);
|
||||||
m_stack->addWidget(lum);
|
m_stack->addWidget(lum);
|
||||||
|
|||||||
Reference in New Issue
Block a user