diff options
author | Andy Nichols <andy.nichols@qt.io> | 2018-05-31 13:11:56 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-05-31 11:50:59 +0000 |
commit | 12b6afa18edb5fc25fceacb3305f1e064795f6b1 (patch) | |
tree | 4218c76584712951c2a676a8d70bbedc105eaa1b | |
parent | 3fd9cacf0ad1887a231c42522374797ab371566d (diff) |
Remote Viewer UX improvments
Mostly about making sure that we return to the Connection Info screen
when necessary.
I also made it where the remote project loading screen has to be shown a
minimum of 1 second.
Task-number: QT3DS-983
Change-Id: Ia9768b11c79c11cf72cd046cba6e48815ed6855a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | tools/q3dsviewer/q3dsremotedeploymentmanager.cpp | 34 | ||||
-rw-r--r-- | tools/q3dsviewer/q3dsremotedeploymentmanager.h | 4 | ||||
-rw-r--r-- | tools/q3dsviewer/resources/intro/Intro.uip | 12 |
3 files changed, 35 insertions, 15 deletions
diff --git a/tools/q3dsviewer/q3dsremotedeploymentmanager.cpp b/tools/q3dsviewer/q3dsremotedeploymentmanager.cpp index 557c067..2696ebd 100644 --- a/tools/q3dsviewer/q3dsremotedeploymentmanager.cpp +++ b/tools/q3dsviewer/q3dsremotedeploymentmanager.cpp @@ -55,8 +55,17 @@ Q3DSRemoteDeploymentManager::Q3DSRemoteDeploymentManager(Q3DSEngine *engine, int this, &Q3DSRemoteDeploymentManager::remoteDisconnected); connect(m_server, &Q3DSRemoteDeploymentServer::projectChanging, this, &Q3DSRemoteDeploymentManager::remoteProjectChanging); - connect(m_server, &Q3DSRemoteDeploymentServer::projectChanged, - this, &Q3DSRemoteDeploymentManager::loadRemoteProject); + connect(m_server, &Q3DSRemoteDeploymentServer::projectChanged, [this] { + m_isRemoteProjectLoaded = true; + loadRemoteProject(); + }); + + m_connectionInfoTimer.setInterval(1000); + m_connectionInfoTimer.setSingleShot(true); + connect(&m_connectionInfoTimer, &QTimer::timeout, [this] { + m_isReadyToShow = true; + loadRemoteProject(); + }); } Q3DSRemoteDeploymentManager::~Q3DSRemoteDeploymentManager() @@ -113,13 +122,17 @@ Q3DSRemoteDeploymentManager::State Q3DSRemoteDeploymentManager::state() const void Q3DSRemoteDeploymentManager::remoteConnected() { + if (m_state == LocalProject || m_state == RemoteProject) + showConnectionSetup(); + setState(RemoteConnected); setErrorMessage(tr("Connected!")); } void Q3DSRemoteDeploymentManager::remoteDisconnected() { - setState(ConnectionInfo); + if (m_state == LocalProject || m_state == RemoteProject) + showConnectionSetup(); setErrorMessage(tr("Disconnected from Qt 3D Studio...")); } @@ -131,15 +144,22 @@ void Q3DSRemoteDeploymentManager::remoteProjectChanging() if (m_state == RemoteLoading) return; + if (m_state == LocalProject || m_state == RemoteProject) + showConnectionSetup(); setState(RemoteLoading); + m_connectionInfoTimer.start(); setErrorMessage(tr("Loading Remote Project...")); } void Q3DSRemoteDeploymentManager::loadRemoteProject() { - setState(RemoteProject); - const QString remoteProject = m_server->fileName(); - loadFile(remoteProject); + if (m_isReadyToShow && m_isRemoteProjectLoaded) { + setState(RemoteProject); + const QString remoteProject = m_server->fileName(); + loadFile(remoteProject); + m_isReadyToShow = false; + m_isRemoteProjectLoaded = false; + } } void Q3DSRemoteDeploymentManager::loadFile(const QString &filename) @@ -174,8 +194,6 @@ void Q3DSRemoteDeploymentManager::setupConnectionScene() m_engine->setDataInputValue(c_connectionErrorDataInput(), m_errorMessage); if (!m_server->isConnected()) setState(ConnectionInfo); - else - remoteConnected(); } QString Q3DSRemoteDeploymentManager::generateConnectionInfo() diff --git a/tools/q3dsviewer/q3dsremotedeploymentmanager.h b/tools/q3dsviewer/q3dsremotedeploymentmanager.h index cb89f21..b178206 100644 --- a/tools/q3dsviewer/q3dsremotedeploymentmanager.h +++ b/tools/q3dsviewer/q3dsremotedeploymentmanager.h @@ -31,6 +31,7 @@ #define Q3DSREMOTEDEPLOYMENTMANAGER_H #include <QObject> +#include <QTimer> QT_BEGIN_NAMESPACE @@ -82,6 +83,9 @@ private: int m_port; QString m_errorMessage; State m_state = LocalProject; + QTimer m_connectionInfoTimer; + bool m_isReadyToShow = false; + bool m_isRemoteProjectLoaded = false; }; QT_END_NAMESPACE diff --git a/tools/q3dsviewer/resources/intro/Intro.uip b/tools/q3dsviewer/resources/intro/Intro.uip index 4b0b1cb..44279c1 100644 --- a/tools/q3dsviewer/resources/intro/Intro.uip +++ b/tools/q3dsviewer/resources/intro/Intro.uip @@ -1,14 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> -<UIP version="3" > +<UIP version="4" > <Project > - <ProjectSettings author="" company="" presentationWidth="1920" presentationHeight="1080" maintainAspect="False" > + <ProjectSettings author="" company="" presentationWidth="1280" presentationHeight="720" maintainAspect="False" > <CustomColors count="16" >#ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff</CustomColors> </ProjectSettings> <Graph > <Scene id="Scene" backgroundcolor="0.180392 0.184314 0.188235" > <Layer id="Layer" > <Camera id="Camera" /> - <Light id="Light" /> <Text id="Text" /> <Text id="errorText" /> </Layer> @@ -17,11 +16,10 @@ <Logic > <State name="Master Slide" component="#Scene" > <Add ref="#Layer" background="Transparent" backgroundcolor="0.211765 0.211765 0.211765" height="80" left="10" top="10" width="80" /> - <Add ref="#Camera" /> - <Add ref="#Light" /> + <Add ref="#Camera" orthographic="True" /> <State id="Scene-Slide1" name="Slide1" > - <Add ref="#Text" name="connectionText" controlledproperty="connectionInfo textstring" font="TitilliumWeb-Regular" position="6.41181 0 0" size="36" textstring="Use IP: x.x.x.x and Port: 36000 in Qt 3D Studio Editor to connect to this viewer. Use File/Open... to open a local presentation." /> - <Add ref="#errorText" name="errorText" controlledproperty="errorInfo textstring" font="TitilliumWeb-Regular" position="0 -232.208 0" textcolor="1 0.341176 0.341176" textstring="Error Text" /> + <Add ref="#Text" name="connectionText" controlledproperty="connectionInfo textstring" font="TitilliumWeb-Regular" position="6.41181 110 0" size="48" textstring="Use IP: x.x.x.x and Port: 36000 in Qt 3D Studio Editor to connect to this viewer. Use File/Open... to open a local presentation." /> + <Add ref="#errorText" name="errorText" controlledproperty="errorInfo textstring" font="TitilliumWeb-Regular" position="0 -232.208 0" size="38" textcolor="1 0.341176 0.341176" textstring="Error Text" /> </State> </State> </Logic> |