mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5528 Multi Plot : Add optional display of PDF in preferences
This commit is contained in:
parent
a3519a6e00
commit
027b7ed27c
@ -391,6 +391,9 @@ RiaPreferences::RiaPreferences( void )
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitField( &m_defaultPlotFontSize_OBSOLETE, "defaultPlotFontSize", invalidFontSize, "Plot Font Size", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_openExportedPdfInViewer, "openExportedPdfInViewer", false, "Open Exported PDF in Viewer", "", "", "" );
|
||||
m_openExportedPdfInViewer.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -430,7 +433,7 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
field == &m_showProjectChangedDialog || field == &m_searchPlotTemplateFoldersRecursively ||
|
||||
field == &m_showLegendBackground || field == &m_showSummaryTimeAsLongString ||
|
||||
field == &m_showViewIdInProjectTree || field == &m_useMultipleThreadsWhenLoadingSummaryData ||
|
||||
field == &m_enableFaultsByDefault || field == &m_showProgressBar )
|
||||
field == &m_enableFaultsByDefault || field == &m_showProgressBar || field == &m_openExportedPdfInViewer )
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
@ -563,6 +566,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
else if ( uiConfigName == RiaPreferences::tabNameExport() )
|
||||
{
|
||||
uiOrdering.add( &csvTextExportFieldSeparator );
|
||||
uiOrdering.add( &m_openExportedPdfInViewer );
|
||||
}
|
||||
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
|
||||
{
|
||||
@ -961,6 +965,14 @@ bool RiaPreferences::showProgressBar() const
|
||||
return m_showProgressBar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaPreferences::openExportedPdfInViewer() const
|
||||
{
|
||||
return m_openExportedPdfInViewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -103,6 +103,7 @@ public:
|
||||
bool showSummaryTimeAsLongString() const;
|
||||
bool useMultipleThreadsWhenReadingSummaryData() const;
|
||||
bool showProgressBar() const;
|
||||
bool openExportedPdfInViewer() const;
|
||||
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
@ -204,6 +205,7 @@ private:
|
||||
caf::PdmField<double> m_pageRightMargin;
|
||||
caf::PdmField<double> m_pageTopMargin;
|
||||
caf::PdmField<double> m_pageBottomMargin;
|
||||
caf::PdmField<bool> m_openExportedPdfInViewer;
|
||||
|
||||
caf::PdmField<QString> m_plotTemplateFolders;
|
||||
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
|
||||
|
@ -18,14 +18,19 @@
|
||||
|
||||
#include "RicSnapshotViewToPdfFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RicSnapshotFilenameGenerator.h"
|
||||
#include "RicSnapshotViewToFileFeature.h"
|
||||
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicSnapshotViewToPdfFeature, "RicSnapshotViewToPdfFeature" );
|
||||
|
||||
@ -66,6 +71,11 @@ void RicSnapshotViewToPdfFeature::onActionTriggered( bool isChecked )
|
||||
if ( plotWindow && fileName.endsWith( "PDF", Qt::CaseInsensitive ) )
|
||||
{
|
||||
RicSnapshotViewToFileFeature::savePlotPdfReportAs( fileName, plotWindow );
|
||||
|
||||
if ( RiaApplication::instance()->preferences()->openExportedPdfInViewer() )
|
||||
{
|
||||
QDesktopServices::openUrl( fileName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user