#4095 System : Add preferences to control project changed and Octave warning dialogs

This commit is contained in:
Magne Sjaastad 2019-02-15 09:07:13 +01:00
parent cdbb13f9f4
commit a0c983a84e
4 changed files with 59 additions and 11 deletions

View File

@ -929,7 +929,7 @@ bool RiaApplication::hasValidProjectFileExtension(const QString& fileName)
//--------------------------------------------------------------------------------------------------
bool RiaApplication::askUserToSaveModifiedProject()
{
if (caf::PdmUiModelChangeDetector::instance()->isModelChanged())
if (m_preferences->showProjectChangedDialog() && caf::PdmUiModelChangeDetector::instance()->isModelChanged())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question);
@ -1858,7 +1858,7 @@ void RiaApplication::applyPreferences()
}
RiaFontCache::FontSize fontSizeType = m_preferences->fontSizeInScene();
m_customFont = RiaFontCache::getFont(fontSizeType);
m_customFont = RiaFontCache::getFont(fontSizeType);
if (this->project())
{

View File

@ -112,6 +112,12 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&holoLensDisableCertificateVerification, "holoLensDisableCertificateVerification", false, "Disable SSL Certificate Verification (HoloLens)", "", "", "");
holoLensDisableCertificateVerification.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&m_showProjectChangedDialog, "showProjectChangedDialog", true, "Show 'Project has changed' dialog", "", "", "");
m_showProjectChangedDialog.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&m_showOctaveWarningForMultipleInstances, "showOctaveWarningForMultipleInstances", true, "Show Octave communication warning when multiple instances are created", "", "", "");
m_showOctaveWarningForMultipleInstances.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitFieldNoDefault(&m_readerSettings, "readerSettings", "Reader Settings", "", "", "");
m_readerSettings = new RifReaderSettings;
@ -158,7 +164,9 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &m_showTestToolbar ||
field == &m_includeFractureDebugInfoFile ||
field == &showLasCurveWithoutTvdWarning ||
field == &holoLensDisableCertificateVerification)
field == &holoLensDisableCertificateVerification ||
field == &m_showProjectChangedDialog ||
field == &m_showOctaveWarningForMultipleInstances)
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr)
@ -233,6 +241,10 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{
uiOrdering.add(&m_appendClassNameToUiText);
uiOrdering.add(&m_appendFieldKeywordToToolTipText);
uiOrdering.add(&m_showProjectChangedDialog);
uiOrdering.add(&m_showOctaveWarningForMultipleInstances);
uiOrdering.add(&m_showTestToolbar);
uiOrdering.add(&m_includeFractureDebugInfoFile);
uiOrdering.add(&m_holoLensExportFolder);
@ -310,6 +322,32 @@ bool RiaPreferences::includeFractureDebugInfoFile() const
return RiaApplication::enableDevelopmentFeatures() && m_includeFractureDebugInfoFile();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::showProjectChangedDialog() const
{
if (!RiaApplication::enableDevelopmentFeatures())
{
return true;
}
return m_showProjectChangedDialog();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::showOctaveCommunicationWarning() const
{
if (!RiaApplication::enableDevelopmentFeatures())
{
return true;
}
return m_showOctaveWarningForMultipleInstances();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -55,6 +55,8 @@ public:
bool appendFieldKeywordToToolTipText() const;
bool showTestToolbar() const;
bool includeFractureDebugInfoFile() const;
bool showProjectChangedDialog() const;
bool showOctaveCommunicationWarning() const;
QString holoLensExportFolder() const;
public: // Pdm Fields
@ -101,6 +103,10 @@ private:
caf::PdmChildField<RifReaderSettings*> m_readerSettings;
caf::PdmField<bool> m_appendClassNameToUiText;
caf::PdmField<bool> m_appendFieldKeywordToToolTipText;
caf::PdmField<bool> m_showProjectChangedDialog;
caf::PdmField<bool> m_showOctaveWarningForMultipleInstances;
caf::PdmField<bool> m_showTestToolbar;
caf::PdmField<bool> m_includeFractureDebugInfoFile;
caf::PdmField<QString> m_holoLensExportFolder;

View File

@ -22,6 +22,7 @@
#include "RiaSocketCommand.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
@ -67,14 +68,17 @@ RiaSocketServer::RiaSocketServer(QObject* parent)
if (!m_tcpServer->listen(QHostAddress::LocalHost, 40001))
{
m_errorMessageDialog->showMessage("Octave communication disabled :\n"
"\n"
"This instance of ResInsight could not start the Socket Server enabling octave to get and set data.\n"
"This is probably because you already have a running ResInsight process.\n"
"Octave can only communicate with one ResInsight process at a time, so the Octave\n"
"communication in this ResInsight instance will be disabled.\n"
"\n"
+ tr("The error from the socket system is: %1.").arg(m_tcpServer->errorString()));
if (RiaApplication::instance()->preferences()->showOctaveCommunicationWarning())
{
m_errorMessageDialog->showMessage("Octave communication disabled :\n"
"\n"
"This instance of ResInsight could not start the Socket Server enabling octave to get and set data.\n"
"This is probably because you already have a running ResInsight process.\n"
"Octave can only communicate with one ResInsight process at a time, so the Octave\n"
"communication in this ResInsight instance will be disabled.\n"
"\n"
+ tr("The error from the socket system is: %1.").arg(m_tcpServer->errorString()));
}
return;
}