Commit 6ec143b0 authored by Cory Quammen's avatar Cory Quammen
Browse files

Delay default view creation until the client environment is complete

This provides an opportunity to extended the default view proxy
via plugins loaded at startup.
parent bb4f95eb
Pipeline #188420 waiting for manual action with stages
...@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqApplicationCore.h" #include "pqApplicationCore.h"
#include "pqCoreUtilities.h" #include "pqCoreUtilities.h"
#include "pqObjectBuilder.h" #include "pqObjectBuilder.h"
#include "pqPluginManager.h"
#include "pqRenderView.h" #include "pqRenderView.h"
#include "pqServer.h" #include "pqServer.h"
#include "pqServerManagerModel.h" #include "pqServerManagerModel.h"
...@@ -68,8 +69,19 @@ pqDefaultViewBehavior::pqDefaultViewBehavior(QObject* parentObject) ...@@ -68,8 +69,19 @@ pqDefaultViewBehavior::pqDefaultViewBehavior(QObject* parentObject)
QObject::connect(pqApplicationCore::instance()->getServerManagerModel(), QObject::connect(pqApplicationCore::instance()->getServerManagerModel(),
SIGNAL(serverAdded(pqServer*)), this, SLOT(onServerCreation(pqServer*))); SIGNAL(serverAdded(pqServer*)), this, SLOT(onServerCreation(pqServer*)));
this->ViewCreationTimer.setSingleShot(true);
this->ViewCreationTimer.setInterval(0);
this->connect(
&this->ViewCreationTimer, &pqTimer::timeout, [=] { this->createView(this->CurrentServer); });
this->WarningsTimer.setSingleShot(true); this->WarningsTimer.setSingleShot(true);
this->connect(&this->WarningsTimer, SIGNAL(timeout()), SLOT(showWarnings())); this->connect(&this->WarningsTimer, SIGNAL(timeout()), SLOT(showWarnings()));
// Listen for when the environment is fully set up. Among other things, this marks the end
// of autoload plugins being loaded, so it safe to create a view that may potentially be
// modified by a plugin.
this->connect(pqApplicationCore::instance(), &pqApplicationCore::clientEnvironmentDone,
[=]() { this->EnvironmentComplete = true; });
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -128,8 +140,7 @@ void pqDefaultViewBehavior::showWarnings() ...@@ -128,8 +140,7 @@ void pqDefaultViewBehavior::showWarnings()
void pqDefaultViewBehavior::onServerCreation(pqServer* server) void pqDefaultViewBehavior::onServerCreation(pqServer* server)
{ {
using RCInfo = vtkPVRenderingCapabilitiesInformation; using RCInfo = vtkPVRenderingCapabilitiesInformation;
this->CurrentServer = server;
pqApplicationCore* core = pqApplicationCore::instance();
// Get information about rendering capabilities. // Get information about rendering capabilities.
vtkNew<RCInfo> info; vtkNew<RCInfo> info;
...@@ -147,8 +158,28 @@ void pqDefaultViewBehavior::onServerCreation(pqServer* server) ...@@ -147,8 +158,28 @@ void pqDefaultViewBehavior::onServerCreation(pqServer* server)
// Setup a timer to show warning messages, if needed. // Setup a timer to show warning messages, if needed.
this->WarningsTimer.start(500); this->WarningsTimer.start(500);
this->createView(this->CurrentServer);
// Show warning dialogs before server times out.
QObject::connect(
server, SIGNAL(fiveMinuteTimeoutWarning()), this, SLOT(fiveMinuteTimeoutWarning()));
QObject::connect(server, SIGNAL(finalTimeoutWarning()), this, SLOT(finalTimeoutWarning()));
}
//-----------------------------------------------------------------------------
void pqDefaultViewBehavior::createView(pqServer* server)
{
if (!this->EnvironmentComplete)
{
this->ViewCreationTimer.start();
return;
}
using RCInfo = vtkPVRenderingCapabilitiesInformation;
// See if some view are already present and if we're in a collaborative // See if some view are already present and if we're in a collaborative
// session, we are the master. // session, we are the master.
pqApplicationCore* core = pqApplicationCore::instance();
if (core->getServerManagerModel()->getNumberOfItems<pqView*>() == 0 && server->isMaster()) if (core->getServerManagerModel()->getNumberOfItems<pqView*>() == 0 && server->isMaster())
{ {
pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder(); pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
...@@ -164,11 +195,6 @@ void pqDefaultViewBehavior::onServerCreation(pqServer* server) ...@@ -164,11 +195,6 @@ void pqDefaultViewBehavior::onServerCreation(pqServer* server)
} }
} }
} }
// Show warning dialogs before server times out.
QObject::connect(
server, SIGNAL(fiveMinuteTimeoutWarning()), this, SLOT(fiveMinuteTimeoutWarning()));
QObject::connect(server, SIGNAL(finalTimeoutWarning()), this, SLOT(finalTimeoutWarning()));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -57,6 +57,7 @@ public: ...@@ -57,6 +57,7 @@ public:
protected Q_SLOTS: protected Q_SLOTS:
void onServerCreation(pqServer*); void onServerCreation(pqServer*);
void createView(pqServer*);
void fiveMinuteTimeoutWarning(); void fiveMinuteTimeoutWarning();
void finalTimeoutWarning(); void finalTimeoutWarning();
...@@ -69,6 +70,9 @@ private: ...@@ -69,6 +70,9 @@ private:
vtkTypeUInt32 ClientCapabilities; vtkTypeUInt32 ClientCapabilities;
QPointer<pqServer> Server; QPointer<pqServer> Server;
pqTimer WarningsTimer; pqTimer WarningsTimer;
pqTimer ViewCreationTimer;
bool EnvironmentComplete = false;
QPointer<pqServer> CurrentServer;
}; };
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment