diff --git a/kstars/fitsviewer/fitsheaderdialog.ui b/kstars/fitsviewer/fitsheaderdialog.ui
--- a/kstars/fitsviewer/fitsheaderdialog.ui
+++ b/kstars/fitsviewer/fitsheaderdialog.ui
@@ -60,32 +60,8 @@
- -
-
-
- QDialogButtonBox::Close
-
-
-
-
-
- buttonBox
- rejected()
- fitsHeaderDialog
- reject()
-
-
- 466
- 233
-
-
- 436
- 243
-
-
-
-
+
diff --git a/kstars/fitsviewer/fitshistogram.h b/kstars/fitsviewer/fitshistogram.h
--- a/kstars/fitsviewer/fitshistogram.h
+++ b/kstars/fitsviewer/fitshistogram.h
@@ -58,6 +58,7 @@
void updateValues(QMouseEvent *event);
void updateLimits(double value);
void checkRangeLimit(const QCPRange &range);
+ void resizePlot();
private:
template
diff --git a/kstars/fitsviewer/fitshistogram.cpp b/kstars/fitsviewer/fitshistogram.cpp
--- a/kstars/fitsviewer/fitshistogram.cpp
+++ b/kstars/fitsviewer/fitshistogram.cpp
@@ -277,16 +277,28 @@
customPlot->xAxis->setRange(fits_min, fits_max);
if (maxFrequency > 0)
- customPlot->yAxis->setRange(0, maxFrequency);
+ customPlot->yAxis->rescale();
customPlot->setInteraction(QCP::iRangeDrag, true);
customPlot->setInteraction(QCP::iRangeZoom, true);
customPlot->setInteraction(QCP::iSelectPlottables, true);
customPlot->replot();
+ resizePlot();
isGUISynced = true;
}
+
+void FITSHistogram::resizePlot()
+{
+ if(customPlot->width()<300)
+ customPlot->yAxis->setTickLabels(false);
+ else
+ customPlot->yAxis->setTickLabels(true);
+ customPlot->xAxis->ticker()->setTickCount(customPlot->width()/100);
+
+}
+
#if 0
template
void FITSHistogram::constructHistogram()
diff --git a/kstars/fitsviewer/fitshistogramui.ui b/kstars/fitsviewer/fitshistogramui.ui
--- a/kstars/fitsviewer/fitshistogramui.ui
+++ b/kstars/fitsviewer/fitshistogramui.ui
@@ -6,8 +6,8 @@
0
0
- 640
- 360
+ 212
+ 528
@@ -35,6 +35,18 @@
true
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
-
@@ -45,7 +57,7 @@
- 500
+ 0
200
@@ -61,22 +73,42 @@
-
-
-
+
-
+
+
+ -
+
+
+ Mean:
+
+
+
+ -
+
+
+ Intensity:
+
+
+
+ -
+
+
+ -
- Min.
+ Min.:
- -
-
+
-
+
- Max.
+ Frequency:
- -
-
+
-
+
0
@@ -88,8 +120,8 @@
- -
-
+
-
+
0
@@ -101,8 +133,15 @@
- -
-
+
-
+
+
+ Max:
+
+
+
+ -
+
0
@@ -114,14 +153,14 @@
- -
+
-
- Median
+ Median:
- -
+
-
@@ -134,88 +173,48 @@
- -
-
-
- Intensity:
-
-
-
- -
-
-
- Frequency:
-
-
-
- -
-
-
- Mean
-
-
-
- -
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::LeftToRight
-
-
- false
-
-
- FITS Scale
-
-
-
-
-
-
- L&inear
-
-
- true
-
-
-
- -
-
-
- &Logarithmic
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::LeftToRight
+
+
+ false
+
+
+ FITS Scale
+
+
+
-
+
+
+ L&inear
+
+
+ true
+
+
+
+ -
+
+
+ &Log
+
+
+
+
+
+
-
@@ -234,22 +233,5 @@
-
-
- buttonBox
- rejected()
- FITSHistogramUI
- reject()
-
-
- 589
- 336
-
-
- 579
- 357
-
-
-
-
+
diff --git a/kstars/fitsviewer/fitstab.h b/kstars/fitsviewer/fitstab.h
--- a/kstars/fitsviewer/fitstab.h
+++ b/kstars/fitsviewer/fitstab.h
@@ -19,8 +19,12 @@
#include "fitscommon.h"
#include
+#include
+#include
#include
#include
+#include "ui_fitsheaderdialog.h"
+#include "ui_statform.h"
#include
#include
@@ -54,8 +58,10 @@
bool saveFile();
bool saveFileAs();
void copyFITS();
+ void loadFITSHeader();
void headerFITS();
void histoFITS();
+ void evaluateStats();
void statFITS();
void setUID(int newID) { uid = newID; }
@@ -80,6 +86,13 @@
private:
/** Ask user whether he wants to save changes and save if he do. */
+ QToolBox *fitsTools;
+ QDialog *fitsHeaderDialog;
+ Ui::statForm stat;
+ Ui::fitsHeaderDialog header;
+
+ QDialog *statWidget;
+
/// FITS image object
std::unique_ptr view;
/// FITS Histogram
@@ -95,6 +108,8 @@
QString previewText;
int uid { 0 };
+ QSplitter *fitsSplitter;
+
QFuture histogramFuture;
diff --git a/kstars/fitsviewer/fitstab.cpp b/kstars/fitsviewer/fitstab.cpp
--- a/kstars/fitsviewer/fitstab.cpp
+++ b/kstars/fitsviewer/fitstab.cpp
@@ -35,6 +35,10 @@
undoStack->setUndoLimit(10);
undoStack->clear();
connect(undoStack, SIGNAL(cleanChanged(bool)), this, SLOT(modifyFITSState(bool)));
+
+ statWidget = new QDialog(this);
+ fitsHeaderDialog = new QDialog(this);
+ histogram = new FITSHistogram(this);
}
FITSTab::~FITSTab()
@@ -89,7 +93,33 @@
view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout *vlayout = new QVBoxLayout();
- vlayout->addWidget(view.get());
+ fitsSplitter = new QSplitter(Qt::Horizontal,this);
+ fitsTools = new QToolBox();
+
+ stat.setupUi(statWidget);
+ fitsTools->addItem(statWidget,"Statistics");
+
+ fitsTools->addItem(histogram,"Histogram");
+
+
+ header.setupUi(fitsHeaderDialog);
+ fitsTools->addItem(fitsHeaderDialog,"Fits Header");
+
+ QScrollArea *scrollFitsPanel = new QScrollArea(fitsSplitter);
+ scrollFitsPanel->setWidgetResizable(true);
+ scrollFitsPanel->setWidget(fitsTools);
+
+ fitsSplitter->addWidget(scrollFitsPanel);
+ fitsSplitter->addWidget(view.get());
+
+
+ //This code allows the fitsTools to start in a closed state
+ fitsSplitter->setSizes(QList() << 0 << view->width() );
+
+ vlayout->addWidget(fitsSplitter);
+
+ connect(fitsSplitter, &QSplitter::splitterMoved, histogram, &FITSHistogram::resizePlot);
+
setLayout(vlayout);
connect(view.get(), &FITSView::newStatus, this, &FITSTab::newStatus);
@@ -123,6 +153,9 @@
if (viewer->isStarsMarked())
view->toggleStars(true);
+ evaluateStats();
+ loadFITSHeader();
+
view->updateFrame();
emit loaded();
@@ -163,14 +196,15 @@
void FITSTab::histoFITS()
{
- histogram->show();
+ fitsTools->setCurrentIndex(1);
+ if(view->width()>200)
+ fitsSplitter->setSizes(QList() << 200 << view->width() - 200);
+ else
+ fitsSplitter->setSizes(QList() << 50 << 50);
}
-void FITSTab::statFITS()
+void FITSTab::evaluateStats()
{
- QDialog statDialog;
- Ui::statForm stat;
- stat.setupUi(&statDialog);
FITSData *image_data = view->getImageData();
@@ -184,19 +218,23 @@
stat.HFROUT->setText(QString::number(image_data->getHFR(), 'f', 3));
stat.medianOUT->setText(QString::number(image_data->getMedian(), 'f', 3));
stat.SNROUT->setText(QString::number(image_data->getSNR(), 'f', 3));
+}
- statDialog.exec();
+void FITSTab::statFITS()
+{
+ fitsTools->setCurrentIndex(0);
+ if(view->width()>200)
+ fitsSplitter->setSizes(QList() << 200 << view->width() - 200);
+ else
+ fitsSplitter->setSizes(QList() << 50 << 50);
}
-void FITSTab::headerFITS()
+void FITSTab::loadFITSHeader()
{
FITSData *image_data = view->getImageData();
- QDialog fitsHeaderDialog;
- Ui::fitsHeaderDialog header;
int nkeys = image_data->getRecords().size();
int counter=0;
- header.setupUi(&fitsHeaderDialog);
header.tableWidget->setRowCount(nkeys);
for (FITSData::Record *oneRecord : image_data->getRecords())
{
@@ -212,8 +250,18 @@
counter++;
}
- header.tableWidget->resizeColumnsToContents();
- fitsHeaderDialog.exec();
+ header.tableWidget->setColumnWidth(0,100);
+ header.tableWidget->setColumnWidth(1,100);
+ header.tableWidget->setColumnWidth(2,250);
+}
+
+void FITSTab::headerFITS()
+{
+ fitsTools->setCurrentIndex(2);
+ if(view->width()>200)
+ fitsSplitter->setSizes(QList() << 200 << view->width() - 200);
+ else
+ fitsSplitter->setSizes(QList() << 50 << 50);
}
bool FITSTab::saveFile()
diff --git a/kstars/fitsviewer/statform.ui b/kstars/fitsviewer/statform.ui
--- a/kstars/fitsviewer/statform.ui
+++ b/kstars/fitsviewer/statform.ui
@@ -6,130 +6,162 @@
0
0
- 311
- 227
+ 172
+ 390
Statistics
-
-
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ -1
+
+
-
+
+
+ Standard Deviation
+
+
+ Std. dev:
+
+
+
+ -
+
+
+ Height:
+
+
+
+ -
+
+
+ Bitpix:
+
+
+
+ -
Width:
- -
-
+
-
+
true
- -
-
-
- Height:
+
-
+
+
+ true
- -
-
+
-
+
true
- -
-
+
-
+
- Min:
+
+
+
+ true
- -
-
+
-
+
true
- -
-
-
- Max:
+
-
+
+
+ true
-
-
+
true
- -
-
-
- Bitpix:
+
-
+
+
+ true
- -
-
+
-
+
true
- -
-
-
- Standard Deviation
-
-
- Std. dev:
+
-
+
+
+ true
- -
-
-
- true
+
-
+
+
+ Min:
- -
+
-
Mean:
- -
-
-
- true
+
-
+
+
+ Max:
- -
+
-
Median
- -
-
-
- true
-
-
-
- -
+
-
Half-Flux Radius
@@ -139,14 +171,7 @@
- -
-
-
- true
-
-
-
- -
+
-
Signal to Noise Ratio
@@ -156,15 +181,18 @@
- -
-
-
-
+
-
+
+
+ Qt::Vertical
-
- true
+
+
+ 20
+ 40
+
-
+