#2167 statistics dialog. Include statistics snapshot under 'Snapshot all views to file'

This commit is contained in:
Bjørn Erik Jensen
2017-11-29 13:34:55 +01:00
parent 6e67f71082
commit 7fa9b15716
6 changed files with 62 additions and 24 deletions

View File

@@ -26,6 +26,7 @@
#include "RimViewWindow.h"
#include "RimView.h"
#include "RimCase.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RicSnapshotViewToFileFeature.h"
#include "RicSnapshotFilenameGenerator.h"
@@ -120,6 +121,11 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QStrin
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, riv);
// Statistics dialog
QImage img = riv->overlayInfoConfig()->statisticsDialogScreenShotImage();
absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName + "_Statistics", ".png");
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, img);
}
}
}

View File

@@ -20,6 +20,8 @@
#include "cafCmdFeature.h"
#include <QImage>
//==================================================================================================
///
//==================================================================================================

View File

@@ -116,13 +116,22 @@ void RicGridStatisticsDialog::setLabel(const QString& labelText)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicGridStatisticsDialog::setCurrentRimView(RimView* rimView)
void RicGridStatisticsDialog::updateFromRimView(RimView* rimView)
{
m_currentRimView = rimView;
setInfoText(m_currentRimView);
setHistogramData(m_currentRimView);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RicGridStatisticsDialog::screenShotImage()
{
QPixmap shot = QPixmap::grabWidget(m_mainViewWidget, m_mainViewWidget->rect());
return shot.toImage();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -212,10 +221,10 @@ void RicGridStatisticsDialog::setHistogramData(RimView* view)
void RicGridStatisticsDialog::createAndConnectToolbarActions()
{
QAction* scrShotToClipboardAction = m_toolBar->addAction(RicSnapshotViewToClipboardFeature::icon(), RicSnapshotViewToClipboardFeature::text());
connect(scrShotToClipboardAction, SIGNAL(triggered()), this, SLOT(screenShotToClipboard()));
connect(scrShotToClipboardAction, SIGNAL(triggered()), this, SLOT(slotScreenShotToClipboard()));
QAction* scrShotToFileAction = m_toolBar->addAction(RicSnapshotViewToFileFeature::icon(), RicSnapshotViewToFileFeature::text());
connect(scrShotToFileAction, SIGNAL(triggered()), this, SLOT(screenShotToFile()));
connect(scrShotToFileAction, SIGNAL(triggered()), this, SLOT(slotScreenShotToFile()));
}
//--------------------------------------------------------------------------------------------------
@@ -296,18 +305,18 @@ void RicGridStatisticsDialog::slotDialogFinished()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicGridStatisticsDialog::screenShotToClipboard()
void RicGridStatisticsDialog::slotScreenShotToClipboard()
{
QPixmap shot = QPixmap::grabWidget(m_mainViewWidget, m_mainViewWidget->rect());
RicSnapshotViewToClipboardFeature::copyToClipboard(shot.toImage());
QImage snapshotImage = screenShotImage();
RicSnapshotViewToClipboardFeature::copyToClipboard(snapshotImage);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicGridStatisticsDialog::screenShotToFile()
void RicGridStatisticsDialog::slotScreenShotToFile()
{
QPixmap shot = QPixmap::grabWidget(m_mainViewWidget, m_mainViewWidget->rect());
QImage snapshotImage = screenShotImage();
QString defaultFileBaseName;
if (m_currentRimView)
{
@@ -318,5 +327,5 @@ void RicGridStatisticsDialog::screenShotToFile()
{
defaultFileBaseName = "Snapshot_Statistics";
}
RicSnapshotViewToFileFeature::saveToFile(shot.toImage(), defaultFileBaseName);
RicSnapshotViewToFileFeature::saveToFile(snapshotImage, defaultFileBaseName);
}

View File

@@ -46,7 +46,8 @@ public:
~RicGridStatisticsDialog();
void setLabel(const QString& labelText);
void setCurrentRimView(RimView* rimView);
void updateFromRimView(RimView* rimView);
QImage screenShotImage();
private:
void setInfoText(RimView* eclipseView);
@@ -61,8 +62,8 @@ private:
private slots:
void slotDialogFinished();
void screenShotToClipboard();
void screenShotToFile();
void slotScreenShotToClipboard();
void slotScreenShotToFile();
private:
QToolBar* m_toolBar;