mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 23:33:48 +02:00
Merge pull request #11850 from druiz17/tablet-initial-page
Fix tablet not loading webpage when tablet root not initialized
This commit is contained in:
commit
6429b61463
2 changed files with 22 additions and 4 deletions
|
@ -328,7 +328,8 @@ void TabletProxy::initialScreen(const QVariant& url) {
|
|||
pushOntoStack(url);
|
||||
} else {
|
||||
_initialScreen = true;
|
||||
_initialPath = url;
|
||||
_initialPath.first = url;
|
||||
_initialPath.second = State::QML;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,10 +417,18 @@ void TabletProxy::setQmlTabletRoot(OffscreenQmlSurface* qmlOffscreenSurface) {
|
|||
});
|
||||
|
||||
if (_initialScreen) {
|
||||
if (!_showRunningScripts) {
|
||||
pushOntoStack(_initialPath);
|
||||
if (!_showRunningScripts && _initialPath.second == State::QML) {
|
||||
pushOntoStack(_initialPath.first);
|
||||
} else if (_initialPath.second == State::Web) {
|
||||
QVariant webUrl = _initialPath.first;
|
||||
QVariant scriptUrl = _initialWebPathParams.first;
|
||||
gotoWebScreen(webUrl.toString(), scriptUrl.toString(), _initialWebPathParams.second);
|
||||
}
|
||||
_initialScreen = false;
|
||||
_initialPath.first = "";
|
||||
_initialPath.second = State::Uninitialized;
|
||||
_initialWebPathParams.first = "";
|
||||
_initialWebPathParams.second = false;
|
||||
}
|
||||
|
||||
if (_showRunningScripts) {
|
||||
|
@ -685,6 +694,14 @@ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaS
|
|||
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||
}
|
||||
QMetaObject::invokeMethod(root, "loadWebUrl", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectedJavaScriptUrl)));
|
||||
} else {
|
||||
// tablet is not initialized yet, save information and load when
|
||||
// the tablet root is set
|
||||
_initialPath.first = url;
|
||||
_initialPath.second = State::Web;
|
||||
_initialWebPathParams.first = injectedJavaScriptUrl;
|
||||
_initialWebPathParams.second = loadOtherBase;
|
||||
_initialScreen = true;
|
||||
}
|
||||
_state = State::Web;
|
||||
emit screenChanged(QVariant("Web"), QVariant(url));
|
||||
|
|
|
@ -248,7 +248,6 @@ protected:
|
|||
void removeButtonsFromToolbar();
|
||||
|
||||
bool _initialScreen { false };
|
||||
QVariant _initialPath { "" };
|
||||
QVariant _currentPathLoaded { "" };
|
||||
QString _name;
|
||||
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
||||
|
@ -260,6 +259,8 @@ protected:
|
|||
|
||||
enum class State { Uninitialized, Home, Web, Menu, QML };
|
||||
State _state { State::Uninitialized };
|
||||
std::pair<QVariant, State> _initialPath { "", State::Uninitialized };
|
||||
std::pair<QVariant, bool> _initialWebPathParams;
|
||||
bool _landscape { false };
|
||||
bool _showRunningScripts { false };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue