#4377 Octave : Use RiaLogging for error messages instead of QErrorMessage

This commit is contained in:
Magne Sjaastad
2019-04-29 07:58:37 +02:00
parent 950458455d
commit f758a8edb2
7 changed files with 76 additions and 68 deletions

View File

@@ -221,8 +221,6 @@ RiaApplication::RiaApplication(int& argc, char** argv)
setWindowIcon(QIcon(":/AppLogo48x48.png")); setWindowIcon(QIcon(":/AppLogo48x48.png"));
m_socketServer = new RiaSocketServer(this);
#ifdef WIN32 #ifdef WIN32
m_startupDefaultDirectory = QDir::homePath(); m_startupDefaultDirectory = QDir::homePath();
#else #else
@@ -240,6 +238,8 @@ RiaApplication::RiaApplication(int& argc, char** argv)
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(m_mainWindow->messagePanel())); RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(m_mainWindow->messagePanel()));
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG); RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
m_socketServer = new RiaSocketServer(this);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -44,7 +44,6 @@
#include "RimSimWellInViewCollection.h" #include "RimSimWellInViewCollection.h"
#include <QTcpSocket> #include <QTcpSocket>
#include <QErrorMessage>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -148,7 +147,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetDynamicNNCValues : \n") + RiaSocketServer::tr("An error occurred while interpreting the requested time steps.")); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetDynamicNNCValues : \n") + RiaSocketServer::tr("An error occurred while interpreting the requested time steps."));
} }
} }
else else
@@ -319,7 +318,7 @@ public:
if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid()))
{ {
QString caseId = args[1]; QString caseId = args[1];
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find case with id %1").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find case with id %1").arg(caseId));
return true; return true;
} }
@@ -347,7 +346,7 @@ public:
bool ok = createIJKCellResults(rimCase->results(m_porosityModelEnum), propertyName); bool ok = createIJKCellResults(rimCase->results(m_porosityModelEnum), propertyName);
if (!ok) if (!ok)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the property named: \"%2\"").arg(propertyName)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the property named: \"%2\"").arg(propertyName));
return true; return true;
} }
RigEclipseResultAddress resAddr(QString("%1IJK").arg(propertyName)); RigEclipseResultAddress resAddr(QString("%1IJK").arg(propertyName));
@@ -386,7 +385,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riSetNNCProperty : \n") + server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riSetNNCProperty : \n") +
RiaSocketServer::tr("An error occurred while interpreting the requested time steps.")); RiaSocketServer::tr("An error occurred while interpreting the requested time steps."));
} }
@@ -394,7 +393,7 @@ public:
if (! m_requestedTimesteps.size()) if (! m_requestedTimesteps.size())
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified")); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified"));
return true; return true;
} }
@@ -466,7 +465,7 @@ public:
if (connectionCountFromOctave != connectionCount) if (connectionCountFromOctave != connectionCount)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") +
RiaSocketServer::tr("The number of connections in the data coming from octave does not match the case: '%1'\n").arg(m_currentReservoir->caseUserDescription()) + RiaSocketServer::tr("The number of connections in the data coming from octave does not match the case: '%1'\n").arg(m_currentReservoir->caseUserDescription()) +
RiaSocketServer::tr(" Octave: %1\n").arg(connectionCountFromOctave) + RiaSocketServer::tr(" Octave: %1\n").arg(connectionCountFromOctave) +
RiaSocketServer::tr(" %1: Connection count: %2").arg(m_currentReservoir->caseUserDescription()).arg(connectionCount)); RiaSocketServer::tr(" %1: Connection count: %2").arg(m_currentReservoir->caseUserDescription()).arg(connectionCount));
@@ -499,7 +498,7 @@ public:
{ {
for (int i = 0; i < errorMessages.size(); i++) for (int i = 0; i < errorMessages.size(); i++)
{ {
server->errorMessageDialog()->showMessage(errorMessages[i]); server->showErrorMessage(errorMessages[i]);
} }
currentClient->abort(); currentClient->abort();

View File

@@ -47,8 +47,6 @@
#include "RiuProcessMonitor.h" #include "RiuProcessMonitor.h"
#include "Riu3dSelectionManager.h" #include "Riu3dSelectionManager.h"
#include <QErrorMessage>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -85,7 +83,7 @@ public:
if (scalarResultFrames == nullptr) if (scalarResultFrames == nullptr)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n")
+ RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName)); + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
} }
@@ -130,7 +128,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetActiveCellProperty : \n") + RiaSocketServer::tr("An error occured while interpreting the requested timesteps.")); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetActiveCellProperty : \n") + RiaSocketServer::tr("An error occured while interpreting the requested timesteps."));
} }
} }
@@ -228,7 +226,7 @@ public:
RimEclipseCase*rimCase = server->findReservoir(caseId); RimEclipseCase*rimCase = server->findReservoir(caseId);
if (rimCase == nullptr) if (rimCase == nullptr)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID: \"%1\"").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID: \"%1\"").arg(caseId));
// No data available // No data available
socketStream << (quint64)0 << (quint64)0 << (quint64)0 << (quint64)0 ; socketStream << (quint64)0 << (quint64)0 << (quint64)0 << (quint64)0 ;
@@ -247,7 +245,7 @@ public:
if (gridIdx < 0 || rimCase->eclipseCaseData()->gridCount() <= (size_t)gridIdx) if (gridIdx < 0 || rimCase->eclipseCaseData()->gridCount() <= (size_t)gridIdx)
{ {
server->errorMessageDialog()->showMessage("ResInsight SocketServer: riGetGridProperty : \n" server->showErrorMessage("ResInsight SocketServer: riGetGridProperty : \n"
"The gridIndex \"" + QString::number(gridIdx) + "\" does not point to an existing grid." ); "The gridIndex \"" + QString::number(gridIdx) + "\" does not point to an existing grid." );
} }
else else
@@ -261,7 +259,7 @@ public:
if (!isResultsLoaded) if (!isResultsLoaded)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
// No data available // No data available
socketStream << (quint64)0 << (quint64)0 << (quint64)0 << (quint64)0 ; socketStream << (quint64)0 << (quint64)0 << (quint64)0 << (quint64)0 ;
@@ -301,7 +299,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n") server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n")
+ RiaSocketServer::tr("An error occured while interpreting the requested timesteps.")); + RiaSocketServer::tr("An error occured while interpreting the requested timesteps."));
} }
@@ -432,7 +430,7 @@ public:
if (scalarResultFrames == nullptr) if (scalarResultFrames == nullptr)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
return true; return true;
} }
@@ -481,14 +479,14 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetActiveCellProperty : \n") + RiaSocketServer::tr("An error occured while interpreting the requested timesteps.")); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetActiveCellProperty : \n") + RiaSocketServer::tr("An error occured while interpreting the requested timesteps."));
} }
} }
if (! m_requestedTimesteps.size()) if (! m_requestedTimesteps.size())
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified").arg(porosityModelName).arg(propertyName)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified").arg(porosityModelName).arg(propertyName));
return true; return true;
} }
@@ -536,7 +534,7 @@ public:
if (cellCountFromOctave != activeCellCountReservoir ) if (cellCountFromOctave != activeCellCountReservoir )
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") +
RiaSocketServer::tr("The number of cells in the data coming from octave does not match the case") + ":\"" + m_currentReservoir->caseUserDescription() + "\"\n" RiaSocketServer::tr("The number of cells in the data coming from octave does not match the case") + ":\"" + m_currentReservoir->caseUserDescription() + "\"\n"
" Octave: " + QString::number(cellCountFromOctave) + "\n" " Octave: " + QString::number(cellCountFromOctave) + "\n"
" " + m_currentReservoir->caseUserDescription() + ": Active cell count: " + QString::number(activeCellCountReservoir) + " Total cell count: " + QString::number(totalCellCount)) ; " " + m_currentReservoir->caseUserDescription() + ": Active cell count: " + QString::number(activeCellCountReservoir) + " Total cell count: " + QString::number(totalCellCount)) ;
@@ -600,7 +598,7 @@ public:
{ {
for (int i = 0; i < errorMessages.size(); i++) for (int i = 0; i < errorMessages.size(); i++)
{ {
server->errorMessageDialog()->showMessage(errorMessages[i]); server->showErrorMessage(errorMessages[i]);
} }
currentClient->abort(); currentClient->abort();
@@ -740,7 +738,7 @@ public:
RimEclipseCase* rimCase = server->findReservoir(caseId); RimEclipseCase* rimCase = server->findReservoir(caseId);
if (!rimCase) if (!rimCase)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId));
return true; return true;
} }
@@ -757,7 +755,7 @@ public:
RigGridBase* grid = rimCase->eclipseCaseData()->grid(m_currentGridIndex); RigGridBase* grid = rimCase->eclipseCaseData()->grid(m_currentGridIndex);
if (!grid) if (!grid)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the grid index : %1").arg(m_currentGridIndex)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the grid index : %1").arg(m_currentGridIndex));
return true; return true;
} }
@@ -779,7 +777,7 @@ public:
grid->cellCountJ() != cellCountJ || grid->cellCountJ() != cellCountJ ||
grid->cellCountK() != cellCountK) grid->cellCountK() != cellCountK)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Destination grid size do not match incoming grid size for grid index : %1").arg(m_currentGridIndex)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Destination grid size do not match incoming grid size for grid index : %1").arg(m_currentGridIndex));
return true; return true;
} }
@@ -788,7 +786,7 @@ public:
if (m_timeStepCountToRead == 0 || m_bytesPerTimeStepToRead == 0) if (m_timeStepCountToRead == 0 || m_bytesPerTimeStepToRead == 0)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") +
RiaSocketServer::tr("Zero data to read for ") + ":\"" + m_currentReservoir->caseUserDescription() + "\"\n"); RiaSocketServer::tr("Zero data to read for ") + ":\"" + m_currentReservoir->caseUserDescription() + "\"\n");
return true; return true;
@@ -816,7 +814,7 @@ public:
if (scalarResultFrames == nullptr) if (scalarResultFrames == nullptr)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
return true; return true;
} }
@@ -852,7 +850,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetActiveCellProperty : \n") + RiaSocketServer::tr("An error occured while interpreting the requested timesteps.")); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetActiveCellProperty : \n") + RiaSocketServer::tr("An error occured while interpreting the requested timesteps."));
return true; return true;
} }
@@ -860,7 +858,7 @@ public:
if (! m_requestedTimesteps.size()) if (! m_requestedTimesteps.size())
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified").arg(porosityModelName).arg(propertyName)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified").arg(porosityModelName).arg(propertyName));
return true; return true;
} }
@@ -893,7 +891,7 @@ public:
RigGridBase* grid = m_currentReservoir->eclipseCaseData()->grid(m_currentGridIndex); RigGridBase* grid = m_currentReservoir->eclipseCaseData()->grid(m_currentGridIndex);
if (!grid) if (!grid)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") +
RiaSocketServer::tr("No grid found") + ":\"" + m_currentReservoir->caseUserDescription() + "\"\n"); RiaSocketServer::tr("No grid found") + ":\"" + m_currentReservoir->caseUserDescription() + "\"\n");
m_invalidDataDetected = true; m_invalidDataDetected = true;
@@ -914,7 +912,7 @@ public:
if (cellCountFromOctave != grid->cellCount()) if (cellCountFromOctave != grid->cellCount())
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") +
RiaSocketServer::tr("Mismatch between expected and received data. Expected : %1, Received : %2").arg(grid->cellCount()).arg(cellCountFromOctave)); RiaSocketServer::tr("Mismatch between expected and received data. Expected : %1, Received : %2").arg(grid->cellCount()).arg(cellCountFromOctave));
m_invalidDataDetected = true; m_invalidDataDetected = true;
@@ -965,7 +963,7 @@ public:
{ {
for (int i = 0; i < errorMessages.size(); i++) for (int i = 0; i < errorMessages.size(); i++)
{ {
server->errorMessageDialog()->showMessage(errorMessages[i]); server->showErrorMessage(errorMessages[i]);
} }
currentClient->abort(); currentClient->abort();
@@ -1093,7 +1091,7 @@ public:
RimEclipseCase* rimCase = server->findReservoir(caseId); RimEclipseCase* rimCase = server->findReservoir(caseId);
if (!rimCase) if (!rimCase)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId));
return true; return true;
} }
@@ -1225,7 +1223,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n") server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n")
+ RiaSocketServer::tr("An error occurred while interpreting the requested time steps.")); + RiaSocketServer::tr("An error occurred while interpreting the requested time steps."));
} }

View File

@@ -22,6 +22,7 @@
#include "RiaSocketCommand.h" #include "RiaSocketCommand.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
@@ -35,7 +36,6 @@
#include "cafFactory.h" #include "cafFactory.h"
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/qerrormessage.h>
#include <QtWidgets/qmdisubwindow.h> #include <QtWidgets/qmdisubwindow.h>
#else #else
#include <QtGui> #include <QtGui>
@@ -56,8 +56,6 @@ RiaSocketServer::RiaSocketServer(QObject* parent)
m_currentCommand(nullptr), m_currentCommand(nullptr),
m_currentCaseId(-1) m_currentCaseId(-1)
{ {
m_errorMessageDialog = new QErrorMessage(RiuMainWindow::instance());
// TCP server setup // TCP server setup
m_tcpServer = new QTcpServer(this); m_tcpServer = new QTcpServer(this);
@@ -68,17 +66,16 @@ RiaSocketServer::RiaSocketServer(QObject* parent)
if (!m_tcpServer->listen(QHostAddress::LocalHost, 40001)) if (!m_tcpServer->listen(QHostAddress::LocalHost, 40001))
{ {
if (RiaApplication::instance()->preferences()->showOctaveCommunicationWarning()) QString txt;
{ txt = "This instance of ResInsight could not start the Socket Server enabling octave to get and set data.\n "
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" "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" "Octave can only communicate with one ResInsight process at a time, so the Octave\n"
"communication in this ResInsight instance will be disabled.\n" "communication in this ResInsight instance will be disabled.\n"
"\n" "\n" +
+ tr("The error from the socket system is: %1.").arg(m_tcpServer->errorString())); tr("The error from the socket system is: %1.").arg(m_tcpServer->errorString());
}
RiaLogging::error(txt);
return; return;
} }
@@ -125,7 +122,10 @@ void RiaSocketServer::slotNewClientConnection()
if (!isFinshed) if (!isFinshed)
{ {
m_errorMessageDialog->showMessage(tr("ResInsight SocketServer: \n") + tr("Warning : The command did not finish up correctly at the presence of a new one.")); QString txt;
txt = "ResInsight SocketServer : The command did not finish up correctly at the presence of a new one.";
RiaLogging::error(txt);
} }
} }
@@ -236,7 +236,10 @@ bool RiaSocketServer::readCommandFromOctave()
} }
else else
{ {
m_errorMessageDialog->showMessage(tr("ResInsight SocketServer: \n") + tr("Unknown command: %1").arg(args[0].data())); QString txt;
txt = QString("ResInsight SocketServer: Unknown command: %1").arg(args[0].data());
RiaLogging::error(txt);
return true; return true;
} }
} }
@@ -254,7 +257,10 @@ void RiaSocketServer::slotCurrentClientDisconnected()
if (!isFinished) if (!isFinished)
{ {
m_errorMessageDialog->showMessage(tr("ResInsight SocketServer: \n") + tr("Warning : The command was interrupted and did not finish because the connection to octave disconnected.")); QString txt;
txt = QString("ResInsight SocketServer: The command was interrupted and did not finish because the connection to octave disconnected.");
RiaLogging::error(txt);
} }
} }
@@ -301,6 +307,14 @@ int RiaSocketServer::currentCaseId() const
return m_currentCaseId; return m_currentCaseId;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSocketServer::showErrorMessage(const QString& message) const
{
RiaLogging::error(message);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -31,7 +31,6 @@ class QPushButton;
class QTcpServer; class QTcpServer;
class QTcpSocket; class QTcpSocket;
class QNetworkSession; class QNetworkSession;
class QErrorMessage;
class QTimer; class QTimer;
class RimEclipseCase; class RimEclipseCase;
class RiaSocketCommand; class RiaSocketCommand;
@@ -52,12 +51,13 @@ public:
unsigned short serverPort(); unsigned short serverPort();
RimEclipseCase* findReservoir(int caseId); RimEclipseCase* findReservoir(int caseId);
QErrorMessage* errorMessageDialog() { return m_errorMessageDialog; }
QTcpSocket* currentClient() { return m_currentClient; } QTcpSocket* currentClient() { return m_currentClient; }
void setCurrentCaseId(int caseId); void setCurrentCaseId(int caseId);
int currentCaseId() const; int currentCaseId() const;
void showErrorMessage(const QString& message) const;
private slots: private slots:
void slotNewClientConnection(); void slotNewClientConnection();
void slotCurrentClientDisconnected(); void slotCurrentClientDisconnected();
@@ -70,7 +70,6 @@ private:
private: private:
QTcpServer* m_tcpServer; QTcpServer* m_tcpServer;
QErrorMessage* m_errorMessageDialog;
QTcpSocket* m_currentClient; QTcpSocket* m_currentClient;
qint64 m_currentCommandSize; ///< The size in bytes of the command we are currently reading. qint64 m_currentCommandSize; ///< The size in bytes of the command we are currently reading.

View File

@@ -41,7 +41,6 @@
#include "cvfTimer.h" #include "cvfTimer.h"
#include <QErrorMessage>
#include <QTcpSocket> #include <QTcpSocket>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -61,7 +60,7 @@ RimEclipseCase* RiaSocketTools::findCaseFromArgs(RiaSocketServer* server, const
if (rimCase == nullptr) if (rimCase == nullptr)
{ {
// TODO: Display error message a different place to avoid socket comm to be halted. // TODO: Display error message a different place to avoid socket comm to be halted.
//server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the Case with CaseId : \"%1\"").arg(caseId)); //server->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the Case with CaseId : \"%1\"").arg(caseId));
} }
return rimCase; return rimCase;
@@ -131,13 +130,13 @@ bool RiaSocketTools::writeBlockData(RiaSocketServer* server, QTcpSocket* socket,
{ {
for (int i = 0; i < errorMessages.size(); i++) for (int i = 0; i < errorMessages.size(); i++)
{ {
server->errorMessageDialog()->showMessage(errorMessages[i]); server->showErrorMessage(errorMessages[i]);
} }
// double totalTimeMS = timer.time() * 1000.0; // double totalTimeMS = timer.time() * 1000.0;
// QString resultInfo = QString("Total time '%1 ms'").arg(totalTimeMS); // QString resultInfo = QString("Total time '%1 ms'").arg(totalTimeMS);
// //
// server->errorMessageDialog()->showMessage(resultInfo); // server->showMessage(resultInfo);
} }
return writeSucceded; return writeSucceded;

View File

@@ -30,7 +30,6 @@
#include "cvfCollection.h" #include "cvfCollection.h"
#include <QErrorMessage>
#include <QTcpSocket> #include <QTcpSocket>
@@ -48,7 +47,7 @@ public:
RimEclipseCase* rimCase = server->findReservoir(caseId); RimEclipseCase* rimCase = server->findReservoir(caseId);
if (!rimCase) if (!rimCase)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId));
return true; return true;
} }
@@ -102,7 +101,7 @@ public:
RimEclipseCase* rimCase = server->findReservoir(caseId); RimEclipseCase* rimCase = server->findReservoir(caseId);
if (!rimCase) if (!rimCase)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId));
return true; return true;
} }
@@ -125,7 +124,7 @@ public:
if (currentWellResult.isNull()) if (currentWellResult.isNull())
{ {
server->errorMessageDialog()->showMessage( server->showErrorMessage(
RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the well with name : \"%1\"").arg(wellName)); RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the well with name : \"%1\"").arg(wellName));
return true; return true;
@@ -161,7 +160,7 @@ public:
if (timeStepReadError) if (timeStepReadError)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n") server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n")
+ RiaSocketServer::tr("An error occured while interpreting the requested timesteps.")); + RiaSocketServer::tr("An error occured while interpreting the requested timesteps."));
} }
} }
@@ -241,7 +240,7 @@ public:
RimEclipseCase* rimCase = server->findReservoir(caseId); RimEclipseCase* rimCase = server->findReservoir(caseId);
if (!rimCase) if (!rimCase)
{ {
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId)); server->showErrorMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID : \"%1\"").arg(caseId));
socketStream << (quint64)0; socketStream << (quint64)0;
return true; return true;
@@ -260,7 +259,7 @@ public:
if (currentWellResult.isNull()) if (currentWellResult.isNull())
{ {
server->errorMessageDialog()->showMessage( server->showErrorMessage(
RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the well with name : \"%1\"").arg(wellName)); RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the well with name : \"%1\"").arg(wellName));
socketStream << (quint64)0; socketStream << (quint64)0;